runningcode / gradle-doctor

The right prescription for your Gradle build.
http://runningcode.github.io/gradle-doctor
Apache License 2.0
723 stars 46 forks source link

Allow switching Rosetta check to "warn only" mode or turning it off #286

Closed Egorand closed 4 months ago

Egorand commented 7 months ago

The Rosetta check is amazing and it actually helped us realize we were using non-Apple silicon targeted JDK versions, which is great!

That said, it would be great to allow switching this check to "warn only" mode. I was just trying to help an engineer who had failing builds no matter what they tried, and we had to turn off Gradle Doctor completely to unblock their builds.

runningcode commented 7 months ago

Thanks for reporting. Can we're trying to fix an issue related to this where there is a bug in the logic. Could you tell me more about the environment for this engineer? OS, JDK, Vendor, etc?

ninniuz commented 7 months ago

@runningcode I am having issues with the Apple Rosetta check on the same old CI MacStudio arm64 M1 machine with gradle-doctor v0.9.1

The plugin is reporting the process is translated, even though both installed JVMs are arm64

% /usr/libexec/java_home -V 
Matching Java Virtual Machines (2):
    17.0.7 (arm64) "Eclipse Adoptium" - "OpenJDK 17.0.7" /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
    11.0.16.1 (arm64) "Azul Systems, Inc." - "Zulu 11.58.23" /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home

% file `which /usr/bin/java`
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64):    Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e):    Mach-O 64-bit executable arm64e

the machine is arm64

% uname -m
arm64

I have added a simple convention plugin on my project to report the output of the sysctl check and indeed it states the process is translated:

> Configure project :
sysctl.proc_translated: 1

The same checks on my M1 MacBook Pro laptop show the process is not translated though, so I don't know what could be wrong on the CI machine.

Do you have any idea or any further check I can perform?

runningcode commented 7 months ago

Thanks for the extra info.

I think to resolve the issue, please open up a support ticket for MacStudio. I'm sure they would be able to help you with that.

In the meantime, I agree that having an option to turn off the check and/or make it warn only is a good idea. I think this would be good to have for all Gradle Doctor checks and I apologize that I missed this in the code review. Unfortunately, I don't have time to work on this in the next month. I'm open to PRs for this feature though.

ninniuz commented 7 months ago

@runningcode thanks for your answer.

Do you mean a support ticket for MacStudio with Apple?

I can take a look at adding an option to either turn off the check and/or make it warn only in the near future, will let you know.

ninniuz commented 7 months ago

@runningcode I confirm the issue I was seeing with Apple Rosetta checks failing on some M1 MacStudio machines was due to usage of an x86_64 gitlab-runner instead of an arm64 version of the executable.

I think the exec task spawned from that process in Gradle and "inherited" the execution mode.

@Egorand do you think that, or a similar issue, could have been affecting your colleagues as well?