mirror of
https://gitea.com/actions/setup-java.git
synced 2026-10-02 21:25:25 +08:00
Accept 4-part versions with build metadata (X.Y.Z.P+B -> X.Y.Z+P.B) and match exact Temurin requests against OpenJDK-derived version keys, since the Adoptium API semver folds the patch into the build number (26.0.2+101) and adds LTS metadata (25.0.4+7.0.LTS). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Vendored
+3
-6
@@ -730,12 +730,9 @@ class JavaBase {
|
||||
}
|
||||
// Java uses a versioning scheme (JEP 322) that can contain more numeric
|
||||
// fields than SemVer allows, e.g. '18.0.1.1' or '11.0.9.1'. Convert such
|
||||
// exact versions to SemVer build notation ('18.0.1+1') so they are
|
||||
// accepted. Ranges and versions that already carry build metadata are
|
||||
// left untouched.
|
||||
if (/^\d+(\.\d+){3,}$/.test(version)) {
|
||||
version = (0,util/* convertVersionToSemver */.ZY)(version);
|
||||
}
|
||||
// exact versions to SemVer build notation ('18.0.1+1', or '26.0.2+1.1'
|
||||
// for '26.0.2.1+1') so they are accepted. Ranges are left untouched.
|
||||
version = (0,util/* normalizeJavaVersionToSemver */.zZ)(version);
|
||||
if (!semver_default().validRange(version)) {
|
||||
throw new Error(`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user