mirror of
https://github.com/actions/setup-java.git
synced 2026-11-06 01:40:36 +08:00
* chore(deps): bump the monthly-npm-updates group with 12 updates Bumps the monthly-npm-updates group with 12 updates: | Package | From | To | | --- | --- | --- | | [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) | `6.2.0` | `6.3.0` | | [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) | `5.11.1` | `5.11.2` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.2` | `26.6.5` | | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `8.70.1` | `8.72.0` | | [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `8.70.1` | `8.72.0` | | [eslint](https://github.com/eslint/eslint) | `10.11.0` | `10.13.0` | | [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | `29.16.6` | `29.17.0` | | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) | `18.3.0` | `18.5.0` | | [globals](https://github.com/sindresorhus/globals) | `17.12.0` | `17.13.0` | | [lint-staged](https://github.com/lint-staged/lint-staged) | `17.5.1` | `17.6.0` | | [prettier](https://github.com/prettier/prettier) | `3.9.9` | `3.9.10` | | [ts-jest](https://github.com/kulshekhar/ts-jest) | `29.4.13` | `29.4.15` | Updates `@actions/cache` from 6.2.0 to 6.3.0 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/cache) Updates `fast-xml-parser` from 5.11.1 to 5.11.2 - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.11.1...v5.11.2) Updates `@types/node` from 26.6.2 to 26.6.5 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@typescript-eslint/eslint-plugin` from 8.70.1 to 8.72.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 8.70.1 to 8.72.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.0/packages/parser) Updates `eslint` from 10.11.0 to 10.13.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](https://github.com/eslint/eslint/compare/v10.11.0...v10.13.0) Updates `eslint-plugin-jest` from 29.16.6 to 29.17.0 - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v29.16.6...v29.17.0) Updates `eslint-plugin-n` from 18.3.0 to 18.5.0 - [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases) - [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v18.3.0...v18.5.0) Updates `globals` from 17.12.0 to 17.13.0 - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](https://github.com/sindresorhus/globals/compare/v17.12.0...v17.13.0) Updates `lint-staged` from 17.5.1 to 17.6.0 - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md) - [Commits](https://github.com/lint-staged/lint-staged/compare/v17.5.1...v17.6.0) Updates `prettier` from 3.9.9 to 3.9.10 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.9.9...3.9.10) Updates `ts-jest` from 29.4.13 to 29.4.15 - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.4.13...v29.4.15) --- updated-dependencies: - dependency-name: "@actions/cache" dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: fast-xml-parser dependency-version: 5.11.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: "@types/node" dependency-version: 26.6.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: "@typescript-eslint/eslint-plugin" dependency-version: 8.72.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: "@typescript-eslint/parser" dependency-version: 8.72.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint dependency-version: 10.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint-plugin-jest dependency-version: 29.17.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint-plugin-n dependency-version: 18.5.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: globals dependency-version: 17.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: lint-staged dependency-version: 17.6.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: prettier dependency-version: 3.9.10 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: ts-jest dependency-version: 29.4.15 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates ... Signed-off-by: dependabot[bot] <support@github.com> * chore: rebuild dist bundles Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * chore: refresh npm license cache Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bruno Borges <brborges@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
234 lines
8.3 KiB
JavaScript
234 lines
8.3 KiB
JavaScript
export const id = 314;
|
|
export const ids = [314];
|
|
export const modules = {
|
|
|
|
/***/ 2314:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
saveJdkCaches: () => (/* binding */ saveJdkCaches)
|
|
});
|
|
|
|
// UNUSED EXPORTS: buildJdkCacheKey, getJdkVerificationIdentity, registerJdk, restoreJdk
|
|
|
|
// EXTERNAL MODULE: external "crypto"
|
|
var external_crypto_ = __webpack_require__(6982);
|
|
// EXTERNAL MODULE: external "fs"
|
|
var external_fs_ = __webpack_require__(9896);
|
|
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
|
// EXTERNAL MODULE: external "path"
|
|
var external_path_ = __webpack_require__(6928);
|
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
|
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js + 322 modules
|
|
var lib_cache = __webpack_require__(6080);
|
|
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
|
var lib_core = __webpack_require__(3838);
|
|
// EXTERNAL MODULE: ./src/util.ts
|
|
var util = __webpack_require__(4527);
|
|
;// CONCATENATED MODULE: ./src/cache-feature.ts
|
|
|
|
|
|
|
|
function cache_feature_isCacheFeatureAvailable() {
|
|
if (cache.isFeatureAvailable()) {
|
|
return true;
|
|
}
|
|
if (isGhes()) {
|
|
core.warning('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.');
|
|
return false;
|
|
}
|
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
return false;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ./src/jdk-cache.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const STATE_JDK_CACHES = 'jdk-caches';
|
|
const JDK_CACHE_KEY_VERSION = 1;
|
|
const restoredCaches = (/* unused pure expression or super */ null && ([]));
|
|
async function restoreJdk(jdk) {
|
|
if (!jdk.path || !isCacheFeatureAvailable()) {
|
|
return false;
|
|
}
|
|
const key = buildJdkCacheKey(jdk);
|
|
let matchedKey;
|
|
try {
|
|
matchedKey = await cache.restoreCache([jdk.path], key);
|
|
}
|
|
catch (error) {
|
|
core.warning(`Failed to restore JDK cache: ${error.message}`);
|
|
}
|
|
const architecturePath = path.join(jdk.path, jdk.architecture);
|
|
if (matchedKey &&
|
|
(!fs.existsSync(architecturePath) ||
|
|
!fs.existsSync(`${architecturePath}.complete`))) {
|
|
core.warning(`JDK cache key ${matchedKey} was restored without the expected tool-cache path; downloading the JDK instead.`);
|
|
matchedKey = undefined;
|
|
}
|
|
recordJdkCache({
|
|
key,
|
|
path: jdk.path,
|
|
architecture: jdk.architecture,
|
|
matchedKey
|
|
});
|
|
if (matchedKey) {
|
|
core.info(`JDK cache restored from key: ${matchedKey}`);
|
|
return true;
|
|
}
|
|
core.info(`JDK cache is not found for ${jdk.distribution} ${jdk.version}`);
|
|
return false;
|
|
}
|
|
function registerJdk(jdk) {
|
|
if (!jdk.path) {
|
|
return;
|
|
}
|
|
recordJdkCache({
|
|
key: buildJdkCacheKey(jdk),
|
|
path: jdk.path,
|
|
architecture: jdk.architecture,
|
|
installation: getInstallationIdentity(jdk.path, jdk.architecture)
|
|
});
|
|
}
|
|
/**
|
|
* Cheap fingerprint of the installation stored at a tool-cache path. The
|
|
* `<architecture>.complete` marker is (re)created by `tc.cacheDir` every time an
|
|
* installation is written, so its inode and timestamps change whenever the
|
|
* installation is replaced. This avoids rehashing a multi-hundred-megabyte JDK
|
|
* directory while still detecting that the bytes behind a key were swapped.
|
|
*/
|
|
function getInstallationIdentity(jdkPath, architecture) {
|
|
const architecturePath = external_path_default().join(jdkPath, architecture);
|
|
try {
|
|
const marker = external_fs_default().statSync(`${architecturePath}.complete`);
|
|
const installation = external_fs_default().statSync(architecturePath);
|
|
return [
|
|
marker.ino,
|
|
marker.mtimeMs,
|
|
marker.ctimeMs,
|
|
marker.size,
|
|
installation.ino,
|
|
installation.mtimeMs,
|
|
installation.ctimeMs
|
|
].join(':');
|
|
}
|
|
catch {
|
|
return undefined;
|
|
}
|
|
}
|
|
function getJdkVerificationIdentity(verifySignature, enforceSignatureVerification, publicKey) {
|
|
if (!verifySignature) {
|
|
return 'disabled';
|
|
}
|
|
const verificationPolicy = enforceSignatureVerification
|
|
? 'enforced'
|
|
: 'check-and-warn';
|
|
if (!publicKey) {
|
|
return `${verificationPolicy}:bundled`;
|
|
}
|
|
const publicKeys = Array.isArray(publicKey) ? publicKey : [publicKey];
|
|
const normalizedKeys = publicKeys.map(key => key.replace(/\r\n?/g, '\n').trim());
|
|
const fingerprintSource = Array.isArray(publicKey)
|
|
? normalizedKeys.map(key => `${Buffer.byteLength(key)}:${key}`).join('')
|
|
: normalizedKeys[0];
|
|
const fingerprint = createHash('sha256')
|
|
.update(fingerprintSource)
|
|
.digest('hex');
|
|
return `${verificationPolicy}:custom:sha256:${fingerprint}`;
|
|
}
|
|
async function saveJdkCaches() {
|
|
const state = lib_core/* getState */.Gu(STATE_JDK_CACHES);
|
|
if (!state) {
|
|
return;
|
|
}
|
|
const caches = parseJdkCacheState(state);
|
|
for (const jdk of caches) {
|
|
if (jdk.matchedKey === jdk.key) {
|
|
lib_core/* info */.pq(`Cache hit occurred on the JDK primary key ${jdk.key}, not saving cache.`);
|
|
continue;
|
|
}
|
|
if (!external_fs_default().existsSync(jdk.path)) {
|
|
lib_core/* debug */.Yz(`JDK cache path does not exist, not saving: ${jdk.path}`);
|
|
continue;
|
|
}
|
|
if (!jdk.installation) {
|
|
lib_core/* debug */.Yz(`No JDK installation was registered for the key ${jdk.key}, not saving cache.`);
|
|
continue;
|
|
}
|
|
if (getInstallationIdentity(jdk.path, jdk.architecture) !== jdk.installation) {
|
|
lib_core/* warning */.$e(`The JDK installation in ${jdk.path} was replaced after it was registered for the key ${jdk.key}; not saving cache.`);
|
|
continue;
|
|
}
|
|
try {
|
|
const cacheId = await lib_cache/* saveCache */.Io([jdk.path], jdk.key);
|
|
if (cacheId !== -1) {
|
|
lib_core/* info */.pq(`JDK cache saved with the key: ${jdk.key}`);
|
|
}
|
|
}
|
|
catch (error) {
|
|
const err = error;
|
|
if (err.name === lib_cache/* ReserveCacheError */.Zh.name) {
|
|
lib_core/* info */.pq(err.message);
|
|
}
|
|
else {
|
|
// Saving is best-effort and per entry: one failure must not suppress
|
|
// the remaining JDK caches.
|
|
lib_core/* warning */.$e(`Failed to save the JDK cache with the key ${jdk.key}: ${err.message}`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function buildJdkCacheKey(jdk) {
|
|
const runnerOs = process.env['RUNNER_OS'] ?? process.platform;
|
|
const normalizedArchitecture = jdk.architecture.toLowerCase();
|
|
const identity = JSON.stringify({
|
|
keyVersion: JDK_CACHE_KEY_VERSION,
|
|
runnerOs,
|
|
distribution: jdk.distribution.toLowerCase(),
|
|
packageType: jdk.packageType.toLowerCase(),
|
|
architecture: normalizedArchitecture,
|
|
version: jdk.version,
|
|
source: jdk.source,
|
|
verification: jdk.verification
|
|
});
|
|
const digest = createHash('sha256').update(identity).digest('hex');
|
|
return `setup-java-jdk-v${JDK_CACHE_KEY_VERSION}-${runnerOs}-${normalizedArchitecture}-${digest}`;
|
|
}
|
|
function recordJdkCache(jdk) {
|
|
const existing = restoredCaches.findIndex(item => item.key === jdk.key && item.path === jdk.path);
|
|
if (existing === -1) {
|
|
restoredCaches.push(jdk);
|
|
}
|
|
else {
|
|
restoredCaches[existing] = { ...restoredCaches[existing], ...jdk };
|
|
}
|
|
core.saveState(STATE_JDK_CACHES, JSON.stringify(restoredCaches));
|
|
}
|
|
function parseJdkCacheState(state) {
|
|
const value = JSON.parse(state);
|
|
if (!Array.isArray(value) ||
|
|
!value.every(item => typeof item === 'object' &&
|
|
item !== null &&
|
|
typeof item.key === 'string' &&
|
|
typeof item.path === 'string' &&
|
|
typeof item.architecture === 'string' &&
|
|
(item.matchedKey === undefined ||
|
|
typeof item.matchedKey === 'string') &&
|
|
(item.installation === undefined ||
|
|
typeof item.installation === 'string'))) {
|
|
throw new Error('Invalid JDK cache information retrieved from state.');
|
|
}
|
|
return value;
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
};
|