Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groovy scripts in ReadMe not works #142

Open
GrapeBaBa opened this issue Jun 11, 2024 · 6 comments
Open

Groovy scripts in ReadMe not works #142

GrapeBaBa opened this issue Jun 11, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@GrapeBaBa
Copy link

Describe the bug
Groovy gradle script not works. No methods for architectures.

To Reproduce
Steps to reproduce the behavior:

  1. Copy the Groovy script from the ReadMe file.
  2. Run gradle build.
  3. Error like this https://github.com/optimism-java/hildr/actions/runs/9465053552

Expected behavior
No errors when building.

Logs
https://github.com/optimism-java/hildr/actions/runs/9465053552

Platform (please complete the following information):

  • Device: Linux
  • OS: Ubuntu
  • Java Version 21

Additional context

@hyperxpro hyperxpro added the bug Something isn't working label Jun 18, 2024
@hyperxpro
Copy link
Owner

Would you like to make a PR?

@ftzi
Copy link

ftzi commented Sep 2, 2024

I have the same error on GitLab CI. Doesn't happen locally.

@hyperxpro
Copy link
Owner

I have the same error on GitLab CI. Doesn't happen locally.

Can you help me with a reproducer?

@ftzi
Copy link

ftzi commented Sep 2, 2024

Kotlin/Java isn't my strong language so I am afraid I can't help much. But, you should be able to reproduce it by using OP's repo: https://github.com/optimism-java/hildr/pull/167/commits.

Note that he fixed his CI by changing the check at: optimism-java/hildr@9d42023

@ftzi
Copy link

ftzi commented Sep 3, 2024

Further info: I am using gradle 8.10, and I found out this when I went to the definitions of the isXYZ:

image

Maybe it didn't fail locally as I am using MacOS.

@ftzi
Copy link

ftzi commented Sep 3, 2024

I have updated mine to be

def brotliVersion = "1.17.0"
def operatingSystem = DefaultNativePlatform.getCurrentOperatingSystem()
def currentArchitecture = DefaultNativePlatform.getCurrentArchitecture()

repositories {
    mavenCentral()
}

dependencies {
    implementation "com.aayushatharva.brotli4j:brotli4j:$brotliVersion"
    runtimeOnly("""com.aayushatharva.brotli4j:native-${
        if (operatingSystem.isWindows())
            if (currentArchitecture.isAmd64()) "windows-x86_64"
            else if (currentArchitecture.isArm64()) "windows-aarch64"
            else
                throw new IllegalStateException("Unsupported architecture: ${currentArchitecture.getName()}");
        else if (operatingSystem.isMacOsX())
            if (currentArchitecture.isArm64()) "osx-aarch64"
            else "osx-x86_64"
        else if (operatingSystem.isLinux())
            if (currentArchitecture.isArm64()) "linux-aarch64"
            else if (currentArchitecture.isAmd64()) "linux-x86_64"
            else if (currentArchitecture.isArm32()) "linux-armv7"
            else if (currentArchitecture.isI386()) "linux-x86_64"  // Assuming I386 should also use linux-x86_64 as there is no linux-i386 folder
            else
                throw new IllegalStateException("Unsupported architecture: ${currentArchitecture.getName()}");
        else
            throw new IllegalStateException("Unsupported operating system: $operatingSystem");
    }:$brotliVersion""")
}

I don't know where this difference in methods comes from, though. I can do a PR, but I can't say if we are a minority that has this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants