mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 01:46:46 +00:00
add support for dragonwell
This commit is contained in:
parent
5ffc13f417
commit
ec1af222f0
8 changed files with 1724 additions and 1 deletions
164
dist/setup/index.js
vendored
164
dist/setup/index.js
vendored
|
@ -104319,6 +104319,7 @@ const installer_6 = __nccwpck_require__(3613);
|
|||
const installer_7 = __nccwpck_require__(1121);
|
||||
const installer_8 = __nccwpck_require__(4750);
|
||||
const installer_9 = __nccwpck_require__(4298);
|
||||
const installer_10 = __nccwpck_require__(6132);
|
||||
var JavaDistribution;
|
||||
(function (JavaDistribution) {
|
||||
JavaDistribution["Adopt"] = "adopt";
|
||||
|
@ -104332,6 +104333,7 @@ var JavaDistribution;
|
|||
JavaDistribution["Semeru"] = "semeru";
|
||||
JavaDistribution["Corretto"] = "corretto";
|
||||
JavaDistribution["Oracle"] = "oracle";
|
||||
JavaDistribution["Dragonwell"] = "dragonwell";
|
||||
})(JavaDistribution || (JavaDistribution = {}));
|
||||
function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
||||
switch (distributionName) {
|
||||
|
@ -104356,6 +104358,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
|||
return new installer_8.CorrettoDistribution(installerOptions);
|
||||
case JavaDistribution.Oracle:
|
||||
return new installer_9.OracleDistribution(installerOptions);
|
||||
case JavaDistribution.Dragonwell:
|
||||
return new installer_10.DragonwellDistribution(installerOptions);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -104363,6 +104367,166 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
|||
exports.getJavaDistribution = getJavaDistribution;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6132:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.DragonwellDistribution = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const base_installer_1 = __nccwpck_require__(9741);
|
||||
const util_1 = __nccwpck_require__(2629);
|
||||
class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
constructor(installerOptions) {
|
||||
super('Dragonwell', installerOptions);
|
||||
}
|
||||
findPackageForDownload(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!this.stable) {
|
||||
throw new Error('Early access versions are not supported');
|
||||
}
|
||||
let majorVersion = version;
|
||||
if (version.includes('.')) {
|
||||
const splits = version.split('.');
|
||||
majorVersion = splits[0];
|
||||
version = splits.length >= 3 ? splits.slice(0, 3).join('.') : version;
|
||||
}
|
||||
const edition = majorVersion == '17' ? 'Standard' : 'Extended';
|
||||
const availableVersions = yield this.getAvailableVersions();
|
||||
const matchedVersions = availableVersions
|
||||
.filter(item => item.jdk_version == version && item.edition == edition)
|
||||
.map(item => {
|
||||
return {
|
||||
version: item.jdk_version,
|
||||
url: item.download_link
|
||||
};
|
||||
});
|
||||
if (!matchedVersions.length) {
|
||||
throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`);
|
||||
}
|
||||
const resolvedVersion = matchedVersions[0];
|
||||
return resolvedVersion;
|
||||
});
|
||||
}
|
||||
getAvailableVersions() {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||
const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl))
|
||||
.result) !== null && _a !== void 0 ? _a : {};
|
||||
if (Object.keys(fetchedDragonwellVersions).length == 0) {
|
||||
throw Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`);
|
||||
}
|
||||
const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions);
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
core.debug(availableVersions.map(item => item.jdk_version).join(', '));
|
||||
core.endGroup();
|
||||
}
|
||||
return availableVersions;
|
||||
});
|
||||
}
|
||||
downloadTool(javaRelease) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
|
||||
core.info(`Extracting Java archive...`);
|
||||
const extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, util_1.getDownloadArchiveExtension());
|
||||
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
});
|
||||
}
|
||||
getEligibleAvailableVersions(platform, arch, dragonwellVersions) {
|
||||
const eligibleVersions = [];
|
||||
for (const majorVersion in dragonwellVersions) {
|
||||
const majorVersionMap = dragonwellVersions[majorVersion];
|
||||
for (let jdkVersion in majorVersionMap) {
|
||||
const jdkVersionMap = majorVersionMap[jdkVersion];
|
||||
if (!(platform in jdkVersionMap)) {
|
||||
continue;
|
||||
}
|
||||
const platformMap = jdkVersionMap[platform];
|
||||
if (!(arch in platformMap)) {
|
||||
continue;
|
||||
}
|
||||
const archMap = platformMap[arch];
|
||||
if (jdkVersion === 'latest') {
|
||||
jdkVersion = majorVersion;
|
||||
}
|
||||
if (jdkVersion.includes('.')) {
|
||||
const splits = jdkVersion.split('.');
|
||||
jdkVersion =
|
||||
splits.length >= 3 ? splits.slice(0, 3).join('.') : jdkVersion;
|
||||
}
|
||||
for (const edition in archMap) {
|
||||
eligibleVersions.push({
|
||||
os: platform,
|
||||
architecture: arch,
|
||||
jdk_version: jdkVersion,
|
||||
checksum: archMap[edition].sha256,
|
||||
download_link: archMap[edition].download_url,
|
||||
edition: edition,
|
||||
image_type: 'jdk'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return eligibleVersions;
|
||||
}
|
||||
getPlatformOption() {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.DragonwellDistribution = DragonwellDistribution;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 883:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue