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
+17
-7
@@ -30975,12 +30975,7 @@ function canResolveTemurinJmods(version) {
|
||||
if (normalizedVersion === 'latest') {
|
||||
return true;
|
||||
}
|
||||
let normalizedRange = normalizedVersion
|
||||
.replace(/-ea$/, '')
|
||||
.replace('-ea.', '+');
|
||||
if (/^\d+(\.\d+){3,}$/.test(normalizedRange)) {
|
||||
normalizedRange = (0,_util_js__WEBPACK_IMPORTED_MODULE_1__/* .convertVersionToSemver */ .ZY)(normalizedRange);
|
||||
}
|
||||
const normalizedRange = (0,_util_js__WEBPACK_IMPORTED_MODULE_1__/* .normalizeJavaVersionToSemver */ .zZ)(normalizedVersion.replace(/-ea$/, '').replace('-ea.', '+'));
|
||||
if (!semver__WEBPACK_IMPORTED_MODULE_0___default().validRange(normalizedRange)) {
|
||||
// JavaBase owns general version validation and its targeted error messages.
|
||||
return true;
|
||||
@@ -31311,7 +31306,8 @@ function validateToolchainIds(versions, versionFile, toolchainIds) {
|
||||
/* harmony export */ rC: () => (/* binding */ getNextPageUrlFromLinkHeader),
|
||||
/* harmony export */ ri: () => (/* binding */ getLatestMajorVersion),
|
||||
/* harmony export */ y: () => (/* binding */ isVersionSatisfies),
|
||||
/* harmony export */ yH: () => (/* binding */ getToolcachePath)
|
||||
/* harmony export */ yH: () => (/* binding */ getToolcachePath),
|
||||
/* harmony export */ zZ: () => (/* binding */ normalizeJavaVersionToSemver)
|
||||
/* harmony export */ });
|
||||
/* unused harmony exports getVersionFromToolcachePath, isJobStatusSuccess */
|
||||
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(857);
|
||||
@@ -31712,6 +31708,20 @@ function convertVersionToSemver(version) {
|
||||
}
|
||||
return mainVersion;
|
||||
}
|
||||
/**
|
||||
* Java versions (JEP 322) can contain more numeric fields than SemVer allows,
|
||||
* e.g. '11.0.9.1' or Temurin respins such as '26.0.2.1+1'. Move the extra
|
||||
* fields into SemVer build metadata ('11.0.9+1', '26.0.2+1.1'). Any other
|
||||
* input (ranges, regular SemVer versions) is returned unchanged.
|
||||
*/
|
||||
function normalizeJavaVersionToSemver(version) {
|
||||
const match = /^(\d+(?:\.\d+){3,})(?:\+([0-9A-Za-z.-]+))?$/.exec(version);
|
||||
if (!match) {
|
||||
return version;
|
||||
}
|
||||
const converted = convertVersionToSemver(match[1]);
|
||||
return match[2] ? `${converted}.${match[2]}` : converted;
|
||||
}
|
||||
/**
|
||||
* Builds a validator for the bytes currently served by a URL from the response
|
||||
* headers of a HEAD request. A vendor's `/latest/` URL never changes, so this
|
||||
|
||||
Reference in New Issue
Block a user