mirror of
https://github.com/actions/setup-java.git
synced 2026-07-30 09:10:01 +08:00
3cc3643700
* Optimize Temurin tool-cache fast path - Lazy-load distribution installers so only the selected distro module is initialized - Defer cache feature/cache module loading until cache input is provided - Start cache restore early and await it safely alongside Java setup flow - Update orchestration and lazy-loading tests; regenerate dist artifacts Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad * Address PR review comments - Lazy-load cache save in cleanup path so no-cache runs avoid cache module init in post action - Stage dist/setup/package.json in release script for chunked setup bundle completeness Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad * Fix CodeQL comment tag filter finding Patch is-unsafe's XML comment-close detector during builds so generated bundles recognize both HTML comment end forms and satisfy CodeQL until the dependency publishes a fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 277302b1-aa95-4012-817b-9752cdaee14e * Rebuild generated dist bundles Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad Copilot-Session: 277302b1-aa95-4012-817b-9752cdaee14e
169 lines
7.4 KiB
JavaScript
169 lines
7.4 KiB
JavaScript
export const id = 220;
|
|
export const ids = [220];
|
|
export const modules = {
|
|
|
|
/***/ 3220:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
MicrosoftDistributions: () => (/* binding */ MicrosoftDistributions)
|
|
});
|
|
|
|
// UNUSED EXPORTS: MICROSOFT_PUBLIC_KEY
|
|
|
|
// EXTERNAL MODULE: ./src/distributions/base-installer.ts + 2 modules
|
|
var base_installer = __webpack_require__(6242);
|
|
// EXTERNAL MODULE: ./src/util.ts
|
|
var util = __webpack_require__(4527);
|
|
// EXTERNAL MODULE: ./src/gpg.ts
|
|
var gpg = __webpack_require__(8343);
|
|
;// CONCATENATED MODULE: ./src/distributions/microsoft/microsoft-key.ts
|
|
// Microsoft Build of OpenJDK GPG signing key
|
|
// Retrieved from: https://download.visualstudio.microsoft.com/download/pr/b90071e2-e0cf-4411-98be-dbeb09d67bf0/8622862bcd54206e158c5abca0582c9b/464279_464280_aoc_20210208.asc
|
|
const MICROSOFT_PUBLIC_KEY = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
Version: BSN Pgp v1.1.0.0
|
|
|
|
mQENBGAhlWcBCADCQjj6huLTenvZSLej35e9YKEHm4lix2uvPOONexMaU8V2v7KL
|
|
RGdoXF7jwHci7efnPZ+9zpS2+g3rhvv8M7yWy9E/1psEtGzvmp1IL/qIabMEQqi+
|
|
UlhPGh7MQ/BkXAlic8Dyl3XYqr0EXS11iCiTr6Zkxs9Ee4V54gxL4gogRn4wk9sl
|
|
/nrjgDzMsUwla0pynoQQvYpqCdiAr3gKKllT1skCDqgVOMMyZxsx9HjZxg/3AJz6
|
|
r5i512L2R+3Hkv+XmxT+mnGBCFcny0DM7PjNXEmIK3ZSkro1tQML90zx3Fyh5esx
|
|
fpVvuIXGFV75o35VVCBZoiD3hcfOnIJsPQ9nABEBAAG0OE1pY3Jvc29mdCBKYXZh
|
|
IEVuZ2luZWVyaW5nIDxqYXZhcGxhdGluZnJhQG1pY3Jvc29mdC5jb20+iQE4BBMB
|
|
CAAiBQJgIZVnAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRA1Ux0xWyHB
|
|
icwTCACJO2FGNocNvdUtAb+eDKuGwt0chAJdCES2ZtgBScwrwDyWpxpRznoXWBHL
|
|
MJeLyxJoKsCG3vVlY4uh48psCzVm3OKvi7MCPT955t8W6TzfSBxTpjR8zRgJkjPJ
|
|
EGhHTlusUfz7TtM5etJF0qscSJH1grcNsgtee97mk4QyEzT8Di83NQmYxKcBrliq
|
|
yK/SWWt8VkTyYAEO6L5PoB4L9r8ka27uQs+jgCw+/Z0JMtNmmhyNGY3+a1YtPeoy
|
|
JdQaI9LphfKGbVaz6SK2aol7vj+c2TG3TLUYdOYGMH1OZlri2GTkCVjwna2GC7p4
|
|
Fa133tP85xzJEq1XeXm8WeLFo2wV
|
|
=rHCS
|
|
-----END PGP PUBLIC KEY BLOCK-----`;
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
|
var core = __webpack_require__(3838);
|
|
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js + 2 modules
|
|
var tool_cache = __webpack_require__(9805);
|
|
// 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_);
|
|
;// CONCATENATED MODULE: ./src/distributions/microsoft/installer.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MicrosoftDistributions extends base_installer/* JavaBase */.O {
|
|
constructor(installerOptions) {
|
|
super('Microsoft', installerOptions);
|
|
}
|
|
async downloadTool(javaRelease) {
|
|
core/* info */.pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
|
if (this.verifySignature) {
|
|
if (!javaRelease.signatureUrl) {
|
|
throw new Error(`Input 'verify-signature' is enabled, but no signature URL was found for Microsoft Build of OpenJDK version ${javaRelease.version}.`);
|
|
}
|
|
core/* info */.pq(`Verifying Java package signature...`);
|
|
try {
|
|
await gpg/* verifyPackageSignature */.Yi(javaArchivePath, javaRelease.signatureUrl, this.verifySignaturePublicKey ?? MICROSOFT_PUBLIC_KEY);
|
|
}
|
|
catch (error) {
|
|
throw new Error(`Failed to verify signature for Microsoft Build of OpenJDK version ${javaRelease.version}. Signature URL: ${javaRelease.signatureUrl}. Error: ${error.message}`, { cause: error });
|
|
}
|
|
}
|
|
core/* info */.pq(`Extracting Java archive...`);
|
|
const extension = (0,util/* getDownloadArchiveExtension */.ag)();
|
|
if (process.platform === 'win32') {
|
|
javaArchivePath = (0,util/* renameWinArchive */.n2)(javaArchivePath);
|
|
}
|
|
const extractedJavaPath = await (0,util/* extractJdkFile */.PE)(javaArchivePath, extension);
|
|
const archiveName = external_fs_default().readdirSync(extractedJavaPath)[0];
|
|
const archivePath = external_path_default().join(extractedJavaPath, archiveName);
|
|
const javaPath = await tool_cache/* cacheDir */.e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
|
return { version: javaRelease.version, path: javaPath };
|
|
}
|
|
async findPackageForDownload(range) {
|
|
const arch = this.distributionArchitecture();
|
|
if (arch !== 'x64' && arch !== 'aarch64') {
|
|
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
|
}
|
|
if (!this.stable) {
|
|
throw new Error('Early access versions are not supported');
|
|
}
|
|
if (this.packageType !== 'jdk') {
|
|
throw new Error('Microsoft Build of OpenJDK provides only the `jdk` package type');
|
|
}
|
|
const manifest = await this.getAvailableVersions();
|
|
if (!manifest) {
|
|
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
|
}
|
|
const foundRelease = await tool_cache/* findFromManifest */.DC(range, true, manifest, arch);
|
|
if (!foundRelease) {
|
|
const availableVersionStrings = manifest.map(item => item.version);
|
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
|
}
|
|
const file = foundRelease.files[0];
|
|
const signatureUrl = file.signature_url ?? `${file.download_url}.sig`;
|
|
return {
|
|
url: file.download_url,
|
|
signatureUrl,
|
|
version: foundRelease.version,
|
|
checksum: await this.fetchChecksum(`${file.download_url}.sha256sum.txt`, 'sha256')
|
|
};
|
|
}
|
|
supportsSignatureVerification() {
|
|
return true;
|
|
}
|
|
async getAvailableVersions() {
|
|
// TODO get these dynamically!
|
|
// We will need Microsoft to add an endpoint where we can query for versions.
|
|
const owner = 'actions';
|
|
const repository = 'setup-java';
|
|
const branch = 'main';
|
|
const filePath = 'src/distributions/microsoft/microsoft-openjdk-versions.json';
|
|
let releases = null;
|
|
const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
|
const headers = (0,util/* getGitHubHttpHeaders */.U_)();
|
|
let response = null;
|
|
if (core/* isDebug */._o()) {
|
|
console.time('Retrieving available versions for Microsoft took'); // eslint-disable-line no-console
|
|
}
|
|
try {
|
|
response = await this.http.getJson(fileUrl, headers);
|
|
if (!response.result) {
|
|
return null;
|
|
}
|
|
}
|
|
catch (err) {
|
|
core/* debug */.Yz(`Http request for microsoft-openjdk-versions.json failed with status code: ${response?.statusCode}. Error: ${err}`);
|
|
return null;
|
|
}
|
|
if (response.result) {
|
|
releases = response.result;
|
|
}
|
|
if (core/* isDebug */._o() && releases) {
|
|
core/* startGroup */.Oh('Print information about available versions');
|
|
console.timeEnd('Retrieving available versions for Microsoft took'); // eslint-disable-line no-console
|
|
core/* debug */.Yz(`Available versions: [${releases.length}]`);
|
|
core/* debug */.Yz(releases.map(item => item.version).join(', '));
|
|
core/* endGroup */.N4();
|
|
}
|
|
return releases;
|
|
}
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
};
|