-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow specifying different versions of JDKs per operating system and architecture #286
Conversation
Generate changelog in
|
…r/different-versions
…r/different-versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly curious about mixing of non-provider/property types inside the extensions, but not a huge blocker
@@ -24,11 +30,46 @@ public abstract class JdkExtension { | |||
|
|||
public abstract Property<JdkDistributionName> getDistributionName(); | |||
|
|||
private final Map<Os, JdkOsExtension> jdkOsExtensions = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use a NamedDomainObjectContainer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With NamedDomain....
need you to give a string for the name (or implement Named
, which bring in a needless gradle dep). I don't really think it buys much? Unless there's some magic you can do with it I'm not aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how it's used, I think it doesn't buy us as much, since we need it to statically exist. I believe it creates most of the methods for you, but that doesn't really matter if you're calling it from java
import java.util.Set; | ||
|
||
final class CurrentArch { | ||
static Arch current() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since Current*
is already in the name, how about CurrentArch.get()
?
WINDOWS; | ||
|
||
@Value.Default | ||
final class CurrentOs { | ||
public static Os current() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing re CurrentOs.get()
String version = jdkExtension | ||
.jdkFor(currentOs) | ||
.jdkFor(currentArch) | ||
.getJdkVersion() | ||
.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious, why force property retrieval here? do you not get into races with configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method, javaInstallationForLanguageVersion
is called from a lazy location, but you're right this could probably be even more lazy to avoid problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah
then: | ||
stdout.contains('jdkVersion macos aarch64: 11.1') | ||
stdout.contains('jdkVersion linux-glibc aarch64: 11.2') | ||
stdout.contains('jdkVersion linux-glibc x64: 11.3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
👍 pending |
👍 |
Released 0.35.0 |
Before this PR
Currently, gradle-jdks only allows you to specify one version of a JDK per java major version. This means all operating systems and architectures must use the same JDK version.
However, this falls apart in the presence of operating system only releases by JDK vendors. For example, Amazon Corretto recently released a "linux" only release for JDK 17 (
17.0.10.8.1
) and 21 (21.0.2.14.1
).We attempt to use same JDKs in both our prod environments and CI (which are linux based) and on developer's local machines (almost always macos). We had an unfortunate situation where automated upgrades of JDKs upgraded people's repos to these versions that did not have macos distributions, causing them to be unable to compile or test code locally.
After this PR
==COMMIT_MSG==
Allow specifying different versions of JDKs per operating system and architecture
==COMMIT_MSG==
We still want to get the latest JDKs in prod, even if they're on a linux only release. Our compliance constraints mean we must fix CVEs on a short timeframe, and these CVE fixes may be in a linux only release. Or there could be some critically important bugfix we need (but currently wouldn't be able to get without breaking people's dev setups). Even the current bug is scary and we should ensure gets onto prod ("AArch64: crypto pmull based CRC32/CRC32C intrinsics clobber V8-V15 registers").
There's changes internally to rest of the stack of Gradle plugins that deal with JDKs. Most notably, they all use the same json representation to list the latest JDKs, and we have an excavator that can produce this json file automatically.
This file format is in this repo because:
Example latest jdk json format
Possible downsides?