mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 09:26: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;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
61
dist/setup/index.js
vendored
61
dist/setup/index.js
vendored
|
@ -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 = /(?<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.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 = /(?<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