mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
build
This commit is contained in:
parent
291b946ea5
commit
a2ae8283cb
2 changed files with 59 additions and 31 deletions
29
dist/cleanup/index.js
vendored
29
dist/cleanup/index.js
vendored
|
@ -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 = /(?<version>(?<=(^|\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;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue