From a2ae8283cbbdaf85da7f99b106f4791e667b2de1 Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Thu, 8 Dec 2022 15:32:34 +0100 Subject: [PATCH] build --- dist/cleanup/index.js | 29 +++++++++++++++++++- dist/setup/index.js | 61 ++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 31 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index b34d7cdc..4c9a3602 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -68624,7 +68624,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; +exports.avoidOldNotation = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; const os_1 = __importDefault(__nccwpck_require__(2037)); const path_1 = __importDefault(__nccwpck_require__(1017)); const fs = __importStar(__nccwpck_require__(7147)); @@ -68720,6 +68720,33 @@ function isCacheFeatureAvailable() { return true; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; +function getVersionFromFileContent(content, distributionName) { + var _a, _b, _c, _d; + const javaVersionRegExp = /(?(?<=(^|\s|\-))(\d+\S*))(\s|$)/; + const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) + ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version + : ''; + if (!fileContent) { + return null; + } + const tentativeVersion = avoidOldNotation(fileContent); + let version = semver.validRange(tentativeVersion) + ? tentativeVersion + : semver.coerce(tentativeVersion); + if (!version) { + return null; + } + if (constants_1.DISTRIBUTIONS_ONLY_MAJOR_VERSION.includes(distributionName)) { + version = semver.major(version).toString(); + } + return version.toString(); +} +exports.getVersionFromFileContent = getVersionFromFileContent; +// By convention, action expects version 8 in the format `8.*` instead of `1.8` +function avoidOldNotation(content) { + return content.startsWith('1.') ? content.substring(2) : content; +} +exports.avoidOldNotation = avoidOldNotation; /***/ }), diff --git a/dist/setup/index.js b/dist/setup/index.js index 6366f1de..33f8b90f 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -105194,7 +105194,6 @@ const constants = __importStar(__nccwpck_require__(9042)); const cache_1 = __nccwpck_require__(4810); const path = __importStar(__nccwpck_require__(1017)); const distribution_factory_1 = __nccwpck_require__(924); -const semver = __importStar(__nccwpck_require__(1383)); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -105212,7 +105211,7 @@ function run() { toolchainIds = []; } if (!versions.length && !versionFile) { - throw new Error('Java-version or java-version-file input expected'); + throw new Error('java-version or java-version-file input expected'); } const installerInputsOptions = { architecture, @@ -105223,12 +105222,12 @@ function run() { toolchainIds }; if (!versions.length) { - core.debug('Java-version input is empty, looking for java-version-file input'); + core.debug('java-version input is empty, looking for java-version-file input'); const content = fs_1.default .readFileSync(versionFile) .toString() .trim(); - const version = getVersionFromFileContent(content, distributionName); + const version = util_1.getVersionFromFileContent(content, distributionName); if (!version) { throw new Error(`No supported version was found in file ${versionFile}`); } @@ -105274,31 +105273,6 @@ function installVersion(version, options, toolchainId = 0) { core.info(''); }); } -function getVersionFromFileContent(content, distributionName) { - var _a, _b, _c, _d; - const javaVersionRegExp = /(?(?<=(^|\s|\-))(\d+\S*))(\s|$)/; - const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) - ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version - : ''; - if (!fileContent) { - return null; - } - const tentativeVersion = avoidOldNotation(fileContent); - let version = semver.validRange(tentativeVersion) - ? tentativeVersion - : semver.coerce(tentativeVersion); - if (!version) { - return null; - } - if (constants.DISTRIBUTIONS_ONLY_MAJOR_VERSION.includes(distributionName)) { - version = semver.major(version).toString(); - } - return version.toString(); -} -// By convention, action expects version 8 in the format `8.*` instead of `1.8` -function avoidOldNotation(content) { - return content.startsWith('1.') ? content.substring(2) : content; -} /***/ }), @@ -105500,7 +105474,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; +exports.avoidOldNotation = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0; const os_1 = __importDefault(__nccwpck_require__(2037)); const path_1 = __importDefault(__nccwpck_require__(1017)); const fs = __importStar(__nccwpck_require__(7147)); @@ -105596,6 +105570,33 @@ function isCacheFeatureAvailable() { return true; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; +function getVersionFromFileContent(content, distributionName) { + var _a, _b, _c, _d; + const javaVersionRegExp = /(?(?<=(^|\s|\-))(\d+\S*))(\s|$)/; + const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) + ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version + : ''; + if (!fileContent) { + return null; + } + const tentativeVersion = avoidOldNotation(fileContent); + let version = semver.validRange(tentativeVersion) + ? tentativeVersion + : semver.coerce(tentativeVersion); + if (!version) { + return null; + } + if (constants_1.DISTRIBUTIONS_ONLY_MAJOR_VERSION.includes(distributionName)) { + version = semver.major(version).toString(); + } + return version.toString(); +} +exports.getVersionFromFileContent = getVersionFromFileContent; +// By convention, action expects version 8 in the format `8.*` instead of `1.8` +function avoidOldNotation(content) { + return content.startsWith('1.') ? content.substring(2) : content; +} +exports.avoidOldNotation = avoidOldNotation; /***/ }),