mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-01-19 03:43:02 +08:00
parent
61450f0977
commit
66dc2bf069
51
dist/index.js
generated
vendored
51
dist/index.js
generated
vendored
@ -2,20 +2,17 @@ require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
|
|||||||
/******/ var __webpack_modules__ = ({
|
/******/ var __webpack_modules__ = ({
|
||||||
|
|
||||||
/***/ 5105:
|
/***/ 5105:
|
||||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_BASE = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = void 0;
|
exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = void 0;
|
||||||
const os_1 = __nccwpck_require__(2037);
|
|
||||||
const path_1 = __nccwpck_require__(1017);
|
|
||||||
exports.IS_LINUX = process.platform === 'linux';
|
exports.IS_LINUX = process.platform === 'linux';
|
||||||
exports.IS_MACOS = process.platform === 'darwin';
|
exports.IS_MACOS = process.platform === 'darwin';
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
exports.VERSION_DEV = 'dev';
|
exports.VERSION_DEV = 'dev';
|
||||||
exports.VERSION_LATEST = 'latest';
|
exports.VERSION_LATEST = 'latest';
|
||||||
exports.GRAALVM_BASE = (0, path_1.join)((0, os_1.homedir)(), '.graalvm');
|
|
||||||
exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz';
|
exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||||
exports.GRAALVM_GH_USER = 'graalvm';
|
exports.GRAALVM_GH_USER = 'graalvm';
|
||||||
exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform;
|
exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform;
|
||||||
@ -244,13 +241,17 @@ function setUpGraalVMRelease(version, javaVersion) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const graalVMIdentifier = determineGraalVMIdentifier(version, javaVersion);
|
const graalVMIdentifier = determineGraalVMIdentifier(version, javaVersion);
|
||||||
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`;
|
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`;
|
||||||
return (0, utils_1.downloadAndExtractJDK)(downloadUrl);
|
const toolName = determineToolName(javaVersion);
|
||||||
|
return (0, utils_1.downloadExtractAndCacheJDK)(downloadUrl, toolName, version);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.setUpGraalVMRelease = setUpGraalVMRelease;
|
exports.setUpGraalVMRelease = setUpGraalVMRelease;
|
||||||
function determineGraalVMIdentifier(version, javaVersion) {
|
function determineGraalVMIdentifier(version, javaVersion) {
|
||||||
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`;
|
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`;
|
||||||
}
|
}
|
||||||
|
function determineToolName(javaVersion) {
|
||||||
|
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -348,7 +349,6 @@ const c = __importStar(__nccwpck_require__(5105));
|
|||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const graalvm = __importStar(__nccwpck_require__(1763));
|
const graalvm = __importStar(__nccwpck_require__(1763));
|
||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
const io_1 = __nccwpck_require__(7436);
|
|
||||||
const dependencies_1 = __nccwpck_require__(6031);
|
const dependencies_1 = __nccwpck_require__(6031);
|
||||||
const gu_1 = __nccwpck_require__(3466);
|
const gu_1 = __nccwpck_require__(3466);
|
||||||
const mandrel_1 = __nccwpck_require__(438);
|
const mandrel_1 = __nccwpck_require__(438);
|
||||||
@ -370,7 +370,6 @@ function run() {
|
|||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
yield (0, features_1.setUpNativeImageMusl)();
|
yield (0, features_1.setUpNativeImageMusl)();
|
||||||
}
|
}
|
||||||
yield (0, io_1.mkdirP)(c.GRAALVM_BASE);
|
|
||||||
// Download or build GraalVM
|
// Download or build GraalVM
|
||||||
let graalVMHome;
|
let graalVMHome;
|
||||||
switch (graalvmVersion) {
|
switch (graalvmVersion) {
|
||||||
@ -488,12 +487,16 @@ function setUpMandrelRelease(version, javaVersion) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const identifier = determineMandrelIdentifier(version, javaVersion);
|
const identifier = determineMandrelIdentifier(version, javaVersion);
|
||||||
const downloadUrl = `${MANDREL_DL_BASE}/${MANDREL_TAG_PREFIX}${version}/${identifier}${c.GRAALVM_FILE_EXTENSION}`;
|
const downloadUrl = `${MANDREL_DL_BASE}/${MANDREL_TAG_PREFIX}${version}/${identifier}${c.GRAALVM_FILE_EXTENSION}`;
|
||||||
return (0, utils_1.downloadAndExtractJDK)(downloadUrl);
|
const toolName = determineToolName(javaVersion);
|
||||||
|
return (0, utils_1.downloadExtractAndCacheJDK)(downloadUrl, toolName, version);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function determineMandrelIdentifier(version, javaVersion) {
|
function determineMandrelIdentifier(version, javaVersion) {
|
||||||
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`;
|
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`;
|
||||||
}
|
}
|
||||||
|
function determineToolName(javaVersion) {
|
||||||
|
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -615,7 +618,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.findJavaHomeInSubfolder = exports.downloadAndExtractJDK = exports.getLatestRelease = void 0;
|
exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = void 0;
|
||||||
const c = __importStar(__nccwpck_require__(5105));
|
const c = __importStar(__nccwpck_require__(5105));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const httpClient = __importStar(__nccwpck_require__(9925));
|
const httpClient = __importStar(__nccwpck_require__(9925));
|
||||||
@ -644,21 +647,40 @@ function getLatestRelease(repo) {
|
|||||||
}
|
}
|
||||||
exports.getLatestRelease = getLatestRelease;
|
exports.getLatestRelease = getLatestRelease;
|
||||||
function downloadAndExtractJDK(downloadUrl) {
|
function downloadAndExtractJDK(downloadUrl) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return findJavaHomeInSubfolder(yield downloadAndExtract(downloadUrl));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadAndExtractJDK = downloadAndExtractJDK;
|
||||||
|
function downloadExtractAndCacheJDK(downloadUrl, toolName, version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let toolPath = tc.find(toolName, version);
|
||||||
|
if (toolPath) {
|
||||||
|
core.info(`Found ${toolName} ${version} in tool-cache @ ${toolPath}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const extractDir = yield downloadAndExtract(downloadUrl);
|
||||||
|
core.info(`Adding ${toolName} ${version} to tool-cache ...`);
|
||||||
|
toolPath = yield tc.cacheDir(extractDir, toolName, version);
|
||||||
|
}
|
||||||
|
return findJavaHomeInSubfolder(toolPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadExtractAndCacheJDK = downloadExtractAndCacheJDK;
|
||||||
|
function downloadAndExtract(downloadUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const downloadPath = yield tc.downloadTool(downloadUrl);
|
const downloadPath = yield tc.downloadTool(downloadUrl);
|
||||||
if (downloadUrl.endsWith('.tar.gz')) {
|
if (downloadUrl.endsWith('.tar.gz')) {
|
||||||
yield tc.extractTar(downloadPath, c.GRAALVM_BASE);
|
return yield tc.extractTar(downloadPath);
|
||||||
}
|
}
|
||||||
else if (downloadUrl.endsWith('.zip')) {
|
else if (downloadUrl.endsWith('.zip')) {
|
||||||
yield tc.extractZip(downloadPath, c.GRAALVM_BASE);
|
return yield tc.extractZip(downloadPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error(`Unexpected filetype downloaded: ${downloadUrl}`);
|
throw new Error(`Unexpected filetype downloaded: ${downloadUrl}`);
|
||||||
}
|
}
|
||||||
return findJavaHomeInSubfolder(c.GRAALVM_BASE);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadAndExtractJDK = downloadAndExtractJDK;
|
|
||||||
function findJavaHomeInSubfolder(searchPath) {
|
function findJavaHomeInSubfolder(searchPath) {
|
||||||
const baseContents = (0, fs_1.readdirSync)(searchPath);
|
const baseContents = (0, fs_1.readdirSync)(searchPath);
|
||||||
if (baseContents.length === 1) {
|
if (baseContents.length === 1) {
|
||||||
@ -668,7 +690,6 @@ function findJavaHomeInSubfolder(searchPath) {
|
|||||||
throw new Error(`Unexpected amount of directory items found: ${baseContents.length}`);
|
throw new Error(`Unexpected amount of directory items found: ${baseContents.length}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.findJavaHomeInSubfolder = findJavaHomeInSubfolder;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,4 @@
|
|||||||
import * as otypes from '@octokit/types'
|
import * as otypes from '@octokit/types'
|
||||||
import {homedir} from 'os'
|
|
||||||
import {join} from 'path'
|
|
||||||
|
|
||||||
export const IS_LINUX = process.platform === 'linux'
|
export const IS_LINUX = process.platform === 'linux'
|
||||||
export const IS_MACOS = process.platform === 'darwin'
|
export const IS_MACOS = process.platform === 'darwin'
|
||||||
@ -9,7 +7,6 @@ export const IS_WINDOWS = process.platform === 'win32'
|
|||||||
export const VERSION_DEV = 'dev'
|
export const VERSION_DEV = 'dev'
|
||||||
export const VERSION_LATEST = 'latest'
|
export const VERSION_LATEST = 'latest'
|
||||||
|
|
||||||
export const GRAALVM_BASE = join(homedir(), '.graalvm')
|
|
||||||
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
|
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
|
||||||
export const GRAALVM_GH_USER = 'graalvm'
|
export const GRAALVM_GH_USER = 'graalvm'
|
||||||
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
|
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import * as c from './constants'
|
import * as c from './constants'
|
||||||
import {downloadAndExtractJDK, getLatestRelease} from './utils'
|
import {
|
||||||
|
downloadAndExtractJDK,
|
||||||
|
downloadExtractAndCacheJDK,
|
||||||
|
getLatestRelease
|
||||||
|
} from './utils'
|
||||||
|
|
||||||
const GRAALVM_CE_DL_BASE =
|
const GRAALVM_CE_DL_BASE =
|
||||||
'https://github.com/graalvm/graalvm-ce-builds/releases/download'
|
'https://github.com/graalvm/graalvm-ce-builds/releases/download'
|
||||||
@ -40,7 +44,8 @@ export async function setUpGraalVMRelease(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const graalVMIdentifier = determineGraalVMIdentifier(version, javaVersion)
|
const graalVMIdentifier = determineGraalVMIdentifier(version, javaVersion)
|
||||||
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
|
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
|
||||||
return downloadAndExtractJDK(downloadUrl)
|
const toolName = determineToolName(javaVersion)
|
||||||
|
return downloadExtractAndCacheJDK(downloadUrl, toolName, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineGraalVMIdentifier(
|
function determineGraalVMIdentifier(
|
||||||
@ -49,3 +54,7 @@ function determineGraalVMIdentifier(
|
|||||||
): string {
|
): string {
|
||||||
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
|
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function determineToolName(javaVersion: string): string {
|
||||||
|
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}`
|
||||||
|
}
|
||||||
|
@ -2,7 +2,6 @@ import * as c from './constants'
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as graalvm from './graalvm'
|
import * as graalvm from './graalvm'
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {mkdirP} from '@actions/io'
|
|
||||||
import {setUpDependencies} from './dependencies'
|
import {setUpDependencies} from './dependencies'
|
||||||
import {setUpGUComponents} from './gu'
|
import {setUpGUComponents} from './gu'
|
||||||
import {setUpMandrel} from './mandrel'
|
import {setUpMandrel} from './mandrel'
|
||||||
@ -27,8 +26,6 @@ async function run(): Promise<void> {
|
|||||||
await setUpNativeImageMusl()
|
await setUpNativeImageMusl()
|
||||||
}
|
}
|
||||||
|
|
||||||
await mkdirP(c.GRAALVM_BASE)
|
|
||||||
|
|
||||||
// Download or build GraalVM
|
// Download or build GraalVM
|
||||||
let graalVMHome
|
let graalVMHome
|
||||||
switch (graalvmVersion) {
|
switch (graalvmVersion) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as c from './constants'
|
import * as c from './constants'
|
||||||
import {downloadAndExtractJDK, getLatestRelease} from './utils'
|
import {downloadExtractAndCacheJDK, getLatestRelease} from './utils'
|
||||||
|
|
||||||
const MANDREL_REPO = 'mandrel'
|
const MANDREL_REPO = 'mandrel'
|
||||||
const MANDREL_TAG_PREFIX = c.MANDREL_NAMESPACE
|
const MANDREL_TAG_PREFIX = c.MANDREL_NAMESPACE
|
||||||
@ -46,7 +46,8 @@ async function setUpMandrelRelease(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const identifier = determineMandrelIdentifier(version, javaVersion)
|
const identifier = determineMandrelIdentifier(version, javaVersion)
|
||||||
const downloadUrl = `${MANDREL_DL_BASE}/${MANDREL_TAG_PREFIX}${version}/${identifier}${c.GRAALVM_FILE_EXTENSION}`
|
const downloadUrl = `${MANDREL_DL_BASE}/${MANDREL_TAG_PREFIX}${version}/${identifier}${c.GRAALVM_FILE_EXTENSION}`
|
||||||
return downloadAndExtractJDK(downloadUrl)
|
const toolName = determineToolName(javaVersion)
|
||||||
|
return downloadExtractAndCacheJDK(downloadUrl, toolName, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineMandrelIdentifier(
|
function determineMandrelIdentifier(
|
||||||
@ -55,3 +56,7 @@ function determineMandrelIdentifier(
|
|||||||
): string {
|
): string {
|
||||||
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
|
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function determineToolName(javaVersion: string): string {
|
||||||
|
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}`
|
||||||
|
}
|
||||||
|
27
src/utils.ts
27
src/utils.ts
@ -32,18 +32,37 @@ export async function getLatestRelease(
|
|||||||
export async function downloadAndExtractJDK(
|
export async function downloadAndExtractJDK(
|
||||||
downloadUrl: string
|
downloadUrl: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
return findJavaHomeInSubfolder(await downloadAndExtract(downloadUrl))
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function downloadExtractAndCacheJDK(
|
||||||
|
downloadUrl: string,
|
||||||
|
toolName: string,
|
||||||
|
version: string
|
||||||
|
): Promise<string> {
|
||||||
|
let toolPath = tc.find(toolName, version)
|
||||||
|
if (toolPath) {
|
||||||
|
core.info(`Found ${toolName} ${version} in tool-cache @ ${toolPath}`)
|
||||||
|
} else {
|
||||||
|
const extractDir = await downloadAndExtract(downloadUrl)
|
||||||
|
core.info(`Adding ${toolName} ${version} to tool-cache ...`)
|
||||||
|
toolPath = await tc.cacheDir(extractDir, toolName, version)
|
||||||
|
}
|
||||||
|
return findJavaHomeInSubfolder(toolPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadAndExtract(downloadUrl: string): Promise<string> {
|
||||||
const downloadPath = await tc.downloadTool(downloadUrl)
|
const downloadPath = await tc.downloadTool(downloadUrl)
|
||||||
if (downloadUrl.endsWith('.tar.gz')) {
|
if (downloadUrl.endsWith('.tar.gz')) {
|
||||||
await tc.extractTar(downloadPath, c.GRAALVM_BASE)
|
return await tc.extractTar(downloadPath)
|
||||||
} else if (downloadUrl.endsWith('.zip')) {
|
} else if (downloadUrl.endsWith('.zip')) {
|
||||||
await tc.extractZip(downloadPath, c.GRAALVM_BASE)
|
return await tc.extractZip(downloadPath)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unexpected filetype downloaded: ${downloadUrl}`)
|
throw new Error(`Unexpected filetype downloaded: ${downloadUrl}`)
|
||||||
}
|
}
|
||||||
return findJavaHomeInSubfolder(c.GRAALVM_BASE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findJavaHomeInSubfolder(searchPath: string): string {
|
function findJavaHomeInSubfolder(searchPath: string): string {
|
||||||
const baseContents = readdirSync(searchPath)
|
const baseContents = readdirSync(searchPath)
|
||||||
if (baseContents.length === 1) {
|
if (baseContents.length === 1) {
|
||||||
return join(searchPath, baseContents[0], c.JDK_HOME_SUFFIX)
|
return join(searchPath, baseContents[0], c.JDK_HOME_SUFFIX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user