mirror of
https://github.com/actions/setup-java.git
synced 2026-06-23 08:19:41 +00:00
build: update bundled dist for graalvm community support
This commit is contained in:
committed by
GitHub
parent
2321ab295d
commit
ad52b8c6db
Vendored
+118
-13
@@ -78771,6 +78771,7 @@ var JavaDistribution;
|
|||||||
JavaDistribution["Dragonwell"] = "dragonwell";
|
JavaDistribution["Dragonwell"] = "dragonwell";
|
||||||
JavaDistribution["SapMachine"] = "sapmachine";
|
JavaDistribution["SapMachine"] = "sapmachine";
|
||||||
JavaDistribution["GraalVM"] = "graalvm";
|
JavaDistribution["GraalVM"] = "graalvm";
|
||||||
|
JavaDistribution["GraalVMCommunity"] = "graalvm-community";
|
||||||
JavaDistribution["JetBrains"] = "jetbrains";
|
JavaDistribution["JetBrains"] = "jetbrains";
|
||||||
})(JavaDistribution || (JavaDistribution = {}));
|
})(JavaDistribution || (JavaDistribution = {}));
|
||||||
function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
||||||
@@ -78802,6 +78803,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
|
|||||||
return new installer_11.SapMachineDistribution(installerOptions);
|
return new installer_11.SapMachineDistribution(installerOptions);
|
||||||
case JavaDistribution.GraalVM:
|
case JavaDistribution.GraalVM:
|
||||||
return new installer_12.GraalVMDistribution(installerOptions);
|
return new installer_12.GraalVMDistribution(installerOptions);
|
||||||
|
case JavaDistribution.GraalVMCommunity:
|
||||||
|
return new installer_12.GraalVMCommunityDistribution(installerOptions);
|
||||||
case JavaDistribution.JetBrains:
|
case JavaDistribution.JetBrains:
|
||||||
return new installer_13.JetBrainsDistribution(installerOptions);
|
return new installer_13.JetBrainsDistribution(installerOptions);
|
||||||
default:
|
default:
|
||||||
@@ -79069,23 +79072,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GraalVMDistribution = void 0;
|
exports.GraalVMCommunityDistribution = exports.GraalVMDistribution = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(37484));
|
const core = __importStar(__nccwpck_require__(37484));
|
||||||
const tc = __importStar(__nccwpck_require__(33472));
|
const tc = __importStar(__nccwpck_require__(33472));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(16928));
|
const path_1 = __importDefault(__nccwpck_require__(16928));
|
||||||
|
const semver_1 = __importDefault(__nccwpck_require__(62088));
|
||||||
const base_installer_1 = __nccwpck_require__(79935);
|
const base_installer_1 = __nccwpck_require__(79935);
|
||||||
const http_client_1 = __nccwpck_require__(54844);
|
const http_client_1 = __nccwpck_require__(54844);
|
||||||
const util_1 = __nccwpck_require__(54527);
|
const util_1 = __nccwpck_require__(54527);
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
||||||
|
const GRAALVM_COMMUNITY_RELEASES_URL = 'https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=100';
|
||||||
|
const GRAALVM_COMMUNITY_RELEASES_PAGE_ORIGIN = 'https://api.github.com';
|
||||||
|
const GRAALVM_COMMUNITY_DOWNLOAD_URL = 'https://github.com/graalvm/graalvm-ce-builds/releases';
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'];
|
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'];
|
||||||
class GraalVMDistribution extends base_installer_1.JavaBase {
|
class GraalVMDistribution extends base_installer_1.JavaBase {
|
||||||
constructor(installerOptions) {
|
constructor(installerOptions, distributionName = 'GraalVM') {
|
||||||
super('GraalVM', installerOptions);
|
super(distributionName, installerOptions);
|
||||||
}
|
}
|
||||||
downloadTool(javaRelease) {
|
downloadTool(javaRelease) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@@ -79119,19 +79126,34 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
}
|
}
|
||||||
findPackageForDownload(range) {
|
findPackageForDownload(range) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Add input validation
|
this.validateVersionRange(range);
|
||||||
|
const arch = this.getSupportedArchitecture();
|
||||||
|
if (!this.stable) {
|
||||||
|
return this.findEABuildDownloadUrl(`${range}-ea`);
|
||||||
|
}
|
||||||
|
const { platform, extension, major } = this.validateStableBuildRequest(range);
|
||||||
|
const fileUrl = this.constructFileUrl(range, major, platform, arch, extension);
|
||||||
|
const response = yield this.http.head(fileUrl);
|
||||||
|
this.handleHttpResponse(response, range);
|
||||||
|
return { url: fileUrl, version: range };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
validateVersionRange(range) {
|
||||||
if (!range || typeof range !== 'string') {
|
if (!range || typeof range !== 'string') {
|
||||||
throw new Error('Version range is required and must be a string');
|
throw new Error('Version range is required and must be a string');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
getSupportedArchitecture() {
|
||||||
const arch = this.distributionArchitecture();
|
const arch = this.distributionArchitecture();
|
||||||
if (!SUPPORTED_ARCHITECTURES.includes(arch)) {
|
if (!SUPPORTED_ARCHITECTURES.includes(arch)) {
|
||||||
throw new Error(`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`);
|
throw new Error(`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`);
|
||||||
}
|
}
|
||||||
if (!this.stable) {
|
return arch;
|
||||||
return this.findEABuildDownloadUrl(`${range}-ea`);
|
|
||||||
}
|
}
|
||||||
|
validateStableBuildRequest(range) {
|
||||||
|
const arch = this.getSupportedArchitecture();
|
||||||
if (this.packageType !== 'jdk') {
|
if (this.packageType !== 'jdk') {
|
||||||
throw new Error('GraalVM provides only the `jdk` package type');
|
throw new Error(`${this.distribution} provides only the \`jdk\` package type`);
|
||||||
}
|
}
|
||||||
const platform = this.getPlatform();
|
const platform = this.getPlatform();
|
||||||
const extension = (0, util_1.getDownloadArchiveExtension)();
|
const extension = (0, util_1.getDownloadArchiveExtension)();
|
||||||
@@ -79141,13 +79163,14 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
throw new Error(`Invalid version format: ${range}`);
|
throw new Error(`Invalid version format: ${range}`);
|
||||||
}
|
}
|
||||||
if (majorVersion < GRAALVM_MIN_VERSION) {
|
if (majorVersion < GRAALVM_MIN_VERSION) {
|
||||||
throw new Error(`GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`);
|
throw new Error(`${this.distribution} is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`);
|
||||||
}
|
}
|
||||||
const fileUrl = this.constructFileUrl(range, major, platform, arch, extension);
|
return {
|
||||||
const response = yield this.http.head(fileUrl);
|
arch,
|
||||||
this.handleHttpResponse(response, range);
|
platform,
|
||||||
return { url: fileUrl, version: range };
|
extension,
|
||||||
});
|
major
|
||||||
|
};
|
||||||
}
|
}
|
||||||
constructFileUrl(range, major, platform, arch, extension) {
|
constructFileUrl(range, major, platform, arch, extension) {
|
||||||
return range.includes('.')
|
return range.includes('.')
|
||||||
@@ -79239,6 +79262,88 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GraalVMDistribution = GraalVMDistribution;
|
exports.GraalVMDistribution = GraalVMDistribution;
|
||||||
|
class GraalVMCommunityDistribution extends GraalVMDistribution {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super(installerOptions, 'GraalVM Community');
|
||||||
|
}
|
||||||
|
get toolcacheFolderName() {
|
||||||
|
return `Java_GraalVM_Community_${this.packageType}`;
|
||||||
|
}
|
||||||
|
findPackageForDownload(range) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
this.validateVersionRange(range);
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('GraalVM Community does not provide early access builds');
|
||||||
|
}
|
||||||
|
const { arch, platform, extension } = this.validateStableBuildRequest(range);
|
||||||
|
const availableVersions = yield this.getAvailableVersionsForPlatform(platform, arch, extension);
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => (0, util_1.isVersionSatisfies)(range, item.version))
|
||||||
|
.sort((a, b) => -semver_1.default.compareBuild(a.version, b.version))[0];
|
||||||
|
if (!satisfiedVersion) {
|
||||||
|
const error = this.createVersionNotFoundError(range, availableVersions.map(item => item.version), `Platform: ${platform}`);
|
||||||
|
error.message += `\nPlease check if this version is available at ${GRAALVM_COMMUNITY_DOWNLOAD_URL}.`;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
return satisfiedVersion;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getAvailableVersionsForPlatform(platform, arch, extension) {
|
||||||
|
var _a, _b;
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const headers = (0, util_1.getGitHubHttpHeaders)();
|
||||||
|
const availableVersions = new Map();
|
||||||
|
let releasesUrl = GRAALVM_COMMUNITY_RELEASES_URL;
|
||||||
|
let pageCount = 0;
|
||||||
|
while (releasesUrl) {
|
||||||
|
pageCount++;
|
||||||
|
const response = yield this.http.getJson(releasesUrl, headers);
|
||||||
|
for (const release of (_a = response.result) !== null && _a !== void 0 ? _a : []) {
|
||||||
|
if (release.draft || release.prerelease) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const asset of (_b = release.assets) !== null && _b !== void 0 ? _b : []) {
|
||||||
|
const releaseForPlatform = this.toCommunityReleaseForPlatform(asset, platform, arch, extension);
|
||||||
|
if (releaseForPlatform) {
|
||||||
|
availableVersions.set(releaseForPlatform.version, releaseForPlatform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const nextUrl = (0, util_1.getNextPageUrlFromLinkHeader)(response.headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0, util_1.validatePaginationUrl)(nextUrl, GRAALVM_COMMUNITY_RELEASES_PAGE_ORIGIN)) {
|
||||||
|
core.warning(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
releasesUrl = nextUrl;
|
||||||
|
if (!response.result || response.result.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (pageCount >= util_1.MAX_PAGINATION_PAGES) {
|
||||||
|
core.warning(`Reached pagination safeguard limit (${util_1.MAX_PAGINATION_PAGES} pages) while listing GraalVM Community releases.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...availableVersions.values()];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
toCommunityReleaseForPlatform(asset, platform, arch, extension) {
|
||||||
|
const match = asset.name.match(/^graalvm-community-jdk-(?<version>\d+(?:\.\d+)+)_(?<platform>linux|macos|windows)-(?<arch>x64|aarch64)_bin\.(?<extension>tar\.gz|zip)$/);
|
||||||
|
if (!(match === null || match === void 0 ? void 0 : match.groups)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (match.groups.platform !== platform ||
|
||||||
|
match.groups.arch !== arch ||
|
||||||
|
match.groups.extension !== extension) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
version: (0, util_1.convertVersionToSemver)(match.groups.version),
|
||||||
|
url: asset.browser_download_url
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.GraalVMCommunityDistribution = GraalVMCommunityDistribution;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
Reference in New Issue
Block a user