Fix Liberica SDKMAN patch release resolution (#1291)

* Fix Liberica SDKMAN patch release resolution

Preserve BellSoft's fourth version component as SDKMAN patch metadata and cover real API version formats for Java 17 and 25.

Fixes #1290

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d5b53868-538f-4c5f-b2aa-c66dc4ad06e2

* Fix Liberica patch ordering and build-less requests

Share overridable matching and ordering with toolcache selection. Keep patch-only requests distinct from exact SDKMAN build requests and cover the reported API pair across remote and cached resolution.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d5b53868-538f-4c5f-b2aa-c66dc4ad06e2

---------

Copilot-Session: d5b53868-538f-4c5f-b2aa-c66dc4ad06e2
This commit is contained in:
Bruno BorgesandCopilot App authored and GitHub committed 2026-10-19 10:48:21 -04:00
1 parent b843ebf9b9
commit 816722acf8
6 files changed
+343 -27

No files matched your search

+12 -4
View File
@@ -241,7 +241,7 @@ export abstract class JavaBase {
if (javaRelease.floating) {
if (
!semver.valid(foundJava.version) ||
!isVersionSatisfies(this.version, foundJava.version)
!this.isVersionSatisfied(this.version, foundJava.version)
) {
throw new Error(
`The downloaded ${this.distribution} artifact reported Java ${foundJava.version}, which does not satisfy '${this.version}'.`
@@ -401,7 +401,7 @@ export abstract class JavaBase {
}
if (
!semver.valid(restored.release.version) ||
!isVersionSatisfies(this.version, restored.release.version)
!this.isVersionSatisfied(this.version, restored.release.version)
) {
core.debug(
`Ignoring the cached concrete version '${restored.release.version}' for ${this.distribution} ${this.version}.`
@@ -622,10 +622,10 @@ export abstract class JavaBase {
.filter(item => item.stable === this.stable);
const satisfiedVersions = availableVersions
.filter(item => isVersionSatisfies(this.version, item.version))
.filter(item => this.isVersionSatisfied(this.version, item.version))
.filter(item => item.path)
.sort((a, b) => {
return -semver.compareBuild(a.version, b.version);
return -this.compareVersions(a.version, b.version);
});
if (!satisfiedVersions || satisfiedVersions.length === 0) {
return null;
@@ -637,6 +637,14 @@ export abstract class JavaBase {
};
}
protected isVersionSatisfied(range: string, version: string): boolean {
return isVersionSatisfies(range, version);
}
protected compareVersions(a: string, b: string): number {
return semver.compareBuild(a, b);
}
protected normalizeVersion(version: string) {
let stable = true;
const latest = false;