mirror of
https://github.com/actions/setup-java.git
synced 2026-07-30 17:19:27 +08:00
Optimize Temurin tool-cache fast path with lazy loading (#1179)
* 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
This commit is contained in:
@@ -0,0 +1,80 @@
|
|||||||
|
import {jest, describe, it, expect, afterEach} from '@jest/globals';
|
||||||
|
|
||||||
|
jest.unstable_mockModule('@actions/cache', () => ({
|
||||||
|
isFeatureAvailable: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('@actions/core', () => ({
|
||||||
|
warning: jest.fn(),
|
||||||
|
debug: jest.fn(),
|
||||||
|
getInput: jest.fn(),
|
||||||
|
getBooleanInput: jest.fn(),
|
||||||
|
getMultilineInput: jest.fn(),
|
||||||
|
info: jest.fn(),
|
||||||
|
error: jest.fn(),
|
||||||
|
notice: jest.fn(),
|
||||||
|
setFailed: jest.fn(),
|
||||||
|
setOutput: jest.fn(),
|
||||||
|
addPath: jest.fn(),
|
||||||
|
exportVariable: jest.fn(),
|
||||||
|
saveState: jest.fn(),
|
||||||
|
getState: jest.fn(),
|
||||||
|
setSecret: jest.fn(),
|
||||||
|
isDebug: jest.fn(() => false),
|
||||||
|
startGroup: jest.fn(),
|
||||||
|
endGroup: jest.fn(),
|
||||||
|
group: jest.fn((_name: string, fn: () => Promise<unknown>) => fn()),
|
||||||
|
toPlatformPath: jest.fn((p: string) => p),
|
||||||
|
toWin32Path: jest.fn((p: string) => p),
|
||||||
|
toPosixPath: jest.fn((p: string) => p)
|
||||||
|
}));
|
||||||
|
|
||||||
|
const cache = await import('@actions/cache');
|
||||||
|
const core = await import('@actions/core');
|
||||||
|
const {isCacheFeatureAvailable} = await import('../src/cache-feature.js');
|
||||||
|
|
||||||
|
describe('isCacheFeatureAvailable', () => {
|
||||||
|
it('is disabled on GHES when cache feature is unavailable', () => {
|
||||||
|
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
const warningMock = core.warning as jest.Mock;
|
||||||
|
const message =
|
||||||
|
'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.';
|
||||||
|
|
||||||
|
try {
|
||||||
|
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
||||||
|
expect(isCacheFeatureAvailable()).toBe(false);
|
||||||
|
expect(warningMock).toHaveBeenCalledWith(message);
|
||||||
|
} finally {
|
||||||
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is disabled on dotcom when cache feature is unavailable', () => {
|
||||||
|
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
const warningMock = core.warning as jest.Mock;
|
||||||
|
const message =
|
||||||
|
'The runner was not able to contact the cache service. Caching will be skipped';
|
||||||
|
|
||||||
|
try {
|
||||||
|
process.env['GITHUB_SERVER_URL'] = 'http://github.com';
|
||||||
|
expect(isCacheFeatureAvailable()).toBe(false);
|
||||||
|
expect(warningMock).toHaveBeenCalledWith(message);
|
||||||
|
} finally {
|
||||||
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is enabled when cache feature is available', () => {
|
||||||
|
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(() => true);
|
||||||
|
expect(isCacheFeatureAvailable()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import {jest, describe, it, expect} from '@jest/globals';
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../../src/distributions/zulu/installer.js', () => {
|
||||||
|
throw new Error(
|
||||||
|
'Zulu installer module must not be imported on the Temurin fast path'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const {getJavaDistribution} =
|
||||||
|
await import('../../src/distributions/distribution-factory.js');
|
||||||
|
|
||||||
|
describe('distribution factory lazy loading', () => {
|
||||||
|
it('does not load non-selected distribution installers for Temurin', async () => {
|
||||||
|
const distribution = await getJavaDistribution('temurin', {
|
||||||
|
version: '21',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(distribution).not.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -29,8 +29,8 @@ const installerOptions = (packageType: string, version = '25') => ({
|
|||||||
describe('getJavaDistribution', () => {
|
describe('getJavaDistribution', () => {
|
||||||
it.each(supportedDistributionsOnCurrentPlatform)(
|
it.each(supportedDistributionsOnCurrentPlatform)(
|
||||||
'uses the shared retrying HTTP client for %s',
|
'uses the shared retrying HTTP client for %s',
|
||||||
distributionName => {
|
async distributionName => {
|
||||||
const distribution = getJavaDistribution(distributionName, {
|
const distribution = await getJavaDistribution(distributionName, {
|
||||||
version: '25',
|
version: '25',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
@@ -51,43 +51,46 @@ describe('getJavaDistribution', () => {
|
|||||||
? packageTypes.map(packageType => [distributionName, packageType])
|
? packageTypes.map(packageType => [distributionName, packageType])
|
||||||
: []
|
: []
|
||||||
)
|
)
|
||||||
)('accepts %s with java-package %s', (distributionName, packageType) => {
|
)(
|
||||||
expect(
|
'accepts %s with java-package %s',
|
||||||
getJavaDistribution(
|
async (distributionName, packageType) => {
|
||||||
distributionName,
|
expect(
|
||||||
installerOptions(packageType as string)
|
await getJavaDistribution(
|
||||||
)
|
distributionName,
|
||||||
).not.toBeNull();
|
installerOptions(packageType as string)
|
||||||
});
|
)
|
||||||
|
).not.toBeNull();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
it.each(Object.entries(JAVA_PACKAGE_CAPABILITIES))(
|
it.each(Object.entries(JAVA_PACKAGE_CAPABILITIES))(
|
||||||
'rejects unsupported java-package values for %s',
|
'rejects unsupported java-package values for %s',
|
||||||
(distributionName, packageTypes) => {
|
async (distributionName, packageTypes) => {
|
||||||
expect(() =>
|
await expect(
|
||||||
getJavaDistribution(distributionName, installerOptions('jdk+typo'))
|
getJavaDistribution(distributionName, installerOptions('jdk+typo'))
|
||||||
).toThrow(
|
).rejects.toThrow(
|
||||||
`Java package 'jdk+typo' is not supported for distribution '${distributionName}'. Supported package types: ${packageTypes.join(', ')}.`
|
`Java package 'jdk+typo' is not supported for distribution '${distributionName}'. Supported package types: ${packageTypes.join(', ')}.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it("rejects java-package 'jdk+jmods' for non-Temurin distributions", () => {
|
it("rejects java-package 'jdk+jmods' for non-Temurin distributions", async () => {
|
||||||
expect(() =>
|
await expect(
|
||||||
getJavaDistribution('zulu', installerOptions('jdk+jmods'))
|
getJavaDistribution('zulu', installerOptions('jdk+jmods'))
|
||||||
).toThrow(
|
).rejects.toThrow(
|
||||||
"Java package 'jdk+jmods' is not supported for distribution 'zulu'. Supported package types: jdk, jre, jdk+fx, jre+fx, jdk+crac, jre+crac."
|
"Java package 'jdk+jmods' is not supported for distribution 'zulu'. Supported package types: jdk, jre, jdk+fx, jre+fx, jdk+crac, jre+crac."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(['8', '23.x', '23.0.1.1', '<24'])(
|
it.each(['8', '23.x', '23.0.1.1', '<24'])(
|
||||||
"rejects Temurin java-package 'jdk+jmods' for version %s",
|
"rejects Temurin java-package 'jdk+jmods' for version %s",
|
||||||
version => {
|
async version => {
|
||||||
expect(() =>
|
await expect(
|
||||||
getJavaDistribution(
|
getJavaDistribution(
|
||||||
JavaDistribution.Temurin,
|
JavaDistribution.Temurin,
|
||||||
installerOptions('jdk+jmods', version)
|
installerOptions('jdk+jmods', version)
|
||||||
)
|
)
|
||||||
).toThrow(
|
).rejects.toThrow(
|
||||||
`Java package 'jdk+jmods' is not supported for distribution 'temurin'. Supported package types: jdk, jre, jdk+jmods. Package 'jdk+jmods' requires Java 24 or later; requested version '${version}'.`
|
`Java package 'jdk+jmods' is not supported for distribution 'temurin'. Supported package types: jdk, jre, jdk+jmods. Package 'jdk+jmods' requires Java 24 or later; requested version '${version}'.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -95,9 +98,9 @@ describe('getJavaDistribution', () => {
|
|||||||
|
|
||||||
it.each(['24', '24.0.1.1', '25-ea', '>=21', 'latest'])(
|
it.each(['24', '24.0.1.1', '25-ea', '>=21', 'latest'])(
|
||||||
"accepts Temurin java-package 'jdk+jmods' for version %s",
|
"accepts Temurin java-package 'jdk+jmods' for version %s",
|
||||||
version => {
|
async version => {
|
||||||
expect(
|
expect(
|
||||||
getJavaDistribution(
|
await getJavaDistribution(
|
||||||
JavaDistribution.Temurin,
|
JavaDistribution.Temurin,
|
||||||
installerOptions('jdk+jmods', version)
|
installerOptions('jdk+jmods', version)
|
||||||
)
|
)
|
||||||
@@ -105,9 +108,9 @@ describe('getJavaDistribution', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it('preserves unsupported distribution handling', () => {
|
it('preserves unsupported distribution handling', async () => {
|
||||||
expect(
|
expect(
|
||||||
getJavaDistribution(
|
await getJavaDistribution(
|
||||||
'not-a-distribution',
|
'not-a-distribution',
|
||||||
installerOptions('not-a-package')
|
installerOptions('not-a-package')
|
||||||
)
|
)
|
||||||
@@ -118,8 +121,8 @@ describe('getJavaDistribution', () => {
|
|||||||
['amd64', 'x64'],
|
['amd64', 'x64'],
|
||||||
['ia32', 'x86'],
|
['ia32', 'x86'],
|
||||||
['arm64', 'aarch64']
|
['arm64', 'aarch64']
|
||||||
])('passes normalized architecture %s as %s', (input, expected) => {
|
])('passes normalized architecture %s as %s', async (input, expected) => {
|
||||||
const normalized = getJavaDistribution(JavaDistribution.JdkFile, {
|
const normalized = await getJavaDistribution(JavaDistribution.JdkFile, {
|
||||||
...installerOptions('jdk'),
|
...installerOptions('jdk'),
|
||||||
architecture: input
|
architecture: input
|
||||||
});
|
});
|
||||||
@@ -127,8 +130,8 @@ describe('getJavaDistribution', () => {
|
|||||||
expect(normalized!['architecture']).toBe(expected);
|
expect(normalized!['architecture']).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the runner architecture when the input is empty', () => {
|
it('uses the runner architecture when the input is empty', async () => {
|
||||||
const distribution = getJavaDistribution(JavaDistribution.Temurin, {
|
const distribution = await getJavaDistribution(JavaDistribution.Temurin, {
|
||||||
...installerOptions('jdk'),
|
...installerOptions('jdk'),
|
||||||
architecture: ''
|
architecture: ''
|
||||||
});
|
});
|
||||||
@@ -137,12 +140,12 @@ describe('getJavaDistribution', () => {
|
|||||||
expect(distribution!['architecture']).toBe(expected);
|
expect(distribution!['architecture']).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects an unsupported combination before creating an HTTP client', () => {
|
it('rejects an unsupported combination before creating an HTTP client', async () => {
|
||||||
expect(() =>
|
await expect(
|
||||||
getJavaDistribution(JavaDistribution.Oracle, {
|
getJavaDistribution(JavaDistribution.Oracle, {
|
||||||
...installerOptions('jdk'),
|
...installerOptions('jdk'),
|
||||||
architecture: 'x86'
|
architecture: 'x86'
|
||||||
})
|
})
|
||||||
).toThrow(/does not support operating system/);
|
).rejects.toThrow(/does not support operating system/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1403,8 +1403,11 @@ describe('distribution factory', () => {
|
|||||||
checkLatest: false
|
checkLatest: false
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should map graalvm-community to the community installer', () => {
|
it('should map graalvm-community to the community installer', async () => {
|
||||||
const community = getJavaDistribution('graalvm-community', defaultOptions);
|
const community = await getJavaDistribution(
|
||||||
|
'graalvm-community',
|
||||||
|
defaultOptions
|
||||||
|
);
|
||||||
|
|
||||||
expect(community).toBeInstanceOf(GraalVMCommunityDistribution);
|
expect(community).toBeInstanceOf(GraalVMCommunityDistribution);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -233,8 +233,8 @@ describe('OpenJdkDistribution', () => {
|
|||||||
expect(windowsRelease[0].url.endsWith('.tar.gz')).toBe(true);
|
expect(windowsRelease[0].url.endsWith('.tar.gz')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('is registered in the distribution factory', () => {
|
it('is registered in the distribution factory', async () => {
|
||||||
const distribution = getJavaDistribution('oracle-openjdk', {
|
const distribution = await getJavaDistribution('oracle-openjdk', {
|
||||||
version: '26',
|
version: '26',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
import {jest, describe, it, expect, beforeEach} from '@jest/globals';
|
||||||
|
|
||||||
|
jest.unstable_mockModule('@actions/core', () => ({
|
||||||
|
info: jest.fn(),
|
||||||
|
warning: jest.fn(),
|
||||||
|
debug: jest.fn(),
|
||||||
|
error: jest.fn(),
|
||||||
|
notice: jest.fn(),
|
||||||
|
setFailed: jest.fn(),
|
||||||
|
setOutput: jest.fn(),
|
||||||
|
getInput: jest.fn(),
|
||||||
|
getBooleanInput: jest.fn(),
|
||||||
|
getMultilineInput: jest.fn(),
|
||||||
|
addPath: jest.fn(),
|
||||||
|
exportVariable: jest.fn(),
|
||||||
|
saveState: jest.fn(),
|
||||||
|
getState: jest.fn(),
|
||||||
|
setSecret: jest.fn(),
|
||||||
|
isDebug: jest.fn(() => false),
|
||||||
|
startGroup: jest.fn(),
|
||||||
|
endGroup: jest.fn(),
|
||||||
|
group: jest.fn((_name: string, fn: () => Promise<unknown>) => fn()),
|
||||||
|
toPlatformPath: jest.fn((value: string) => value),
|
||||||
|
toWin32Path: jest.fn((value: string) => value),
|
||||||
|
toPosixPath: jest.fn((value: string) => value)
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('fs', () => ({
|
||||||
|
default: {
|
||||||
|
readFileSync: jest.fn()
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/util.js', () => ({
|
||||||
|
getBooleanInput: jest.fn(),
|
||||||
|
getVersionFromFileContent: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/toolchains.js', () => ({
|
||||||
|
validateToolchainIds: jest.fn(),
|
||||||
|
configureToolchains: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule(
|
||||||
|
'../src/distributions/distribution-factory.js',
|
||||||
|
() => ({
|
||||||
|
getJavaDistribution: jest.fn()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/auth.js', () => ({
|
||||||
|
configureAuthentication: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/maven-args.js', () => ({
|
||||||
|
configureMavenArgs: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/problem-matcher.js', () => ({
|
||||||
|
configureProblemMatcher: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
// These modules should never be imported when `cache` input is empty.
|
||||||
|
jest.unstable_mockModule('../src/cache-feature.js', () => {
|
||||||
|
throw new Error('cache-feature module should not be loaded');
|
||||||
|
});
|
||||||
|
jest.unstable_mockModule('../src/cache.js', () => {
|
||||||
|
throw new Error('cache module should not be loaded');
|
||||||
|
});
|
||||||
|
|
||||||
|
const core = await import('@actions/core');
|
||||||
|
const util = await import('../src/util.js');
|
||||||
|
const toolchains = await import('../src/toolchains.js');
|
||||||
|
const factory = await import('../src/distributions/distribution-factory.js');
|
||||||
|
const {run} = await import('../src/setup-java.js');
|
||||||
|
|
||||||
|
describe('setup-java conditional module loading', () => {
|
||||||
|
const inputs = new Map<string, string>();
|
||||||
|
const multilineInputs = new Map<string, string[]>();
|
||||||
|
const booleanInputs = new Map<string, boolean>();
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
inputs.clear();
|
||||||
|
multilineInputs.clear();
|
||||||
|
booleanInputs.clear();
|
||||||
|
|
||||||
|
(core.getInput as jest.Mock).mockImplementation((name: unknown) => {
|
||||||
|
return inputs.get(name as string) ?? '';
|
||||||
|
});
|
||||||
|
(core.getMultilineInput as jest.Mock).mockImplementation(
|
||||||
|
(name: unknown) => {
|
||||||
|
return multilineInputs.get(name as string) ?? [];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
(util.getBooleanInput as jest.Mock).mockImplementation(
|
||||||
|
(name: unknown, defaultValue: unknown) => {
|
||||||
|
return booleanInputs.get(name as string) ?? defaultValue;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
(toolchains.configureToolchains as jest.Mock).mockResolvedValue(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not import cache modules when cache input is not provided', async () => {
|
||||||
|
inputs.set('distribution', 'temurin');
|
||||||
|
multilineInputs.set('java-version', ['21']);
|
||||||
|
(factory.getJavaDistribution as jest.Mock).mockResolvedValue({
|
||||||
|
setupJava: jest.fn(async () => ({
|
||||||
|
version: '21.0.4+7',
|
||||||
|
path: '/opt/java/21'
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(core.setFailed).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
+118
-37
@@ -33,7 +33,6 @@ jest.unstable_mockModule('fs', () => ({
|
|||||||
|
|
||||||
jest.unstable_mockModule('../src/util.js', () => ({
|
jest.unstable_mockModule('../src/util.js', () => ({
|
||||||
getBooleanInput: jest.fn(),
|
getBooleanInput: jest.fn(),
|
||||||
isCacheFeatureAvailable: jest.fn(),
|
|
||||||
getVersionFromFileContent: jest.fn()
|
getVersionFromFileContent: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -46,6 +45,10 @@ jest.unstable_mockModule('../src/cache.js', () => ({
|
|||||||
restore: jest.fn()
|
restore: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../src/cache-feature.js', () => ({
|
||||||
|
isCacheFeatureAvailable: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
jest.unstable_mockModule(
|
jest.unstable_mockModule(
|
||||||
'../src/distributions/distribution-factory.js',
|
'../src/distributions/distribution-factory.js',
|
||||||
() => ({
|
() => ({
|
||||||
@@ -70,6 +73,7 @@ const fs = (await import('fs')).default;
|
|||||||
const util = await import('../src/util.js');
|
const util = await import('../src/util.js');
|
||||||
const toolchains = await import('../src/toolchains.js');
|
const toolchains = await import('../src/toolchains.js');
|
||||||
const cache = await import('../src/cache.js');
|
const cache = await import('../src/cache.js');
|
||||||
|
const cacheFeature = await import('../src/cache-feature.js');
|
||||||
const factory = await import('../src/distributions/distribution-factory.js');
|
const factory = await import('../src/distributions/distribution-factory.js');
|
||||||
const auth = await import('../src/auth.js');
|
const auth = await import('../src/auth.js');
|
||||||
const mavenArgs = await import('../src/maven-args.js');
|
const mavenArgs = await import('../src/maven-args.js');
|
||||||
@@ -104,7 +108,7 @@ describe('setup action orchestration', () => {
|
|||||||
return booleanInputs.get(name as string) ?? defaultValue;
|
return booleanInputs.get(name as string) ?? defaultValue;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
(util.isCacheFeatureAvailable as jest.Mock).mockReturnValue(true);
|
(cacheFeature.isCacheFeatureAvailable as jest.Mock).mockReturnValue(true);
|
||||||
(toolchains.configureToolchains as jest.Mock).mockResolvedValue(undefined);
|
(toolchains.configureToolchains as jest.Mock).mockResolvedValue(undefined);
|
||||||
(auth.configureAuthentication as jest.Mock).mockResolvedValue(undefined);
|
(auth.configureAuthentication as jest.Mock).mockResolvedValue(undefined);
|
||||||
(cache.restore as jest.Mock).mockResolvedValue(undefined);
|
(cache.restore as jest.Mock).mockResolvedValue(undefined);
|
||||||
@@ -296,7 +300,7 @@ describe('setup action orchestration', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('configures post-install collaborators in order and restores the cache last', async () => {
|
it('starts cache restoration before post-install steps and awaits it before finishing', async () => {
|
||||||
inputs.set('distribution', 'temurin');
|
inputs.set('distribution', 'temurin');
|
||||||
inputs.set('cache', 'maven');
|
inputs.set('cache', 'maven');
|
||||||
inputs.set('cache-dependency-path', '**/pom.xml');
|
inputs.set('cache-dependency-path', '**/pom.xml');
|
||||||
@@ -305,48 +309,77 @@ describe('setup action orchestration', () => {
|
|||||||
'/custom/maven/repository',
|
'/custom/maven/repository',
|
||||||
'!/custom/maven/repository/excluded'
|
'!/custom/maven/repository/excluded'
|
||||||
]);
|
]);
|
||||||
const setupJava = jest.fn(async () => ({
|
const cacheRestore = deferred<void>();
|
||||||
version: '21.0.4+7',
|
let resolveSetupJava: (() => void) | undefined;
|
||||||
path: '/opt/java/21'
|
const setupJava = jest.fn(
|
||||||
}));
|
() =>
|
||||||
|
new Promise<{version: string; path: string}>(resolve => {
|
||||||
|
resolveSetupJava = () =>
|
||||||
|
resolve({
|
||||||
|
version: '21.0.4+7',
|
||||||
|
path: '/opt/java/21'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
(cache.restore as jest.Mock).mockReturnValue(cacheRestore.promise);
|
||||||
(factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
|
(factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
|
||||||
|
|
||||||
await run();
|
const runPromise = run();
|
||||||
|
try {
|
||||||
|
await tick();
|
||||||
|
|
||||||
expect(problemMatcher.configureProblemMatcher).toHaveBeenCalledWith(
|
expect(cacheFeature.isCacheFeatureAvailable).toHaveBeenCalled();
|
||||||
expect.stringMatching(/\.github[/\\]java\.json$/)
|
expect(cache.restore).toHaveBeenCalledWith('maven', '**/pom.xml', [
|
||||||
);
|
'/custom/maven/repository',
|
||||||
expect(cache.restore).toHaveBeenCalledWith('maven', '**/pom.xml', [
|
'!/custom/maven/repository/excluded'
|
||||||
'/custom/maven/repository',
|
]);
|
||||||
'!/custom/maven/repository/excluded'
|
expect(toolchains.configureToolchains).not.toHaveBeenCalled();
|
||||||
]);
|
|
||||||
expect(
|
resolveSetupJava?.();
|
||||||
(toolchains.configureToolchains as jest.Mock).mock.invocationCallOrder[0]
|
await tick();
|
||||||
).toBeLessThan(
|
expect(problemMatcher.configureProblemMatcher).toHaveBeenCalledWith(
|
||||||
(problemMatcher.configureProblemMatcher as jest.Mock).mock
|
expect.stringMatching(/\.github[/\\]java\.json$/)
|
||||||
.invocationCallOrder[0]
|
);
|
||||||
);
|
|
||||||
expect(
|
expect(
|
||||||
(problemMatcher.configureProblemMatcher as jest.Mock).mock
|
(toolchains.configureToolchains as jest.Mock).mock
|
||||||
.invocationCallOrder[0]
|
.invocationCallOrder[0]
|
||||||
).toBeLessThan(
|
).toBeLessThan(
|
||||||
(auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
|
(problemMatcher.configureProblemMatcher as jest.Mock).mock
|
||||||
);
|
.invocationCallOrder[0]
|
||||||
expect(
|
);
|
||||||
(auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
|
expect(
|
||||||
).toBeLessThan(
|
(problemMatcher.configureProblemMatcher as jest.Mock).mock
|
||||||
(mavenArgs.configureMavenArgs as jest.Mock).mock.invocationCallOrder[0]
|
.invocationCallOrder[0]
|
||||||
);
|
).toBeLessThan(
|
||||||
expect(
|
(auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
|
||||||
(mavenArgs.configureMavenArgs as jest.Mock).mock.invocationCallOrder[0]
|
);
|
||||||
).toBeLessThan((cache.restore as jest.Mock).mock.invocationCallOrder[0]);
|
expect(
|
||||||
|
(auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
|
||||||
|
).toBeLessThan(
|
||||||
|
(mavenArgs.configureMavenArgs as jest.Mock).mock.invocationCallOrder[0]
|
||||||
|
);
|
||||||
|
|
||||||
|
let completed = false;
|
||||||
|
runPromise.then(() => {
|
||||||
|
completed = true;
|
||||||
|
});
|
||||||
|
await tick();
|
||||||
|
expect(completed).toBe(false);
|
||||||
|
} finally {
|
||||||
|
resolveSetupJava?.();
|
||||||
|
cacheRestore.resolve();
|
||||||
|
await runPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(core.setFailed).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('skips cache restoration when the cache feature is unavailable', async () => {
|
it('skips cache restoration when the cache feature is unavailable', async () => {
|
||||||
inputs.set('distribution', 'temurin');
|
inputs.set('distribution', 'temurin');
|
||||||
inputs.set('cache', 'maven');
|
inputs.set('cache', 'maven');
|
||||||
multilineInputs.set('java-version', ['21']);
|
multilineInputs.set('java-version', ['21']);
|
||||||
(util.isCacheFeatureAvailable as jest.Mock).mockReturnValue(false);
|
(cacheFeature.isCacheFeatureAvailable as jest.Mock).mockReturnValue(false);
|
||||||
(factory.getJavaDistribution as jest.Mock).mockReturnValue({
|
(factory.getJavaDistribution as jest.Mock).mockReturnValue({
|
||||||
setupJava: jest.fn(async () => ({
|
setupJava: jest.fn(async () => ({
|
||||||
version: '21.0.4+7',
|
version: '21.0.4+7',
|
||||||
@@ -359,6 +392,22 @@ describe('setup action orchestration', () => {
|
|||||||
expect(cache.restore).not.toHaveBeenCalled();
|
expect(cache.restore).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not initialize cache modules when cache input is absent', async () => {
|
||||||
|
inputs.set('distribution', 'temurin');
|
||||||
|
multilineInputs.set('java-version', ['21']);
|
||||||
|
(factory.getJavaDistribution as jest.Mock).mockReturnValue({
|
||||||
|
setupJava: jest.fn(async () => ({
|
||||||
|
version: '21.0.4+7',
|
||||||
|
path: '/opt/java/21'
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(cacheFeature.isCacheFeatureAvailable).not.toHaveBeenCalled();
|
||||||
|
expect(cache.restore).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('reports unsupported distributions through core.setFailed', async () => {
|
it('reports unsupported distributions through core.setFailed', async () => {
|
||||||
inputs.set('distribution', 'unsupported');
|
inputs.set('distribution', 'unsupported');
|
||||||
multilineInputs.set('java-version', ['21']);
|
multilineInputs.set('java-version', ['21']);
|
||||||
@@ -411,6 +460,38 @@ describe('setup action orchestration', () => {
|
|||||||
expect(problemMatcher.configureProblemMatcher).toHaveBeenCalled();
|
expect(problemMatcher.configureProblemMatcher).toHaveBeenCalled();
|
||||||
expect(core.setFailed).toHaveBeenCalledWith('authentication failed');
|
expect(core.setFailed).toHaveBeenCalledWith('authentication failed');
|
||||||
expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
|
expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
|
||||||
expect(cache.restore).not.toHaveBeenCalled();
|
expect(cache.restore).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps Java setup errors deterministic when cache restore also fails', async () => {
|
||||||
|
inputs.set('distribution', 'temurin');
|
||||||
|
inputs.set('cache', 'maven');
|
||||||
|
multilineInputs.set('java-version', ['21']);
|
||||||
|
(factory.getJavaDistribution as jest.Mock).mockReturnValue({
|
||||||
|
setupJava: jest.fn(async () => {
|
||||||
|
throw new Error('download failed');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
(cache.restore as jest.Mock).mockRejectedValue(
|
||||||
|
new Error('cache restore failed')
|
||||||
|
);
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(core.setFailed).toHaveBeenCalledWith('download failed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function deferred<T>() {
|
||||||
|
let resolve!: (value: T | PromiseLike<T>) => void;
|
||||||
|
let reject!: (reason?: unknown) => void;
|
||||||
|
const promise = new Promise<T>((res, rej) => {
|
||||||
|
resolve = res;
|
||||||
|
reject = rej;
|
||||||
|
});
|
||||||
|
return {promise, resolve, reject};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function tick() {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 0));
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,13 +13,6 @@ import * as path from 'path';
|
|||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
// Mock @actions/cache
|
|
||||||
jest.unstable_mockModule('@actions/cache', () => ({
|
|
||||||
isFeatureAvailable: jest.fn(),
|
|
||||||
saveCache: jest.fn(),
|
|
||||||
restoreCache: jest.fn()
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Mock @actions/core
|
// Mock @actions/core
|
||||||
jest.unstable_mockModule('@actions/core', () => ({
|
jest.unstable_mockModule('@actions/core', () => ({
|
||||||
getInput: jest.fn(),
|
getInput: jest.fn(),
|
||||||
@@ -46,7 +39,6 @@ jest.unstable_mockModule('@actions/core', () => ({
|
|||||||
toPosixPath: jest.fn((p: string) => p)
|
toPosixPath: jest.fn((p: string) => p)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const cache = await import('@actions/cache');
|
|
||||||
const core = await import('@actions/core');
|
const core = await import('@actions/core');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -54,7 +46,6 @@ const {
|
|||||||
getNextPageUrlFromLinkHeader,
|
getNextPageUrlFromLinkHeader,
|
||||||
getVersionFromFileContent,
|
getVersionFromFileContent,
|
||||||
isVersionSatisfies,
|
isVersionSatisfies,
|
||||||
isCacheFeatureAvailable,
|
|
||||||
isGhes,
|
isGhes,
|
||||||
validatePaginationUrl,
|
validatePaginationUrl,
|
||||||
getLatestMajorVersion,
|
getLatestMajorVersion,
|
||||||
@@ -152,50 +143,6 @@ describe('isVersionSatisfies', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isCacheFeatureAvailable', () => {
|
|
||||||
it('isCacheFeatureAvailable disabled on GHES', () => {
|
|
||||||
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(
|
|
||||||
() => false
|
|
||||||
);
|
|
||||||
const infoMock = core.warning as jest.Mock;
|
|
||||||
const message =
|
|
||||||
'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.';
|
|
||||||
try {
|
|
||||||
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
|
||||||
expect(isCacheFeatureAvailable()).toBeFalsy();
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(message);
|
|
||||||
} finally {
|
|
||||||
delete process.env['GITHUB_SERVER_URL'];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('isCacheFeatureAvailable disabled on dotcom', () => {
|
|
||||||
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(
|
|
||||||
() => false
|
|
||||||
);
|
|
||||||
const infoMock = core.warning as jest.Mock;
|
|
||||||
const message =
|
|
||||||
'The runner was not able to contact the cache service. Caching will be skipped';
|
|
||||||
try {
|
|
||||||
process.env['GITHUB_SERVER_URL'] = 'http://github.com';
|
|
||||||
expect(isCacheFeatureAvailable()).toBe(false);
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(message);
|
|
||||||
} finally {
|
|
||||||
delete process.env['GITHUB_SERVER_URL'];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('isCacheFeatureAvailable is enabled', () => {
|
|
||||||
(cache.isFeatureAvailable as jest.Mock<any>).mockImplementation(() => true);
|
|
||||||
expect(isCacheFeatureAvailable()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
jest.resetAllMocks();
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('convertVersionToSemver', () => {
|
describe('convertVersionToSemver', () => {
|
||||||
it.each([
|
it.each([
|
||||||
['12', '12'],
|
['12', '12'],
|
||||||
|
|||||||
Vendored
+356
@@ -0,0 +1,356 @@
|
|||||||
|
export const id = 377;
|
||||||
|
export const ids = [377];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 7377:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ save: () => (/* binding */ save)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* unused harmony export restore */
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(857);
|
||||||
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5767);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_glob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2377);
|
||||||
|
/**
|
||||||
|
* @fileoverview this file provides methods handling dependency cache
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
|
||||||
|
const STATE_CACHE_PATHS = 'cache-paths';
|
||||||
|
const CACHE_MATCHED_KEY = 'cache-matched-key';
|
||||||
|
const CACHE_KEY_PREFIX = 'setup-java';
|
||||||
|
const supportedPackageManager = [
|
||||||
|
{
|
||||||
|
id: 'maven',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.m2', 'repository')],
|
||||||
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
||||||
|
pattern: [
|
||||||
|
'**/pom.xml',
|
||||||
|
'**/.mvn/wrapper/maven-wrapper.properties',
|
||||||
|
'**/.mvn/extensions.xml'
|
||||||
|
],
|
||||||
|
// The Maven wrapper distribution only depends on the wrapper properties,
|
||||||
|
// which change very rarely, so it is cached separately from the local
|
||||||
|
// repository. This keeps it available across the frequent pom.xml changes
|
||||||
|
// that rotate the main cache key. See issue #1095.
|
||||||
|
additionalCaches: [
|
||||||
|
{
|
||||||
|
name: 'maven-wrapper',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.m2', 'wrapper', 'dists')],
|
||||||
|
pattern: ['**/.mvn/wrapper/maven-wrapper.properties']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'gradle',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.gradle', 'caches')],
|
||||||
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
|
||||||
|
pattern: [
|
||||||
|
'**/*.gradle*',
|
||||||
|
'**/gradle-wrapper.properties',
|
||||||
|
'buildSrc/**/Versions.kt',
|
||||||
|
'buildSrc/**/Dependencies.kt',
|
||||||
|
'gradle/*.versions.toml',
|
||||||
|
'**/versions.properties'
|
||||||
|
],
|
||||||
|
// The Gradle wrapper distribution only depends on the wrapper properties,
|
||||||
|
// which change very rarely, so it is cached separately from the Gradle
|
||||||
|
// caches. This keeps it available across the frequent *.gradle* changes
|
||||||
|
// that rotate the main cache key. See issue #269.
|
||||||
|
additionalCaches: [
|
||||||
|
{
|
||||||
|
name: 'gradle-wrapper',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.gradle', 'wrapper')],
|
||||||
|
pattern: ['**/gradle-wrapper.properties']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sbt',
|
||||||
|
path: [
|
||||||
|
(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.ivy2', 'cache'),
|
||||||
|
(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.sbt'),
|
||||||
|
getCoursierCachePath(),
|
||||||
|
// Some files should not be cached to avoid resolution problems.
|
||||||
|
// In particular the resolution of snapshots (ideological gap between maven/ivy).
|
||||||
|
'!' + (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.sbt', '*.lock'),
|
||||||
|
'!' + (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '**', 'ivydata-*.properties')
|
||||||
|
],
|
||||||
|
pattern: [
|
||||||
|
'**/*.sbt',
|
||||||
|
'**/project/build.properties',
|
||||||
|
'**/project/**.scala',
|
||||||
|
'**/project/**.sbt'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
function getCoursierCachePath() {
|
||||||
|
if (os__WEBPACK_IMPORTED_MODULE_1___default().type() === 'Linux')
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.cache', 'coursier');
|
||||||
|
if (os__WEBPACK_IMPORTED_MODULE_1___default().type() === 'Darwin')
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), 'Library', 'Caches', 'Coursier');
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), 'AppData', 'Local', 'Coursier', 'Cache');
|
||||||
|
}
|
||||||
|
function findPackageManager(id) {
|
||||||
|
const packageManager = supportedPackageManager.find(packageManager => packageManager.id === id);
|
||||||
|
if (packageManager === undefined) {
|
||||||
|
throw new Error(`unknown package manager specified: ${id}`);
|
||||||
|
}
|
||||||
|
return packageManager;
|
||||||
|
}
|
||||||
|
function resolveCachePaths(packageManager, cachePaths) {
|
||||||
|
return cachePaths.length > 0 ? cachePaths : packageManager.path;
|
||||||
|
}
|
||||||
|
function getCachePathsFromState(packageManager) {
|
||||||
|
const cachePathsState = _actions_core__WEBPACK_IMPORTED_MODULE_3__/* .getState */ .Gu(STATE_CACHE_PATHS);
|
||||||
|
if (!cachePathsState) {
|
||||||
|
return packageManager.path;
|
||||||
|
}
|
||||||
|
const cachePaths = JSON.parse(cachePathsState);
|
||||||
|
if (!Array.isArray(cachePaths) ||
|
||||||
|
!cachePaths.every(cachePath => typeof cachePath === 'string')) {
|
||||||
|
throw new Error('Invalid cache paths retrieved from state.');
|
||||||
|
}
|
||||||
|
return cachePaths;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* State keys used to carry an additional cache's restore-time information over
|
||||||
|
* to the post (save) action, scoped by the additional cache name.
|
||||||
|
*/
|
||||||
|
function additionalCachePrimaryKeyState(name) {
|
||||||
|
return `${STATE_CACHE_PRIMARY_KEY}-${name}`;
|
||||||
|
}
|
||||||
|
function additionalCacheMatchedKeyState(name) {
|
||||||
|
return `${CACHE_MATCHED_KEY}-${name}`;
|
||||||
|
}
|
||||||
|
function buildCacheKey(id, fileHash) {
|
||||||
|
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${id}-${fileHash}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A function that generates a cache key to use.
|
||||||
|
* Format of the generated key will be "${{ platform }}-${{ id }}-${{ fileHash }}"".
|
||||||
|
* @see {@link https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key|spec of cache key}
|
||||||
|
*/
|
||||||
|
async function computeCacheKey(packageManager, cacheDependencyPath) {
|
||||||
|
const pattern = cacheDependencyPath
|
||||||
|
? cacheDependencyPath.trim().split('\n')
|
||||||
|
: packageManager.pattern;
|
||||||
|
const fileHash = await glob.hashFiles(pattern.join('\n'));
|
||||||
|
if (!fileHash) {
|
||||||
|
throw new Error(`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`);
|
||||||
|
}
|
||||||
|
return buildCacheKey(packageManager.id, fileHash);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Computes the cache key for an additional cache. Unlike {@link computeCacheKey}
|
||||||
|
* this returns undefined (instead of throwing) when no file matches the pattern,
|
||||||
|
* because additional caches are optional features that many projects do not use.
|
||||||
|
*/
|
||||||
|
async function computeAdditionalCacheKey(additionalCache) {
|
||||||
|
const fileHash = await glob.hashFiles(additionalCache.pattern.join('\n'));
|
||||||
|
if (!fileHash) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return buildCacheKey(additionalCache.name, fileHash);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Restore the dependency cache
|
||||||
|
* @param id ID of the package manager, should be "maven", "gradle", or "sbt"
|
||||||
|
* @param cacheDependencyPath The path to a dependency file
|
||||||
|
* @param cachePaths Paths to cache instead of the package manager defaults
|
||||||
|
*/
|
||||||
|
async function restore(id, cacheDependencyPath, cachePaths = []) {
|
||||||
|
const packageManager = findPackageManager(id);
|
||||||
|
const resolvedCachePaths = resolveCachePaths(packageManager, cachePaths);
|
||||||
|
const [primaryKey, preparedAdditionalCaches] = await Promise.all([
|
||||||
|
computeCacheKey(packageManager, cacheDependencyPath),
|
||||||
|
prepareAdditionalCaches(packageManager.additionalCaches ?? [])
|
||||||
|
]);
|
||||||
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
|
core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
|
core.saveState(STATE_CACHE_PATHS, JSON.stringify(resolvedCachePaths));
|
||||||
|
core.setOutput(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
|
for (const preparedCache of preparedAdditionalCaches) {
|
||||||
|
core.debug(`${preparedCache.cache.name} primary key is ${preparedCache.primaryKey}`);
|
||||||
|
core.saveState(additionalCachePrimaryKeyState(preparedCache.cache.name), preparedCache.primaryKey);
|
||||||
|
}
|
||||||
|
await Promise.all([
|
||||||
|
restorePrimaryCache(packageManager, resolvedCachePaths, primaryKey),
|
||||||
|
...preparedAdditionalCaches.map(preparedCache => restoreAdditionalCache(preparedCache))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
async function restorePrimaryCache(packageManager, cachePaths, primaryKey) {
|
||||||
|
// No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
|
||||||
|
const matchedKey = await cache.restoreCache(cachePaths, primaryKey);
|
||||||
|
if (matchedKey) {
|
||||||
|
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.setOutput('cache-hit', false);
|
||||||
|
core.info(`${packageManager.id} cache is not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compute keys for additional caches (e.g. build-tool wrapper distributions).
|
||||||
|
* Additional caches without a matching configuration file are omitted.
|
||||||
|
*/
|
||||||
|
async function prepareAdditionalCaches(additionalCaches) {
|
||||||
|
const preparedCaches = await Promise.all(additionalCaches.map(async (additionalCache) => {
|
||||||
|
const primaryKey = await computeAdditionalCacheKey(additionalCache);
|
||||||
|
if (!primaryKey) {
|
||||||
|
core.debug(`No file matched [${additionalCache.pattern}] for the ${additionalCache.name} cache, skipping.`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return { cache: additionalCache, primaryKey };
|
||||||
|
}));
|
||||||
|
return preparedCaches.filter((preparedCache) => preparedCache !== undefined);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Restore an additional cache keyed independently of the main dependency cache.
|
||||||
|
*/
|
||||||
|
async function restoreAdditionalCache(preparedCache) {
|
||||||
|
const { cache: additionalCache, primaryKey } = preparedCache;
|
||||||
|
const matchedKey = await cache.restoreCache(additionalCache.path, primaryKey);
|
||||||
|
if (matchedKey) {
|
||||||
|
core.saveState(additionalCacheMatchedKeyState(additionalCache.name), matchedKey);
|
||||||
|
core.info(`${additionalCache.name} cache restored from key: ${matchedKey}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`${additionalCache.name} cache is not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Save the dependency cache
|
||||||
|
* @param id ID of the package manager, should be "maven" or "gradle"
|
||||||
|
*/
|
||||||
|
async function save(id) {
|
||||||
|
const packageManager = findPackageManager(id);
|
||||||
|
const cachePaths = getCachePathsFromState(packageManager);
|
||||||
|
const matchedKey = _actions_core__WEBPACK_IMPORTED_MODULE_3__/* .getState */ .Gu(CACHE_MATCHED_KEY);
|
||||||
|
// Inputs are re-evaluated before the post action, so we want the original key used for restore
|
||||||
|
const primaryKey = _actions_core__WEBPACK_IMPORTED_MODULE_3__/* .getState */ .Gu(STATE_CACHE_PRIMARY_KEY);
|
||||||
|
for (const additionalCache of packageManager.additionalCaches ?? []) {
|
||||||
|
try {
|
||||||
|
await saveAdditionalCache(packageManager, additionalCache);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e(`Failed to save ${additionalCache.name} cache: ${err.message}. Continuing with primary cache save.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!primaryKey) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e('Error retrieving key from state.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (matchedKey === primaryKey) {
|
||||||
|
// no change in target directories
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const cacheId = await _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .saveCache */ .Io(cachePaths, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
// saveCache returns -1 without throwing when the cache was not saved,
|
||||||
|
// e.g. a reserve collision or a read-only token (fork PR). @actions/cache
|
||||||
|
// has already logged the reason at the appropriate severity, so just
|
||||||
|
// trace it instead of misreporting that the cache was saved.
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Cache saved with the key: ${primaryKey}`);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
if (err.name === _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .ReserveCacheError */ .Zh.name) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(err.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isProbablyGradleDaemonProblem(packageManager, err)) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e('Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for details.');
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Save an additional cache under its own key. Skips when no key was recorded at
|
||||||
|
* restore time (feature unused) or when the exact key was already restored.
|
||||||
|
*/
|
||||||
|
async function saveAdditionalCache(packageManager, additionalCache) {
|
||||||
|
const primaryKey = _actions_core__WEBPACK_IMPORTED_MODULE_3__/* .getState */ .Gu(additionalCachePrimaryKeyState(additionalCache.name));
|
||||||
|
const matchedKey = _actions_core__WEBPACK_IMPORTED_MODULE_3__/* .getState */ .Gu(additionalCacheMatchedKeyState(additionalCache.name));
|
||||||
|
if (!primaryKey) {
|
||||||
|
// The feature is not used by this project, nothing to save.
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`No primary key for the ${additionalCache.name} cache, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (matchedKey === primaryKey) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Cache hit occurred on the ${additionalCache.name} primary key ${primaryKey}, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const globber = await _actions_glob__WEBPACK_IMPORTED_MODULE_4__/* .create */ .v(additionalCache.path.join('\n'), {
|
||||||
|
implicitDescendants: false
|
||||||
|
});
|
||||||
|
const cachePaths = await globber.glob();
|
||||||
|
if (cachePaths.length === 0) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`${additionalCache.name} cache paths do not exist, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const cacheId = await _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .saveCache */ .Io(cachePaths, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`${additionalCache.name} cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`${additionalCache.name} cache saved with the key: ${primaryKey}`);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
if (err.name === _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .ValidationError */ .yI.name) {
|
||||||
|
// The cache paths did not resolve, e.g. the wrapper distribution was
|
||||||
|
// never downloaded because a system build tool was used or the download
|
||||||
|
// failed. Optional wrapper caches must not fail the post step, so skip.
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`${additionalCache.name} cache paths do not exist, not saving cache: ${err.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.name === _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .ReserveCacheError */ .Zh.name) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(err.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isProbablyGradleDaemonProblem(packageManager, err)) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e(`Failed to save ${additionalCache.name} cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with \`--no-daemon\` option. Refer to https://github.com/actions/cache/issues/454 for details.`);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param packageManager the specified package manager by user
|
||||||
|
* @param error the error thrown by the saveCache
|
||||||
|
* @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
|
||||||
|
* @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
|
||||||
|
*/
|
||||||
|
function isProbablyGradleDaemonProblem(packageManager, error) {
|
||||||
|
if (packageManager.id !== 'gradle' ||
|
||||||
|
process.env['RUNNER_OS'] !== 'Windows') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const message = error.message || '';
|
||||||
|
return message.startsWith('Tar failed with error: ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+62534
File diff suppressed because it is too large
Load Diff
Vendored
+2002
-64511
File diff suppressed because it is too large
Load Diff
Vendored
+162
@@ -0,0 +1,162 @@
|
|||||||
|
export const id = 126;
|
||||||
|
export const ids = [126];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 4126:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ CorrettoDistribution: () => (/* binding */ CorrettoDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const CORRETTO_VERSIONS_URL = 'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json';
|
||||||
|
class CorrettoDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Corretto', installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_4__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_4__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_4__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('Early access versions are not supported');
|
||||||
|
}
|
||||||
|
const availableVersions = await this.getAvailableVersions();
|
||||||
|
// The `latest` alias is normalized to the SemVer wildcard, but Corretto
|
||||||
|
// matches on an exact major version, so resolve it to the newest available
|
||||||
|
// major from Corretto's own list.
|
||||||
|
if (this.latest) {
|
||||||
|
const majors = availableVersions
|
||||||
|
.map(item => parseInt(item.version, 10))
|
||||||
|
.filter(major => Number.isFinite(major) && major > 0);
|
||||||
|
if (majors.length === 0) {
|
||||||
|
throw new Error('Could not determine the latest available Corretto major version from remote metadata');
|
||||||
|
}
|
||||||
|
version = Math.max(...majors).toString();
|
||||||
|
}
|
||||||
|
if (version.includes('.')) {
|
||||||
|
throw new Error('Only major versions are supported');
|
||||||
|
}
|
||||||
|
const matchingVersions = availableVersions
|
||||||
|
.filter(item => item.version == version)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: (0,_util_js__WEBPACK_IMPORTED_MODULE_4__/* .convertVersionToSemver */ .ZY)(item.correttoVersion),
|
||||||
|
url: item.downloadLink,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.checksum_sha256,
|
||||||
|
source: CORRETTO_VERSIONS_URL
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const resolvedVersion = matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
|
if (!resolvedVersion) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return resolvedVersion;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const imageType = this.packageType;
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Corretto took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const fetchCurrentVersions = await this.http.getJson(CORRETTO_VERSIONS_URL);
|
||||||
|
const fetchedCurrentVersions = fetchCurrentVersions.result;
|
||||||
|
if (!fetchedCurrentVersions) {
|
||||||
|
throw Error(`Could not fetch latest corretto versions from ${CORRETTO_VERSIONS_URL}`);
|
||||||
|
}
|
||||||
|
const eligibleVersions = fetchedCurrentVersions?.[platform]?.[arch]?.[imageType];
|
||||||
|
const availableVersions = this.getAvailableVersionsForPlatform(eligibleVersions);
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Corretto took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableVersions
|
||||||
|
.map(item => `${item.version}: ${item.correttoVersion}`)
|
||||||
|
.join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getAvailableVersionsForPlatform(eligibleVersions) {
|
||||||
|
const availableVersions = [];
|
||||||
|
for (const version in eligibleVersions) {
|
||||||
|
const availableVersion = eligibleVersions[version];
|
||||||
|
for (const fileType in availableVersion) {
|
||||||
|
const skipNonExtractableBinaries = fileType != (0,_util_js__WEBPACK_IMPORTED_MODULE_4__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (skipNonExtractableBinaries) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const availableVersionDetails = availableVersion[fileType];
|
||||||
|
const correttoVersion = this.getCorrettoVersion(availableVersionDetails.resource);
|
||||||
|
availableVersions.push({
|
||||||
|
checksum: availableVersionDetails.checksum,
|
||||||
|
checksum_sha256: availableVersionDetails.checksum_sha256,
|
||||||
|
fileType,
|
||||||
|
resource: availableVersionDetails.resource,
|
||||||
|
downloadLink: `https://corretto.aws${availableVersionDetails.resource}`,
|
||||||
|
version: version,
|
||||||
|
correttoVersion
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Corretto has its own platform names so we need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
const architecture = super.distributionArchitecture();
|
||||||
|
return architecture === 'armv7' ? 'arm' : architecture;
|
||||||
|
}
|
||||||
|
getCorrettoVersion(resource) {
|
||||||
|
const regex = /(\d+.+)\//;
|
||||||
|
const match = regex.exec(resource);
|
||||||
|
if (match === null) {
|
||||||
|
throw Error(`Could not parse corretto version from ${resource}`);
|
||||||
|
}
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+157
@@ -0,0 +1,157 @@
|
|||||||
|
export const id = 151;
|
||||||
|
export const ids = [151];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 8151:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ KonaDistribution: () => (/* binding */ KonaDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const KONA_RELEASES_URL = 'https://tencent.github.io/konajdk/releases/kona-v1.json';
|
||||||
|
class KonaDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Kona', installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Kona JDK ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
const javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
const archivePath = process.platform === 'win32'
|
||||||
|
? (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath)
|
||||||
|
: javaArchivePath;
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(archivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_3___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const jdkDirectory = path__WEBPACK_IMPORTED_MODULE_4___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(jdkDirectory, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('Kona provides stable releases only');
|
||||||
|
}
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Kona provides jdk only');
|
||||||
|
}
|
||||||
|
const availableReleases = await this.getAvailableReleases();
|
||||||
|
const releases = availableReleases
|
||||||
|
.filter(item => {
|
||||||
|
return (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(version, item.version);
|
||||||
|
})
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.version,
|
||||||
|
url: item.downloadUrl,
|
||||||
|
checksum: item.checksum
|
||||||
|
? {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.checksum,
|
||||||
|
source: KONA_RELEASES_URL
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => -semver__WEBPACK_IMPORTED_MODULE_2___default().compareBuild(a.version, b.version));
|
||||||
|
if (!releases.length) {
|
||||||
|
throw new Error(`No Kona release for the specified version "${version}" on OS "${this.getOs()}" and arch "${this.getArch()}".`);
|
||||||
|
}
|
||||||
|
return releases[0];
|
||||||
|
}
|
||||||
|
async getAvailableReleases() {
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available releases for Kona took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const releaseInfo = await this.fetchReleaseInfo();
|
||||||
|
if (!releaseInfo) {
|
||||||
|
throw new Error(`Couldn't fetch Kona release information`);
|
||||||
|
}
|
||||||
|
const availableReleases = this.chooseReleases(this.getOs(), this.getArch(), releaseInfo);
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available releases');
|
||||||
|
console.timeEnd('Retrieving available releases for Kona took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableReleases.map(item => item.version).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableReleases;
|
||||||
|
}
|
||||||
|
async fetchReleaseInfo() {
|
||||||
|
try {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Fetching Kona release info from URL: ${KONA_RELEASES_URL}`);
|
||||||
|
return (await this.http.getJson(KONA_RELEASES_URL))
|
||||||
|
.result;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Fetching Kona release info from the URL: ${KONA_RELEASES_URL} failed with the error: ${err.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chooseReleases(os, arch, releaseInfo) {
|
||||||
|
const releases = [];
|
||||||
|
for (const majorVersion in releaseInfo) {
|
||||||
|
const versions = releaseInfo[majorVersion];
|
||||||
|
for (const version of versions) {
|
||||||
|
if (!version.latest) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const file of version.files) {
|
||||||
|
if (file.os === os && file.arch === arch) {
|
||||||
|
releases.push({
|
||||||
|
version: version.version,
|
||||||
|
jdkVersion: version.jdkVersion,
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
downloadUrl: version.baseUrl + file.filename,
|
||||||
|
checksum: file.checksum
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
getOs() {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getArch() {
|
||||||
|
switch (this.architecture) {
|
||||||
|
case 'arm64':
|
||||||
|
return 'aarch64';
|
||||||
|
case 'x64':
|
||||||
|
return 'x86_64';
|
||||||
|
default:
|
||||||
|
return this.architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+121
@@ -0,0 +1,121 @@
|
|||||||
|
export const id = 182;
|
||||||
|
export const ids = [182];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 1182:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ OracleDistribution: () => (/* binding */ OracleDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4942);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const ORACLE_DL_BASE = 'https://download.oracle.com/java';
|
||||||
|
class OracleDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Oracle', installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, 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('Oracle JDK provides only the `jdk` package type');
|
||||||
|
}
|
||||||
|
const platform = this.getPlatform();
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
// The `latest` alias is normalized to the SemVer wildcard. Oracle builds its
|
||||||
|
// download URLs from a concrete major and has no endpoint to list releases,
|
||||||
|
// so resolve the newest available GA major from the Adoptium API and use it.
|
||||||
|
if (this.latest) {
|
||||||
|
const latestMajor = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getLatestMajorVersion */ .ri)(this.http);
|
||||||
|
range = latestMajor.toString();
|
||||||
|
}
|
||||||
|
const isOnlyMajorProvided = !range.includes('.');
|
||||||
|
const major = isOnlyMajorProvided ? range : range.split('.')[0];
|
||||||
|
const possibleUrls = [];
|
||||||
|
/**
|
||||||
|
* NOTE
|
||||||
|
* If only major version was provided we will check it under /latest first
|
||||||
|
* in order to retrieve the latest possible version if possible,
|
||||||
|
* otherwise we will fall back to /archive where we are guaranteed to
|
||||||
|
* find any version if it exists
|
||||||
|
*/
|
||||||
|
if (isOnlyMajorProvided) {
|
||||||
|
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/latest/jdk-${major}_${platform}-${arch}_bin.${extension}`);
|
||||||
|
}
|
||||||
|
possibleUrls.push(`${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`);
|
||||||
|
if (parseInt(major) < 17) {
|
||||||
|
throw new Error('Oracle JDK is only supported for JDK 17 and later');
|
||||||
|
}
|
||||||
|
for (const url of possibleUrls) {
|
||||||
|
const response = await this.http.head(url);
|
||||||
|
if (response.message.statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.OK) {
|
||||||
|
return {
|
||||||
|
url,
|
||||||
|
version: range,
|
||||||
|
checksum: await this.fetchChecksum(`${url}.sha256`, 'sha256')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (response.message.statusCode !== _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.NotFound) {
|
||||||
|
throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.latest) {
|
||||||
|
const error = this.createVersionNotFoundError(range);
|
||||||
|
error.message += `\nThe latest Java major version (${range}) is not yet available for the Oracle JDK distribution. Please specify a concrete version instead of 'latest'.`;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
throw this.createVersionNotFoundError(range);
|
||||||
|
}
|
||||||
|
getPlatform(platform = process.platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'linux';
|
||||||
|
default:
|
||||||
|
throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+90
@@ -0,0 +1,90 @@
|
|||||||
|
export const id = 19;
|
||||||
|
export const ids = [19];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 1019:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ LocalDistribution: () => (/* binding */ LocalDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7242);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LocalDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4__/* .JavaBase */ .O {
|
||||||
|
jdkFile;
|
||||||
|
constructor(installerOptions, jdkFile) {
|
||||||
|
super('jdkfile', installerOptions);
|
||||||
|
this.jdkFile = jdkFile;
|
||||||
|
}
|
||||||
|
async setupJava() {
|
||||||
|
if (this.latest) {
|
||||||
|
throw new Error("The 'latest' version alias is not supported for the 'jdkfile' distribution. Please specify a concrete version.");
|
||||||
|
}
|
||||||
|
let foundJava = this.forceDownload ? null : this.findInToolcache();
|
||||||
|
if (foundJava) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Java ${this.version} was not found in tool-cache. Trying to unpack JDK file...`);
|
||||||
|
if (!this.jdkFile) {
|
||||||
|
throw new Error("'jdkFile' is not specified");
|
||||||
|
}
|
||||||
|
const jdkFilePath = path__WEBPACK_IMPORTED_MODULE_3___default().resolve(this.jdkFile);
|
||||||
|
const stats = fs__WEBPACK_IMPORTED_MODULE_2___default().statSync(jdkFilePath);
|
||||||
|
if (!stats.isFile()) {
|
||||||
|
throw new Error(`JDK file was not found in path '${jdkFilePath}'`);
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Extracting Java from '${jdkFilePath}'`);
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .extractJdkFile */ .PE)(jdkFilePath);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const javaVersion = this.version;
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_0__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), this.architecture);
|
||||||
|
foundJava = {
|
||||||
|
version: javaVersion,
|
||||||
|
path: javaPath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||||
|
const macOSPostfixPath = path__WEBPACK_IMPORTED_MODULE_3___default().join(foundJava.path, _constants_js__WEBPACK_IMPORTED_MODULE_6__/* .MACOS_JAVA_CONTENT_POSTFIX */ .PG);
|
||||||
|
if (process.platform === 'darwin' && fs__WEBPACK_IMPORTED_MODULE_2___default().existsSync(macOSPostfixPath)) {
|
||||||
|
foundJava.path = macOSPostfixPath;
|
||||||
|
}
|
||||||
|
if (this.setDefault) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Setting Java ${foundJava.version} as the default`);
|
||||||
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .info */ .pq(`Installing Java ${foundJava.version} (not setting as default)`);
|
||||||
|
this.setJavaEnvironment(foundJava.version, foundJava.path);
|
||||||
|
}
|
||||||
|
return foundJava;
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
) {
|
||||||
|
throw new Error('This method should not be implemented in local file provider');
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
) {
|
||||||
|
throw new Error('This method should not be implemented in local file provider');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+168
@@ -0,0 +1,168 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+562
@@ -0,0 +1,562 @@
|
|||||||
|
export const id = 242;
|
||||||
|
export const ids = [242];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 6242:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
|
||||||
|
// EXPORTS
|
||||||
|
__webpack_require__.d(__webpack_exports__, {
|
||||||
|
O: () => (/* binding */ JavaBase)
|
||||||
|
});
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js + 2 modules
|
||||||
|
var tool_cache = __webpack_require__(9805);
|
||||||
|
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
|
||||||
|
var core = __webpack_require__(3838);
|
||||||
|
// EXTERNAL MODULE: external "fs"
|
||||||
|
var external_fs_ = __webpack_require__(9896);
|
||||||
|
// EXTERNAL MODULE: ./node_modules/semver/index.js
|
||||||
|
var semver = __webpack_require__(2088);
|
||||||
|
var semver_default = /*#__PURE__*/__webpack_require__.n(semver);
|
||||||
|
// 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/http-client/lib/index.js + 1 modules
|
||||||
|
var lib = __webpack_require__(4942);
|
||||||
|
// EXTERNAL MODULE: ./src/util.ts
|
||||||
|
var util = __webpack_require__(4527);
|
||||||
|
// EXTERNAL MODULE: ./src/constants.ts
|
||||||
|
var constants = __webpack_require__(7242);
|
||||||
|
;// CONCATENATED MODULE: ./src/retrying-http-client.ts
|
||||||
|
|
||||||
|
|
||||||
|
const RETRYABLE_HTTP_STATUS_CODES = new Set([429, 502, 503, 504, 522]);
|
||||||
|
const RETRYABLE_NETWORK_ERROR_CODES = new Set([
|
||||||
|
'ETIMEDOUT',
|
||||||
|
'ECONNRESET',
|
||||||
|
'ENOTFOUND',
|
||||||
|
'ECONNREFUSED'
|
||||||
|
]);
|
||||||
|
const RETRYABLE_HTTP_VERBS = new Set(['OPTIONS', 'GET', 'DELETE', 'HEAD']);
|
||||||
|
class RetryingHttpClient extends lib/* HttpClient */.Qq {
|
||||||
|
maxAttempts;
|
||||||
|
baseDelayMs;
|
||||||
|
maxDelayMs;
|
||||||
|
sleep;
|
||||||
|
random;
|
||||||
|
now;
|
||||||
|
constructor(userAgent, retryOptions = {}) {
|
||||||
|
super(userAgent, undefined, { allowRetries: false });
|
||||||
|
this.maxAttempts = retryOptions.maxAttempts ?? 4;
|
||||||
|
this.baseDelayMs = retryOptions.baseDelayMs ?? 1000;
|
||||||
|
this.maxDelayMs = retryOptions.maxDelayMs ?? 10000;
|
||||||
|
this.sleep =
|
||||||
|
retryOptions.sleep ??
|
||||||
|
(delayMs => new Promise(resolve => setTimeout(resolve, delayMs)));
|
||||||
|
this.random = retryOptions.random ?? Math.random;
|
||||||
|
this.now = retryOptions.now ?? Date.now;
|
||||||
|
if (this.maxAttempts < 1) {
|
||||||
|
throw new Error('maxAttempts must be at least 1');
|
||||||
|
}
|
||||||
|
if (this.baseDelayMs < 0 || this.maxDelayMs < this.baseDelayMs) {
|
||||||
|
throw new Error('baseDelayMs must be non-negative and no greater than maxDelayMs');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async request(verb, requestUrl, data, headers) {
|
||||||
|
if (!RETRYABLE_HTTP_VERBS.has(verb)) {
|
||||||
|
return super.request(verb, requestUrl, data, headers);
|
||||||
|
}
|
||||||
|
for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
|
||||||
|
try {
|
||||||
|
const response = await super.request(verb, requestUrl, data, headers);
|
||||||
|
const statusCode = response.message.statusCode;
|
||||||
|
if (!statusCode ||
|
||||||
|
!RETRYABLE_HTTP_STATUS_CODES.has(statusCode) ||
|
||||||
|
attempt === this.maxAttempts) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
const delayMs = this.getDelayMs(attempt, response.message.headers['retry-after']);
|
||||||
|
await response.readBody();
|
||||||
|
this.logRetry(attempt, delayMs, `HTTP ${statusCode}`);
|
||||||
|
await this.sleep(delayMs);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (!isRetryableNetworkError(error) || attempt === this.maxAttempts) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
const delayMs = this.getDelayMs(attempt);
|
||||||
|
this.logRetry(attempt, delayMs, getErrorMessage(error));
|
||||||
|
await this.sleep(delayMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error('HTTP retry attempts exhausted unexpectedly');
|
||||||
|
}
|
||||||
|
getDelayMs(failedAttempt, retryAfter) {
|
||||||
|
const exponentialDelay = Math.min(this.maxDelayMs, this.baseDelayMs * 2 ** (failedAttempt - 1));
|
||||||
|
const jitteredDelay = Math.floor(exponentialDelay / 2 + this.random() * (exponentialDelay / 2));
|
||||||
|
const retryAfterDelay = parseRetryAfter(retryAfter, this.now());
|
||||||
|
return Math.min(this.maxDelayMs, Math.max(jitteredDelay, retryAfterDelay ?? 0));
|
||||||
|
}
|
||||||
|
logRetry(failedAttempt, delayMs, reason) {
|
||||||
|
core/* info */.pq(`Request attempt ${failedAttempt} of ${this.maxAttempts} failed (${reason}); retrying in ${delayMs} ms`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function parseRetryAfter(value, nowMs) {
|
||||||
|
const retryAfter = Array.isArray(value) ? value[0] : value;
|
||||||
|
if (!retryAfter) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (/^\d+$/.test(retryAfter.trim())) {
|
||||||
|
return Number(retryAfter) * 1000;
|
||||||
|
}
|
||||||
|
const retryAt = Date.parse(retryAfter);
|
||||||
|
if (Number.isNaN(retryAt) || retryAt <= nowMs) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return retryAt - nowMs;
|
||||||
|
}
|
||||||
|
function isRetryableNetworkError(error) {
|
||||||
|
if (!isErrorRecord(error)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (typeof error.code === 'string' &&
|
||||||
|
RETRYABLE_NETWORK_ERROR_CODES.has(error.code)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return (Array.isArray(error.errors) &&
|
||||||
|
error.errors.some(nestedError => isRetryableNetworkError(nestedError)));
|
||||||
|
}
|
||||||
|
function isErrorRecord(error) {
|
||||||
|
return typeof error === 'object' && error !== null;
|
||||||
|
}
|
||||||
|
function getErrorMessage(error) {
|
||||||
|
return error instanceof Error ? error.message : 'network error';
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: external "os"
|
||||||
|
var external_os_ = __webpack_require__(857);
|
||||||
|
var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
|
||||||
|
// EXTERNAL MODULE: external "crypto"
|
||||||
|
var external_crypto_ = __webpack_require__(6982);
|
||||||
|
// EXTERNAL MODULE: external "stream/promises"
|
||||||
|
var promises_ = __webpack_require__(4548);
|
||||||
|
;// CONCATENATED MODULE: ./src/checksum.ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function sanitizedSource(source) {
|
||||||
|
if (!source) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const url = new URL(source);
|
||||||
|
return ` from ${url.origin}${url.pathname}`;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return ' from an invalid checksum source';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Length, in hex characters, of a digest produced by each supported algorithm.
|
||||||
|
// Exported so callers (e.g. fetchChecksum) can infer which algorithm a vendor
|
||||||
|
// actually used when it doesn't disclose it via the checksum URL/filename.
|
||||||
|
function expectedDigestLength(algorithm) {
|
||||||
|
return algorithm === 'sha256' ? 64 : algorithm === 'sha512' ? 128 : 0;
|
||||||
|
}
|
||||||
|
function normalizeExpectedDigest(checksum) {
|
||||||
|
const algorithm = checksum.algorithm;
|
||||||
|
const digest = typeof checksum.value === 'string'
|
||||||
|
? checksum.value.trim().toLowerCase()
|
||||||
|
: '';
|
||||||
|
const expectedLength = expectedDigestLength(algorithm);
|
||||||
|
if (expectedLength === 0) {
|
||||||
|
throw new Error(`Unsupported checksum algorithm '${String(algorithm)}'${sanitizedSource(checksum.source)}. Supported algorithms are sha256 and sha512.`);
|
||||||
|
}
|
||||||
|
if (!new RegExp(`^[a-f0-9]{${expectedLength}}$`).test(digest)) {
|
||||||
|
throw new Error(`Malformed ${algorithm} checksum metadata${sanitizedSource(checksum.source)}: expected a ${expectedLength}-character hexadecimal digest.`);
|
||||||
|
}
|
||||||
|
return digest;
|
||||||
|
}
|
||||||
|
async function calculateChecksum(filePath, algorithm) {
|
||||||
|
const hash = (0,external_crypto_.createHash)(algorithm);
|
||||||
|
await (0,promises_.pipeline)((0,external_fs_.createReadStream)(filePath), hash);
|
||||||
|
return hash.digest('hex');
|
||||||
|
}
|
||||||
|
async function verifyChecksum(filePath, checksum, context) {
|
||||||
|
const expected = normalizeExpectedDigest(checksum);
|
||||||
|
const actual = await calculateChecksum(filePath, checksum.algorithm);
|
||||||
|
const matches = (0,external_crypto_.timingSafeEqual)(Buffer.from(expected, 'hex'), Buffer.from(actual, 'hex'));
|
||||||
|
if (!matches) {
|
||||||
|
throw new Error(`Checksum verification failed for ${context.distribution} version ${context.version}: ${checksum.algorithm} expected ${expected}, actual ${actual}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./src/distributions/platform-types.ts
|
||||||
|
var platform_types = __webpack_require__(7444);
|
||||||
|
;// CONCATENATED MODULE: ./src/distributions/base-installer.ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class JavaBase {
|
||||||
|
distribution;
|
||||||
|
http;
|
||||||
|
version;
|
||||||
|
architecture;
|
||||||
|
packageType;
|
||||||
|
stable;
|
||||||
|
latest;
|
||||||
|
checkLatest;
|
||||||
|
forceDownload;
|
||||||
|
setDefault;
|
||||||
|
verifySignature;
|
||||||
|
verifySignaturePublicKey;
|
||||||
|
constructor(distribution, installerOptions) {
|
||||||
|
this.distribution = distribution;
|
||||||
|
this.http = new RetryingHttpClient('actions/setup-java');
|
||||||
|
({
|
||||||
|
version: this.version,
|
||||||
|
stable: this.stable,
|
||||||
|
latest: this.latest
|
||||||
|
} = this.normalizeVersion(installerOptions.version));
|
||||||
|
this.architecture = (0,platform_types/* normalizeArchitecture */.dV)(installerOptions.architecture || external_os_default().arch());
|
||||||
|
this.packageType = installerOptions.packageType;
|
||||||
|
this.checkLatest = installerOptions.checkLatest;
|
||||||
|
this.forceDownload = installerOptions.forceDownload ?? false;
|
||||||
|
this.setDefault =
|
||||||
|
installerOptions.setDefault !== undefined
|
||||||
|
? installerOptions.setDefault
|
||||||
|
: true;
|
||||||
|
this.verifySignature = installerOptions.verifySignature ?? false;
|
||||||
|
this.verifySignaturePublicKey = installerOptions.verifySignaturePublicKey;
|
||||||
|
}
|
||||||
|
async downloadAndVerify(javaRelease) {
|
||||||
|
const archivePath = await tool_cache/* downloadTool */.bq(javaRelease.url);
|
||||||
|
const checksum = javaRelease.checksum;
|
||||||
|
if (!checksum || !checksum.value?.trim()) {
|
||||||
|
core/* debug */.Yz(`No authoritative checksum is available for ${this.distribution} version ${javaRelease.version}; skipping checksum verification.`);
|
||||||
|
return archivePath;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await verifyChecksum(archivePath, checksum, {
|
||||||
|
distribution: this.distribution,
|
||||||
|
version: javaRelease.version
|
||||||
|
});
|
||||||
|
core/* debug */.Yz(`Verified ${checksum.algorithm} checksum for ${this.distribution} version ${javaRelease.version}.`);
|
||||||
|
return archivePath;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
let cleanupError;
|
||||||
|
let cleanupFailed = false;
|
||||||
|
try {
|
||||||
|
await external_fs_.promises.rm(archivePath, { force: true });
|
||||||
|
}
|
||||||
|
catch (caughtCleanupError) {
|
||||||
|
cleanupError = caughtCleanupError;
|
||||||
|
cleanupFailed = true;
|
||||||
|
}
|
||||||
|
if (cleanupFailed) {
|
||||||
|
throw new Error(`${error.message} Failed to remove the downloaded archive after verification failure: ${cleanupError.message}`, { cause: error });
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async fetchChecksum(checksumUrl, algorithm) {
|
||||||
|
// Some vendors (e.g. JetBrains) publish a single, generically-named
|
||||||
|
// checksum sibling (`.checksum`) whose digest algorithm isn't disclosed
|
||||||
|
// by the URL and has changed across releases. Accepting a list of
|
||||||
|
// candidate algorithms lets callers pass every algorithm the vendor is
|
||||||
|
// known to use; the actual algorithm is then inferred from the length of
|
||||||
|
// the returned digest.
|
||||||
|
const algorithms = Array.isArray(algorithm) ? algorithm : [algorithm];
|
||||||
|
const algorithmLabel = algorithms.join(' or ');
|
||||||
|
const response = await this.http.get(checksumUrl);
|
||||||
|
const statusCode = response.message.statusCode;
|
||||||
|
const source = (() => {
|
||||||
|
try {
|
||||||
|
const url = new URL(checksumUrl);
|
||||||
|
return `${url.origin}${url.pathname}`;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return 'an invalid checksum URL';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (statusCode === lib/* HttpCodes */.Hv.NotFound) {
|
||||||
|
core/* debug */.Yz(`No authoritative ${algorithmLabel} checksum is available for ${this.distribution} from ${source}; skipping checksum verification.`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (statusCode !== lib/* HttpCodes */.Hv.OK) {
|
||||||
|
throw new Error(`Failed to fetch the authoritative ${algorithmLabel} checksum for ${this.distribution} from ${source} (HTTP ${statusCode}).`);
|
||||||
|
}
|
||||||
|
const body = await response.readBody();
|
||||||
|
const value = body.trim().split(/\s+/, 1)[0] ?? '';
|
||||||
|
if (!value) {
|
||||||
|
throw new Error(`Received an empty authoritative ${algorithmLabel} checksum for ${this.distribution} from ${source}.`);
|
||||||
|
}
|
||||||
|
// Prefer the strongest algorithm whose digest length matches what was
|
||||||
|
// actually returned; fall back to the first candidate (preserving prior
|
||||||
|
// behavior/error messages) when the digest doesn't match any of them.
|
||||||
|
const resolvedAlgorithm = algorithms.find(algo => value.length === expectedDigestLength(algo)) ??
|
||||||
|
algorithms[0];
|
||||||
|
return { algorithm: resolvedAlgorithm, value, source: checksumUrl };
|
||||||
|
}
|
||||||
|
async setupJava() {
|
||||||
|
if (this.verifySignature && !this.supportsSignatureVerification()) {
|
||||||
|
throw new Error(`Input 'verify-signature' is not supported for distribution '${this.distribution}'.`);
|
||||||
|
}
|
||||||
|
let foundJava = this.forceDownload ? null : this.findInToolcache();
|
||||||
|
if (foundJava && !this.checkLatest && !this.latest) {
|
||||||
|
core/* info */.pq(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core/* info */.pq('Trying to resolve the latest version from remote');
|
||||||
|
try {
|
||||||
|
const javaRelease = await this.findPackageForDownload(this.version);
|
||||||
|
core/* info */.pq(`Resolved latest version as ${javaRelease.version}`);
|
||||||
|
if (!this.forceDownload && foundJava?.version === javaRelease.version) {
|
||||||
|
core/* info */.pq(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core/* info */.pq('Trying to download...');
|
||||||
|
foundJava = await this.downloadTool(javaRelease);
|
||||||
|
core/* info */.pq(`Java ${foundJava.version} was downloaded`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.logSetupError(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundJava) {
|
||||||
|
throw new Error('Failed to resolve Java version');
|
||||||
|
}
|
||||||
|
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||||
|
const macOSPostfixPath = external_path_default().join(foundJava.path, constants/* MACOS_JAVA_CONTENT_POSTFIX */.PG);
|
||||||
|
if (process.platform === 'darwin' && external_fs_.existsSync(macOSPostfixPath)) {
|
||||||
|
foundJava.path = macOSPostfixPath;
|
||||||
|
}
|
||||||
|
if (this.setDefault) {
|
||||||
|
core/* info */.pq(`Setting Java ${foundJava.version} as the default`);
|
||||||
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core/* info */.pq(`Installing Java ${foundJava.version} (not setting as default)`);
|
||||||
|
this.setJavaEnvironment(foundJava.version, foundJava.path);
|
||||||
|
}
|
||||||
|
return foundJava;
|
||||||
|
}
|
||||||
|
logSetupError(error) {
|
||||||
|
const httpStatusCode = error instanceof tool_cache/* HTTPError */.Hl
|
||||||
|
? error.httpStatusCode
|
||||||
|
: error instanceof lib/* HttpClientError */.Kg
|
||||||
|
? error.statusCode
|
||||||
|
: undefined;
|
||||||
|
if (httpStatusCode) {
|
||||||
|
if (httpStatusCode === 403) {
|
||||||
|
core/* error */.z3('HTTP 403: Permission denied or access restricted.');
|
||||||
|
}
|
||||||
|
else if (httpStatusCode === 429) {
|
||||||
|
core/* warning */.$e('HTTP 429: Rate limit exceeded. Please retry later.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core/* error */.z3(`HTTP ${httpStatusCode}: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (error && error.errors && Array.isArray(error.errors)) {
|
||||||
|
core/* error */.z3(`Java setup failed due to network or configuration error(s)`);
|
||||||
|
if (error instanceof Error && error.stack) {
|
||||||
|
core/* debug */.Yz(error.stack);
|
||||||
|
}
|
||||||
|
for (const err of error.errors) {
|
||||||
|
const endpoint = err?.address || err?.hostname || '';
|
||||||
|
const port = err?.port ? `:${err.port}` : '';
|
||||||
|
const message = err?.message || 'Aggregate error';
|
||||||
|
const endpointInfo = !message.includes(endpoint)
|
||||||
|
? ` ${endpoint}${port}`
|
||||||
|
: '';
|
||||||
|
const localInfo = err.localAddress && err.localPort
|
||||||
|
? ` - Local (${err.localAddress}:${err.localPort})`
|
||||||
|
: '';
|
||||||
|
const logMessage = `${message}${endpointInfo}${localInfo}`;
|
||||||
|
core/* error */.z3(logMessage);
|
||||||
|
core/* debug */.Yz(`${err.stack || err.message}`);
|
||||||
|
Object.entries(err).forEach(([key, value]) => {
|
||||||
|
core/* debug */.Yz(`"${key}": ${JSON.stringify(value)}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||||
|
core/* error */.z3(`Java setup process failed due to: ${message}`);
|
||||||
|
if (typeof error?.code === 'string') {
|
||||||
|
core/* debug */.Yz(error.stack);
|
||||||
|
}
|
||||||
|
const errorDetails = {
|
||||||
|
name: error.name,
|
||||||
|
message: error.message,
|
||||||
|
...Object.getOwnPropertyNames(error)
|
||||||
|
.filter(prop => !['name', 'message', 'stack'].includes(prop))
|
||||||
|
.reduce((acc, prop) => {
|
||||||
|
acc[prop] = error[prop];
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
Object.entries(errorDetails).forEach(([key, value]) => {
|
||||||
|
core/* debug */.Yz(`"${key}": ${JSON.stringify(value)}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get toolcacheFolderName() {
|
||||||
|
return `Java_${this.distribution}_${this.packageType}`;
|
||||||
|
}
|
||||||
|
supportsSignatureVerification() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
getToolcacheVersionName(version) {
|
||||||
|
if (!this.stable) {
|
||||||
|
if (version.includes('+')) {
|
||||||
|
return version.replace('+', '-ea.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return `${version}-ea`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Kotlin and some Java dependencies don't work properly when Java path contains "+" sign
|
||||||
|
// so replace "/hostedtoolcache/Java/11.0.3+4/x64" to "/hostedtoolcache/Java/11.0.3-4/x64" when saves to cache
|
||||||
|
// related issue: https://github.com/actions/virtual-environments/issues/3014
|
||||||
|
return version.replace('+', '-');
|
||||||
|
}
|
||||||
|
findInToolcache() {
|
||||||
|
// we can't use tc.find directly because firstly, we need to filter versions by stability flag
|
||||||
|
// if *-ea is provided, take only ea versions from toolcache, otherwise - only stable versions
|
||||||
|
const availableVersions = tool_cache/* findAllVersions */.iq(this.toolcacheFolderName, this.architecture)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item
|
||||||
|
.replace('-ea.', '+')
|
||||||
|
.replace(/-ea$/, '')
|
||||||
|
// Kotlin and some Java dependencies don't work properly when Java path contains "+" sign
|
||||||
|
// so replace "/hostedtoolcache/Java/11.0.3-4/x64" to "/hostedtoolcache/Java/11.0.3+4/x64" when retrieves to cache
|
||||||
|
// related issue: https://github.com/actions/virtual-environments/issues/3014
|
||||||
|
.replace('-', '+'),
|
||||||
|
path: (0,util/* getToolcachePath */.yH)(this.toolcacheFolderName, item, this.architecture) || '',
|
||||||
|
stable: !item.includes('-ea')
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(item => item.stable === this.stable);
|
||||||
|
const satisfiedVersions = availableVersions
|
||||||
|
.filter(item => (0,util/* isVersionSatisfies */.y)(this.version, item.version))
|
||||||
|
.filter(item => item.path)
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver_default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
if (!satisfiedVersions || satisfiedVersions.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
version: satisfiedVersions[0].version,
|
||||||
|
path: satisfiedVersions[0].path
|
||||||
|
};
|
||||||
|
}
|
||||||
|
normalizeVersion(version) {
|
||||||
|
let stable = true;
|
||||||
|
const latest = false;
|
||||||
|
// Support the `latest` alias (case-insensitive), which floats to the newest
|
||||||
|
// available stable/GA release. It is translated to the SemVer wildcard `x`
|
||||||
|
// so the existing "newest satisfying version wins" resolution applies.
|
||||||
|
const normalized = version.trim().toLowerCase();
|
||||||
|
if (normalized === 'latest') {
|
||||||
|
return {
|
||||||
|
version: 'x',
|
||||||
|
stable: true,
|
||||||
|
latest: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Reject `latest` combined with any qualifier (e.g. `latest-ea`). Such inputs
|
||||||
|
// would otherwise have their `-ea` suffix stripped and fall through to the
|
||||||
|
// generic SemVer check, which fails with a confusing "'latest' is not valid
|
||||||
|
// SemVer" message even though `latest` is a supported value. Fail early with a
|
||||||
|
// targeted explanation instead.
|
||||||
|
if (normalized.startsWith('latest')) {
|
||||||
|
throw new Error(`The 'latest' alias resolves stable (GA) releases only and cannot be combined with '-ea' or other qualifiers (received '${version}'). Use 'latest' on its own, or specify a concrete version.`);
|
||||||
|
}
|
||||||
|
if (version.endsWith('-ea')) {
|
||||||
|
version = version.replace(/-ea$/, '');
|
||||||
|
stable = false;
|
||||||
|
}
|
||||||
|
else if (version.includes('-ea.')) {
|
||||||
|
// transform '11.0.3-ea.2' -> '11.0.3+2'
|
||||||
|
version = version.replace('-ea.', '+');
|
||||||
|
stable = false;
|
||||||
|
}
|
||||||
|
// Java uses a versioning scheme (JEP 322) that can contain more numeric
|
||||||
|
// fields than SemVer allows, e.g. '18.0.1.1' or '11.0.9.1'. Convert such
|
||||||
|
// exact versions to SemVer build notation ('18.0.1+1') so they are
|
||||||
|
// accepted. Ranges and versions that already carry build metadata are
|
||||||
|
// left untouched.
|
||||||
|
if (/^\d+(\.\d+){3,}$/.test(version)) {
|
||||||
|
version = (0,util/* convertVersionToSemver */.ZY)(version);
|
||||||
|
}
|
||||||
|
if (!semver_default().validRange(version)) {
|
||||||
|
throw new Error(`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
version,
|
||||||
|
stable,
|
||||||
|
latest
|
||||||
|
};
|
||||||
|
}
|
||||||
|
createVersionNotFoundError(versionOrRange, availableVersions, additionalContext) {
|
||||||
|
const parts = [
|
||||||
|
`No matching version found for SemVer '${versionOrRange}'.`,
|
||||||
|
`Distribution: ${this.distribution}`,
|
||||||
|
`Package type: ${this.packageType}`,
|
||||||
|
`Architecture: ${this.architecture}`
|
||||||
|
];
|
||||||
|
// Add additional context if provided (e.g., platform/OS info)
|
||||||
|
if (additionalContext) {
|
||||||
|
parts.push(additionalContext);
|
||||||
|
}
|
||||||
|
if (availableVersions && availableVersions.length > 0) {
|
||||||
|
const maxVersionsToShow = core/* isDebug */._o() ? availableVersions.length : 50;
|
||||||
|
const versionsToShow = availableVersions.slice(0, maxVersionsToShow);
|
||||||
|
const truncated = availableVersions.length > maxVersionsToShow;
|
||||||
|
parts.push(`Available versions: ${versionsToShow.join(', ')}${truncated ? ', ...' : ''}`);
|
||||||
|
if (truncated) {
|
||||||
|
parts.push(`(showing first ${maxVersionsToShow} of ${availableVersions.length} versions, enable debug mode to see all)`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const error = new Error(parts.join('\n'));
|
||||||
|
error.name = 'VersionNotFoundError';
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
setJavaDefault(version, toolPath) {
|
||||||
|
core/* exportVariable */.dN('JAVA_HOME', toolPath);
|
||||||
|
core/* addPath */.fM(external_path_default().join(toolPath, 'bin'));
|
||||||
|
this.setJavaEnvironment(version, toolPath);
|
||||||
|
}
|
||||||
|
setJavaEnvironment(version, toolPath) {
|
||||||
|
const majorVersion = version.split('.')[0];
|
||||||
|
core/* setOutput */.uH('distribution', this.distribution);
|
||||||
|
core/* setOutput */.uH('path', toolPath);
|
||||||
|
core/* setOutput */.uH('version', version);
|
||||||
|
core/* exportVariable */.dN(`JAVA_HOME_${majorVersion}_${this.architecture.toUpperCase()}`, toolPath);
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
return this.architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+206
@@ -0,0 +1,206 @@
|
|||||||
|
export const id = 282;
|
||||||
|
export const ids = [282];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 2282:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ JetBrainsDistribution: () => (/* binding */ JetBrainsDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4942);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class JetBrainsDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('JetBrains', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
const versionsRaw = await this.getAvailableVersions();
|
||||||
|
const versions = versionsRaw.map(v => {
|
||||||
|
const formattedVersion = `${v.semver}+${v.build}`;
|
||||||
|
return {
|
||||||
|
version: formattedVersion,
|
||||||
|
url: v.url
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = versions
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(range, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver__WEBPACK_IMPORTED_MODULE_4___default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = versionsRaw.map(item => `${item.tag_name} (${item.semver}+${item.build})`);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...resolvedFullVersion,
|
||||||
|
// JetBrains' `.checksum` sibling doesn't disclose its algorithm via the
|
||||||
|
// filename, and older JBR builds (e.g. JBR 11) publish a SHA-256 digest
|
||||||
|
// there while newer builds publish SHA-512. Accept either, preferring
|
||||||
|
// the stronger SHA-512 when the digest length is ambiguous.
|
||||||
|
checksum: await this.fetchChecksum(`${resolvedFullVersion.url}.checksum`, ['sha512', 'sha256'])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
const javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, 'tar.gz');
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for JBR took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
// need to iterate through all pages to retrieve the list of all versions
|
||||||
|
// GitHub API doesn't provide way to retrieve the count of pages to iterate so infinity loop
|
||||||
|
let page_index = 1;
|
||||||
|
const rawVersions = [];
|
||||||
|
const bearerToken = process.env.GITHUB_TOKEN;
|
||||||
|
while (true) {
|
||||||
|
const requestArguments = `per_page=100&page=${page_index}`;
|
||||||
|
const requestHeaders = {};
|
||||||
|
if (bearerToken) {
|
||||||
|
requestHeaders['Authorization'] = `Bearer ${bearerToken}`;
|
||||||
|
}
|
||||||
|
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o() && page_index === 1) {
|
||||||
|
// url is identical except page_index so print it once for debug
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Gathering available versions from '${rawUrl}'`);
|
||||||
|
}
|
||||||
|
const paginationPageResult = (await this.http.getJson(rawUrl, requestHeaders)).result;
|
||||||
|
if (!paginationPageResult || paginationPageResult.length === 0) {
|
||||||
|
// break infinity loop because we have reached end of pagination
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const paginationPage = paginationPageResult.filter(version => this.stable ? !version.prerelease : version.prerelease);
|
||||||
|
if (!paginationPage || paginationPage.length === 0) {
|
||||||
|
// break infinity loop because we have reached end of pagination
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rawVersions.push(...paginationPage);
|
||||||
|
page_index++;
|
||||||
|
}
|
||||||
|
if (this.stable) {
|
||||||
|
// Add versions not available from the API but are downloadable
|
||||||
|
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||||
|
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag, prerelease: false })));
|
||||||
|
}
|
||||||
|
const versions0 = rawVersions.map(async (v) => {
|
||||||
|
// Release tags look like one of these:
|
||||||
|
// jbr-release-21.0.3b465.3
|
||||||
|
// jbr17-b87.7
|
||||||
|
// jb11_0_11-b87.7
|
||||||
|
// jbr11_0_15b2043.56
|
||||||
|
// 11_0_11b1536.2
|
||||||
|
// 11_0_11-b1522
|
||||||
|
const tag = v.tag_name;
|
||||||
|
// Extract version string
|
||||||
|
const vstring = tag
|
||||||
|
.replace('jbr-release-', '')
|
||||||
|
.replace('jbr', '')
|
||||||
|
.replace('jb', '')
|
||||||
|
.replace('-', '');
|
||||||
|
const vsplit = vstring.split('b');
|
||||||
|
let semver = vsplit[0];
|
||||||
|
const build = vsplit[1];
|
||||||
|
// Normalize semver
|
||||||
|
if (!semver.includes('.') && !semver.includes('_'))
|
||||||
|
semver = `${semver}.0.0`;
|
||||||
|
// Construct URL
|
||||||
|
let type;
|
||||||
|
switch (this.packageType ?? '') {
|
||||||
|
case 'jre':
|
||||||
|
type = 'jbr';
|
||||||
|
break;
|
||||||
|
case 'jdk+jcef':
|
||||||
|
type = 'jbrsdk_jcef';
|
||||||
|
break;
|
||||||
|
case 'jre+jcef':
|
||||||
|
type = 'jbr_jcef';
|
||||||
|
break;
|
||||||
|
case 'jdk+ft':
|
||||||
|
type = 'jbrsdk_ft';
|
||||||
|
break;
|
||||||
|
case 'jre+ft':
|
||||||
|
type = 'jbr_ft';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = 'jbrsdk';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let url = `https://cache-redirector.jetbrains.com/intellij-jbr/${type}-${semver}-${platform}-${arch}-b${build}.tar.gz`;
|
||||||
|
let include = false;
|
||||||
|
const res = await this.http.head(url);
|
||||||
|
if (res.message.statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_7__/* .HttpCodes */ .Hv.OK) {
|
||||||
|
include = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url = `https://cache-redirector.jetbrains.com/intellij-jbr/${type}_nomod-${semver}-${platform}-${arch}-b${build}.tar.gz`;
|
||||||
|
const res2 = await this.http.head(url);
|
||||||
|
if (res2.message.statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_7__/* .HttpCodes */ .Hv.OK) {
|
||||||
|
include = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const version = {
|
||||||
|
tag_name: tag,
|
||||||
|
semver: semver.replace(/_/g, '.'),
|
||||||
|
build: build,
|
||||||
|
url: url
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
item: version,
|
||||||
|
include: include
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const versions = await Promise.all(versions0).then(res => res.filter(item => item.include).map(item => item.item));
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for JBR took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Available versions: [${versions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(versions.map(item => item.semver).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return versions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Jetbrains has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'osx';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+356
@@ -0,0 +1,356 @@
|
|||||||
|
export const id = 377;
|
||||||
|
export const ids = [377];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 7377:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ restore: () => (/* binding */ restore)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* unused harmony export save */
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(857);
|
||||||
|
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5767);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_glob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2377);
|
||||||
|
/**
|
||||||
|
* @fileoverview this file provides methods handling dependency cache
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const STATE_CACHE_PRIMARY_KEY = 'cache-primary-key';
|
||||||
|
const STATE_CACHE_PATHS = 'cache-paths';
|
||||||
|
const CACHE_MATCHED_KEY = 'cache-matched-key';
|
||||||
|
const CACHE_KEY_PREFIX = 'setup-java';
|
||||||
|
const supportedPackageManager = [
|
||||||
|
{
|
||||||
|
id: 'maven',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.m2', 'repository')],
|
||||||
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
||||||
|
pattern: [
|
||||||
|
'**/pom.xml',
|
||||||
|
'**/.mvn/wrapper/maven-wrapper.properties',
|
||||||
|
'**/.mvn/extensions.xml'
|
||||||
|
],
|
||||||
|
// The Maven wrapper distribution only depends on the wrapper properties,
|
||||||
|
// which change very rarely, so it is cached separately from the local
|
||||||
|
// repository. This keeps it available across the frequent pom.xml changes
|
||||||
|
// that rotate the main cache key. See issue #1095.
|
||||||
|
additionalCaches: [
|
||||||
|
{
|
||||||
|
name: 'maven-wrapper',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.m2', 'wrapper', 'dists')],
|
||||||
|
pattern: ['**/.mvn/wrapper/maven-wrapper.properties']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'gradle',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.gradle', 'caches')],
|
||||||
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
|
||||||
|
pattern: [
|
||||||
|
'**/*.gradle*',
|
||||||
|
'**/gradle-wrapper.properties',
|
||||||
|
'buildSrc/**/Versions.kt',
|
||||||
|
'buildSrc/**/Dependencies.kt',
|
||||||
|
'gradle/*.versions.toml',
|
||||||
|
'**/versions.properties'
|
||||||
|
],
|
||||||
|
// The Gradle wrapper distribution only depends on the wrapper properties,
|
||||||
|
// which change very rarely, so it is cached separately from the Gradle
|
||||||
|
// caches. This keeps it available across the frequent *.gradle* changes
|
||||||
|
// that rotate the main cache key. See issue #269.
|
||||||
|
additionalCaches: [
|
||||||
|
{
|
||||||
|
name: 'gradle-wrapper',
|
||||||
|
path: [(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.gradle', 'wrapper')],
|
||||||
|
pattern: ['**/gradle-wrapper.properties']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sbt',
|
||||||
|
path: [
|
||||||
|
(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.ivy2', 'cache'),
|
||||||
|
(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.sbt'),
|
||||||
|
getCoursierCachePath(),
|
||||||
|
// Some files should not be cached to avoid resolution problems.
|
||||||
|
// In particular the resolution of snapshots (ideological gap between maven/ivy).
|
||||||
|
'!' + (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.sbt', '*.lock'),
|
||||||
|
'!' + (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '**', 'ivydata-*.properties')
|
||||||
|
],
|
||||||
|
pattern: [
|
||||||
|
'**/*.sbt',
|
||||||
|
'**/project/build.properties',
|
||||||
|
'**/project/**.scala',
|
||||||
|
'**/project/**.sbt'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
function getCoursierCachePath() {
|
||||||
|
if (os__WEBPACK_IMPORTED_MODULE_1___default().type() === 'Linux')
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), '.cache', 'coursier');
|
||||||
|
if (os__WEBPACK_IMPORTED_MODULE_1___default().type() === 'Darwin')
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), 'Library', 'Caches', 'Coursier');
|
||||||
|
return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(os__WEBPACK_IMPORTED_MODULE_1___default().homedir(), 'AppData', 'Local', 'Coursier', 'Cache');
|
||||||
|
}
|
||||||
|
function findPackageManager(id) {
|
||||||
|
const packageManager = supportedPackageManager.find(packageManager => packageManager.id === id);
|
||||||
|
if (packageManager === undefined) {
|
||||||
|
throw new Error(`unknown package manager specified: ${id}`);
|
||||||
|
}
|
||||||
|
return packageManager;
|
||||||
|
}
|
||||||
|
function resolveCachePaths(packageManager, cachePaths) {
|
||||||
|
return cachePaths.length > 0 ? cachePaths : packageManager.path;
|
||||||
|
}
|
||||||
|
function getCachePathsFromState(packageManager) {
|
||||||
|
const cachePathsState = core.getState(STATE_CACHE_PATHS);
|
||||||
|
if (!cachePathsState) {
|
||||||
|
return packageManager.path;
|
||||||
|
}
|
||||||
|
const cachePaths = JSON.parse(cachePathsState);
|
||||||
|
if (!Array.isArray(cachePaths) ||
|
||||||
|
!cachePaths.every(cachePath => typeof cachePath === 'string')) {
|
||||||
|
throw new Error('Invalid cache paths retrieved from state.');
|
||||||
|
}
|
||||||
|
return cachePaths;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* State keys used to carry an additional cache's restore-time information over
|
||||||
|
* to the post (save) action, scoped by the additional cache name.
|
||||||
|
*/
|
||||||
|
function additionalCachePrimaryKeyState(name) {
|
||||||
|
return `${STATE_CACHE_PRIMARY_KEY}-${name}`;
|
||||||
|
}
|
||||||
|
function additionalCacheMatchedKeyState(name) {
|
||||||
|
return `${CACHE_MATCHED_KEY}-${name}`;
|
||||||
|
}
|
||||||
|
function buildCacheKey(id, fileHash) {
|
||||||
|
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${id}-${fileHash}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A function that generates a cache key to use.
|
||||||
|
* Format of the generated key will be "${{ platform }}-${{ id }}-${{ fileHash }}"".
|
||||||
|
* @see {@link https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key|spec of cache key}
|
||||||
|
*/
|
||||||
|
async function computeCacheKey(packageManager, cacheDependencyPath) {
|
||||||
|
const pattern = cacheDependencyPath
|
||||||
|
? cacheDependencyPath.trim().split('\n')
|
||||||
|
: packageManager.pattern;
|
||||||
|
const fileHash = await _actions_glob__WEBPACK_IMPORTED_MODULE_4__/* .hashFiles */ .y(pattern.join('\n'));
|
||||||
|
if (!fileHash) {
|
||||||
|
throw new Error(`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`);
|
||||||
|
}
|
||||||
|
return buildCacheKey(packageManager.id, fileHash);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Computes the cache key for an additional cache. Unlike {@link computeCacheKey}
|
||||||
|
* this returns undefined (instead of throwing) when no file matches the pattern,
|
||||||
|
* because additional caches are optional features that many projects do not use.
|
||||||
|
*/
|
||||||
|
async function computeAdditionalCacheKey(additionalCache) {
|
||||||
|
const fileHash = await _actions_glob__WEBPACK_IMPORTED_MODULE_4__/* .hashFiles */ .y(additionalCache.pattern.join('\n'));
|
||||||
|
if (!fileHash) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return buildCacheKey(additionalCache.name, fileHash);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Restore the dependency cache
|
||||||
|
* @param id ID of the package manager, should be "maven", "gradle", or "sbt"
|
||||||
|
* @param cacheDependencyPath The path to a dependency file
|
||||||
|
* @param cachePaths Paths to cache instead of the package manager defaults
|
||||||
|
*/
|
||||||
|
async function restore(id, cacheDependencyPath, cachePaths = []) {
|
||||||
|
const packageManager = findPackageManager(id);
|
||||||
|
const resolvedCachePaths = resolveCachePaths(packageManager, cachePaths);
|
||||||
|
const [primaryKey, preparedAdditionalCaches] = await Promise.all([
|
||||||
|
computeCacheKey(packageManager, cacheDependencyPath),
|
||||||
|
prepareAdditionalCaches(packageManager.additionalCaches ?? [])
|
||||||
|
]);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`primary key is ${primaryKey}`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .saveState */ .LZ(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .saveState */ .LZ(STATE_CACHE_PATHS, JSON.stringify(resolvedCachePaths));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .setOutput */ .uH(STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
|
for (const preparedCache of preparedAdditionalCaches) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`${preparedCache.cache.name} primary key is ${preparedCache.primaryKey}`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .saveState */ .LZ(additionalCachePrimaryKeyState(preparedCache.cache.name), preparedCache.primaryKey);
|
||||||
|
}
|
||||||
|
await Promise.all([
|
||||||
|
restorePrimaryCache(packageManager, resolvedCachePaths, primaryKey),
|
||||||
|
...preparedAdditionalCaches.map(preparedCache => restoreAdditionalCache(preparedCache))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
async function restorePrimaryCache(packageManager, cachePaths, primaryKey) {
|
||||||
|
// No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269)
|
||||||
|
const matchedKey = await _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .restoreCache */ .P3(cachePaths, primaryKey);
|
||||||
|
if (matchedKey) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .saveState */ .LZ(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .setOutput */ .uH('cache-hit', matchedKey === primaryKey);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Cache restored from key: ${matchedKey}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .setOutput */ .uH('cache-hit', false);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`${packageManager.id} cache is not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compute keys for additional caches (e.g. build-tool wrapper distributions).
|
||||||
|
* Additional caches without a matching configuration file are omitted.
|
||||||
|
*/
|
||||||
|
async function prepareAdditionalCaches(additionalCaches) {
|
||||||
|
const preparedCaches = await Promise.all(additionalCaches.map(async (additionalCache) => {
|
||||||
|
const primaryKey = await computeAdditionalCacheKey(additionalCache);
|
||||||
|
if (!primaryKey) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`No file matched [${additionalCache.pattern}] for the ${additionalCache.name} cache, skipping.`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return { cache: additionalCache, primaryKey };
|
||||||
|
}));
|
||||||
|
return preparedCaches.filter((preparedCache) => preparedCache !== undefined);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Restore an additional cache keyed independently of the main dependency cache.
|
||||||
|
*/
|
||||||
|
async function restoreAdditionalCache(preparedCache) {
|
||||||
|
const { cache: additionalCache, primaryKey } = preparedCache;
|
||||||
|
const matchedKey = await _actions_cache__WEBPACK_IMPORTED_MODULE_2__/* .restoreCache */ .P3(additionalCache.path, primaryKey);
|
||||||
|
if (matchedKey) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .saveState */ .LZ(additionalCacheMatchedKeyState(additionalCache.name), matchedKey);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`${additionalCache.name} cache restored from key: ${matchedKey}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`${additionalCache.name} cache is not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Save the dependency cache
|
||||||
|
* @param id ID of the package manager, should be "maven" or "gradle"
|
||||||
|
*/
|
||||||
|
async function save(id) {
|
||||||
|
const packageManager = findPackageManager(id);
|
||||||
|
const cachePaths = getCachePathsFromState(packageManager);
|
||||||
|
const matchedKey = core.getState(CACHE_MATCHED_KEY);
|
||||||
|
// Inputs are re-evaluated before the post action, so we want the original key used for restore
|
||||||
|
const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
|
||||||
|
for (const additionalCache of packageManager.additionalCaches ?? []) {
|
||||||
|
try {
|
||||||
|
await saveAdditionalCache(packageManager, additionalCache);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
core.warning(`Failed to save ${additionalCache.name} cache: ${err.message}. Continuing with primary cache save.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!primaryKey) {
|
||||||
|
core.warning('Error retrieving key from state.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (matchedKey === primaryKey) {
|
||||||
|
// no change in target directories
|
||||||
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const cacheId = await cache.saveCache(cachePaths, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
// saveCache returns -1 without throwing when the cache was not saved,
|
||||||
|
// e.g. a reserve collision or a read-only token (fork PR). @actions/cache
|
||||||
|
// has already logged the reason at the appropriate severity, so just
|
||||||
|
// trace it instead of misreporting that the cache was saved.
|
||||||
|
core.debug(`Cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
if (err.name === cache.ReserveCacheError.name) {
|
||||||
|
core.info(err.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isProbablyGradleDaemonProblem(packageManager, err)) {
|
||||||
|
core.warning('Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for details.');
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Save an additional cache under its own key. Skips when no key was recorded at
|
||||||
|
* restore time (feature unused) or when the exact key was already restored.
|
||||||
|
*/
|
||||||
|
async function saveAdditionalCache(packageManager, additionalCache) {
|
||||||
|
const primaryKey = core.getState(additionalCachePrimaryKeyState(additionalCache.name));
|
||||||
|
const matchedKey = core.getState(additionalCacheMatchedKeyState(additionalCache.name));
|
||||||
|
if (!primaryKey) {
|
||||||
|
// The feature is not used by this project, nothing to save.
|
||||||
|
core.debug(`No primary key for the ${additionalCache.name} cache, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (matchedKey === primaryKey) {
|
||||||
|
core.info(`Cache hit occurred on the ${additionalCache.name} primary key ${primaryKey}, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const globber = await glob.create(additionalCache.path.join('\n'), {
|
||||||
|
implicitDescendants: false
|
||||||
|
});
|
||||||
|
const cachePaths = await globber.glob();
|
||||||
|
if (cachePaths.length === 0) {
|
||||||
|
core.debug(`${additionalCache.name} cache paths do not exist, not saving cache.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const cacheId = await cache.saveCache(cachePaths, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
core.debug(`${additionalCache.name} cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
core.info(`${additionalCache.name} cache saved with the key: ${primaryKey}`);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
if (err.name === cache.ValidationError.name) {
|
||||||
|
// The cache paths did not resolve, e.g. the wrapper distribution was
|
||||||
|
// never downloaded because a system build tool was used or the download
|
||||||
|
// failed. Optional wrapper caches must not fail the post step, so skip.
|
||||||
|
core.debug(`${additionalCache.name} cache paths do not exist, not saving cache: ${err.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.name === cache.ReserveCacheError.name) {
|
||||||
|
core.info(err.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isProbablyGradleDaemonProblem(packageManager, err)) {
|
||||||
|
core.warning(`Failed to save ${additionalCache.name} cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with \`--no-daemon\` option. Refer to https://github.com/actions/cache/issues/454 for details.`);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param packageManager the specified package manager by user
|
||||||
|
* @param error the error thrown by the saveCache
|
||||||
|
* @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
|
||||||
|
* @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
|
||||||
|
*/
|
||||||
|
function isProbablyGradleDaemonProblem(packageManager, error) {
|
||||||
|
if (packageManager.id !== 'gradle' ||
|
||||||
|
process.env['RUNNER_OS'] !== 'Windows') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const message = error.message || '';
|
||||||
|
return message.startsWith('Tar failed with error: ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
export const id = 394;
|
||||||
|
export const ids = [394];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 1394:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ isCacheFeatureAvailable: () => (/* binding */ isCacheFeatureAvailable)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5767);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function isCacheFeatureAvailable() {
|
||||||
|
if (_actions_cache__WEBPACK_IMPORTED_MODULE_0__/* .isFeatureAvailable */ .w3()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .isGhes */ .aT)()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .warning */ .$e('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;
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_1__/* .warning */ .$e('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+269
@@ -0,0 +1,269 @@
|
|||||||
|
export const id = 463;
|
||||||
|
export const ids = [463];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 463:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
|
||||||
|
// EXPORTS
|
||||||
|
__webpack_require__.d(__webpack_exports__, {
|
||||||
|
TemurinDistribution: () => (/* binding */ TemurinDistribution),
|
||||||
|
TemurinImplementation: () => (/* binding */ TemurinImplementation)
|
||||||
|
});
|
||||||
|
|
||||||
|
// UNUSED EXPORTS: ADOPTIUM_PUBLIC_KEY
|
||||||
|
|
||||||
|
// 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_);
|
||||||
|
// EXTERNAL MODULE: ./node_modules/semver/index.js
|
||||||
|
var semver = __webpack_require__(2088);
|
||||||
|
var semver_default = /*#__PURE__*/__webpack_require__.n(semver);
|
||||||
|
// EXTERNAL MODULE: ./src/gpg.ts
|
||||||
|
var gpg = __webpack_require__(8343);
|
||||||
|
;// CONCATENATED MODULE: ./src/distributions/temurin/adoptium-key.ts
|
||||||
|
// Adoptium GPG signing key (fingerprint: 3B04D753C9050D9A5D343F39843C48A565F8F04B)
|
||||||
|
// Retrieved from: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B04D753C9050D9A5D343F39843C48A565F8F04B
|
||||||
|
const ADOPTIUM_PUBLIC_KEY = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
xsBNBGGTvTQBCAC6ey144n7CG8foafF6mwgIBN1fIm1ILZDuGS4tMr0/XI8pgJnT
|
||||||
|
QvsPxZWEvtSm7bEMObzEoZJcXwjBcJl1B0ui8k5kHMTI75gCmZPsoKLFWIEpuRBQ
|
||||||
|
PBocusw80apDmLnNDQLVQvDFtEua5gaNa/fRw9YsmBoXBqvgrjFUIdGyWoQvH5+a
|
||||||
|
9OYlWD9n5VV0gnVMb+aclwVzB/zJw3kHGSgzuMtlAHeQiah7Y8yomQn/UIX8yqDf
|
||||||
|
+11sP3+c87YcjkRqImRTtmKEDcEtGPAIXC6SYA+uEEkbYE0Fy0chkvtnVWJ597fa
|
||||||
|
Epai4rnICU8zoJ6X5z3v1aM2WerhX9oq9X8PABEBAAHNQEFkb3B0aXVtIEdQRyBL
|
||||||
|
ZXkgKERFQi9SUE0gU2lnbmluZyBLZXkpIDx0ZW11cmluLWRldkBlY2xpcHNlLm9y
|
||||||
|
Zz7CwJIEEwEIADwWIQQ7BNdTyQUNml00PzmEPEilZfjwSwUCYZO9NAIbAwULCQgH
|
||||||
|
AgMiAgEGFQoJCAsCBBYCAwECHgcCF4AACgkQhDxIpWX48Et4AggAjjJzYWuKV3nG
|
||||||
|
7ngInngl8G/m9JoHr7BmwgcQXYhdy5hVkMcUx5JLeXz2LMBUH/F2nD595hgjMabk
|
||||||
|
kVib20X8lq9RsNbdfc2hBcWU6qyHKxsIqT4boI2/XDyEzzMyyZWWNGo/27Ci7Xmj
|
||||||
|
pWu31nh0pDdPqdyWDIKojbVVnxlCRY8as8Sm+1ufi709KCi4MuwHNsUlCSwb/fju
|
||||||
|
NKeHkrHbLcHKUUIEcmTSKRWrpMYBzm1HYOGBz4xPuELwUfUp71ehfoyBZlp6RDRf
|
||||||
|
l5TYI1FmCyHuvjNhrJgWv7bOTcf8yObGY+TEUhzc4xQqCrF4ur9d3opvsuPBQsv+
|
||||||
|
Klqi5KSZgs7ATQRhk700AQgAq14okly8cFrpYVenEQPiB75AUZfKRpMduiR6IxAj
|
||||||
|
SKcH7aSoFZ9AubUEBVpZsyT5svxoEPe1i4TdbF+m9FGy42EcOlLa3ArLTj5H8FRl
|
||||||
|
UdGZB9I5mk4GptOzPM+aHMMu92vW/ZwjuS8DvOiQSp+cUmG1EqOMJSM7e/4BM71z
|
||||||
|
E+OKaVJCj79pEzhG3SK/IC/OlxxyETT66NSfYJd7Sw5R6Vr19am/uNU690W0CJ+q
|
||||||
|
VQeFpmDMr7LnfdFRIh+lJe05+PvWXeidkGjox5cbG52wf8aRIR/FgkfcFvqRMN1f
|
||||||
|
B+dVOWueloUeVAnzcUznOKmUEs7LP9ObJhYHHgup4IAU2wARAQABwsB2BBgBCAAg
|
||||||
|
FiEEOwTXU8kFDZpdND85hDxIpWX48EsFAmGTvTQCGwwACgkQhDxIpWX48EvXHQf/
|
||||||
|
Q0nZsGDXnZHiBoojeSdpkO7WBjMIP3w1GdLvRpPQrS8TfOPbZuoevzCNh38Y3gwF
|
||||||
|
yelJspvzDQrBXhgkzAGlucYg8Y7KHa5Ebm7iDgMzc37L1hYSZTYCqwd7aowfgy34
|
||||||
|
hOk3B67LffkJpIh738Oa9CtlwxQ9xcytmBmQ1fBBOwm/9IhAwHPQuydYIs4DxWbj
|
||||||
|
0MGSP4fDntU7e4UjsHNmhudDcYol0FaqdHHIIB9C/G4CzetRwHFOn3b4JwXMU7YU
|
||||||
|
6aJA3mXhi3hggMC3wkT2HHZ/TquuOdNc02fypWOCDOHz0alBBJNqoVUNFNqU3tfJ
|
||||||
|
wI4qF/KKq9BfyfucAs0ykA==
|
||||||
|
=XLag
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./src/distributions/base-installer.ts + 2 modules
|
||||||
|
var base_installer = __webpack_require__(6242);
|
||||||
|
// EXTERNAL MODULE: ./src/constants.ts
|
||||||
|
var constants = __webpack_require__(7242);
|
||||||
|
// EXTERNAL MODULE: ./src/util.ts
|
||||||
|
var util = __webpack_require__(4527);
|
||||||
|
;// CONCATENATED MODULE: ./src/distributions/temurin/installer.ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var TemurinImplementation;
|
||||||
|
(function (TemurinImplementation) {
|
||||||
|
TemurinImplementation["Hotspot"] = "Hotspot";
|
||||||
|
})(TemurinImplementation || (TemurinImplementation = {}));
|
||||||
|
class TemurinDistribution extends base_installer/* JavaBase */.O {
|
||||||
|
jvmImpl;
|
||||||
|
includeJmods;
|
||||||
|
constructor(installerOptions, jvmImpl) {
|
||||||
|
super(`Temurin-${jvmImpl}`, installerOptions);
|
||||||
|
this.jvmImpl = jvmImpl;
|
||||||
|
this.includeJmods = this.packageType === 'jdk+jmods';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal For cross-distribution reuse only. Not intended as a public API.
|
||||||
|
*/
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
return this.resolvePackage(version, this.includeJmods ? 'jdk' : this.packageType);
|
||||||
|
}
|
||||||
|
async resolvePackage(version, imageType) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions(imageType);
|
||||||
|
const availableVersionsWithBinaries = availableVersionsRaw
|
||||||
|
.filter(item => item.binaries.length > 0)
|
||||||
|
.map(item => {
|
||||||
|
// normalize 17.0.0-beta+33.0.202107301459 to 17.0.0+33.0.202107301459 for earlier access versions
|
||||||
|
const formattedVersion = this.stable
|
||||||
|
? item.version_data.semver
|
||||||
|
: item.version_data.semver.replace('-beta+', '+');
|
||||||
|
return {
|
||||||
|
version: formattedVersion,
|
||||||
|
url: item.binaries[0].package.link,
|
||||||
|
signatureUrl: item.binaries[0].package.signature_link,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.binaries[0].package.checksum,
|
||||||
|
source: item.binaries[0].package.checksum_link
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = availableVersionsWithBinaries
|
||||||
|
.filter(item => (0,util/* isVersionSatisfies */.y)(version, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver_default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return resolvedFullVersion;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
core/* info */.pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadPackage(javaRelease);
|
||||||
|
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 javaHome = process.platform === 'darwin'
|
||||||
|
? external_path_default().join(archivePath, constants/* MACOS_JAVA_CONTENT_POSTFIX */.PG)
|
||||||
|
: archivePath;
|
||||||
|
if (this.includeJmods && !external_fs_default().existsSync(external_path_default().join(javaHome, 'jmods'))) {
|
||||||
|
await this.installJmods(javaRelease.version, javaHome);
|
||||||
|
}
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await tool_cache/* cacheDir */.e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
supportsSignatureVerification() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
async downloadPackage(release) {
|
||||||
|
const archivePath = await this.downloadAndVerify(release);
|
||||||
|
if (this.verifySignature) {
|
||||||
|
if (!release.signatureUrl) {
|
||||||
|
throw new Error(`Input 'verify-signature' is enabled, but no signature URL was found for Temurin version ${release.version}.`);
|
||||||
|
}
|
||||||
|
core/* info */.pq(`Verifying Java package signature...`);
|
||||||
|
try {
|
||||||
|
await gpg/* verifyPackageSignature */.Yi(archivePath, release.signatureUrl, this.verifySignaturePublicKey ?? ADOPTIUM_PUBLIC_KEY);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw new Error(`Failed to verify signature for Temurin version ${release.version} from ${release.signatureUrl}: ${error.message}`, { cause: error });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return archivePath;
|
||||||
|
}
|
||||||
|
async installJmods(version, javaHome) {
|
||||||
|
const jmodsRelease = await this.resolvePackage(version, 'jmods');
|
||||||
|
core/* info */.pq(`Downloading JMODs ${jmodsRelease.version} (${this.distribution}) from ${jmodsRelease.url} ...`);
|
||||||
|
let jmodsArchivePath = await this.downloadPackage(jmodsRelease);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
jmodsArchivePath = (0,util/* renameWinArchive */.n2)(jmodsArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJmodsPath = await (0,util/* extractJdkFile */.PE)(jmodsArchivePath, (0,util/* getDownloadArchiveExtension */.ag)());
|
||||||
|
const jmodsDirectory = external_path_default().join(extractedJmodsPath, external_fs_default().readdirSync(extractedJmodsPath)[0]);
|
||||||
|
external_fs_default().cpSync(jmodsDirectory, external_path_default().join(javaHome, 'jmods'), { recursive: true });
|
||||||
|
}
|
||||||
|
async getAvailableVersions(imageType = this.includeJmods ? 'jdk' : this.packageType) {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
||||||
|
const releaseType = this.stable ? 'ga' : 'ea';
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
console.time('Retrieving available versions for Temurin took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const baseRequestArguments = [
|
||||||
|
`project=jdk`,
|
||||||
|
'vendor=adoptium',
|
||||||
|
`heap_size=normal`,
|
||||||
|
'sort_method=DEFAULT',
|
||||||
|
'sort_order=DESC',
|
||||||
|
`os=${platform}`,
|
||||||
|
`architecture=${arch}`,
|
||||||
|
`image_type=${imageType}`,
|
||||||
|
`release_type=${releaseType}`,
|
||||||
|
`jvm_impl=${this.jvmImpl.toLowerCase()}`
|
||||||
|
].join('&');
|
||||||
|
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||||
|
let availableVersionsUrl = `https://api.adoptium.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||||
|
const availableVersions = [];
|
||||||
|
let pageCount = 0;
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
core/* debug */.Yz(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
|
}
|
||||||
|
while (availableVersionsUrl) {
|
||||||
|
pageCount++;
|
||||||
|
const response = await this.http.getJson(availableVersionsUrl);
|
||||||
|
const paginationPage = response.result;
|
||||||
|
const nextUrl = (0,util/* getNextPageUrlFromLinkHeader */.rC)(response.headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0,util/* validatePaginationUrl */.SA)(nextUrl, 'https://api.adoptium.net')) {
|
||||||
|
core/* warning */.$e(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
availableVersionsUrl = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
availableVersionsUrl = nextUrl;
|
||||||
|
}
|
||||||
|
if (paginationPage === null || paginationPage.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
availableVersions.push(...paginationPage);
|
||||||
|
if (pageCount >= util/* MAX_PAGINATION_PAGES */.Tp) {
|
||||||
|
core/* warning */.$e(`Reached pagination safeguard limit (${util/* MAX_PAGINATION_PAGES */.Tp} pages) while listing Temurin releases.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
core/* startGroup */.Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Temurin took'); // eslint-disable-line no-console
|
||||||
|
core/* debug */.Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
core/* debug */.Yz(availableVersions.map(item => item.version_data.semver).join(', '));
|
||||||
|
core/* endGroup */.N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Adoptium has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'mac';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
if (external_fs_default().existsSync('/etc/alpine-release')) {
|
||||||
|
return 'alpine-linux';
|
||||||
|
}
|
||||||
|
return 'linux';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
const architecture = super.distributionArchitecture();
|
||||||
|
return architecture === 'armv7' ? 'arm' : architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+146
@@ -0,0 +1,146 @@
|
|||||||
|
export const id = 524;
|
||||||
|
export const ids = [524];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 8524:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ LibericaNikDistributions: () => (/* binding */ LibericaNikDistributions)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const supportedPlatform = `'linux', 'macos', 'windows'`;
|
||||||
|
const supportedArchitectures = `'x64', 'aarch64'`;
|
||||||
|
class LibericaNikDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_0__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Liberica_NIK', installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_5___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_6___default().join(extractedJavaPath, archiveName);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
const availableVersions = availableVersionsRaw
|
||||||
|
.map(item => {
|
||||||
|
const jdkVersion = this.getJdkVersion(item);
|
||||||
|
return jdkVersion ? { url: item.downloadUrl, version: jdkVersion } : null;
|
||||||
|
})
|
||||||
|
.filter((item) => item !== null);
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .isVersionSatisfies */ .y)(range, item.version))
|
||||||
|
.sort((a, b) => -semver__WEBPACK_IMPORTED_MODULE_1___default().compareBuild(a.version, b.version))[0];
|
||||||
|
if (!satisfiedVersion) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return satisfiedVersion;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const url = this.prepareAvailableVersionsUrl();
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Gathering available versions from '${url}'`);
|
||||||
|
const availableVersions = (await this.http.getJson(url)).result ?? [];
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Liberica NIK took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(availableVersions.map(item => item.version).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
prepareAvailableVersionsUrl() {
|
||||||
|
const urlOptions = {
|
||||||
|
os: this.getPlatformOption(),
|
||||||
|
'bundle-type': this.getBundleType(),
|
||||||
|
...this.getArchitectureOptions(),
|
||||||
|
'build-type': this.stable ? 'all' : 'ea',
|
||||||
|
'installation-type': 'archive',
|
||||||
|
fields: 'downloadUrl,version,components,component,embedded'
|
||||||
|
};
|
||||||
|
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||||
|
return `https://api.bell-sw.com/v1/nik/releases?${searchParams}`;
|
||||||
|
}
|
||||||
|
// NIK's top-level `version` is the GraalVM/NIK version; the JDK version that
|
||||||
|
// users select on lives in the embedded `liberica` component.
|
||||||
|
getJdkVersion(release) {
|
||||||
|
const liberica = release.components?.find(component => component.component === 'liberica');
|
||||||
|
return liberica ? this.convertVersionToSemver(liberica.version) : null;
|
||||||
|
}
|
||||||
|
// The `full` bundle adds JavaFX/Swing GUI support; otherwise use `standard`.
|
||||||
|
getBundleType() {
|
||||||
|
const [, feature] = this.packageType.split('+');
|
||||||
|
return feature?.includes('fx') ? 'full' : 'standard';
|
||||||
|
}
|
||||||
|
getArchitectureOptions() {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
return { bitness: '64', arch: 'x86' };
|
||||||
|
case 'aarch64':
|
||||||
|
return { bitness: '64', arch: 'arm' };
|
||||||
|
default:
|
||||||
|
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitectures}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getPlatformOption(platform = process.platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
case 'cygwin':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'linux';
|
||||||
|
default:
|
||||||
|
throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// JDK versions come as strings like '25.0.1+16', '23+38' or '11.0.15.1+2'.
|
||||||
|
// Normalize them to valid SemVer while preserving build metadata so newer
|
||||||
|
// NIK builds of the same JDK sort ahead of older ones.
|
||||||
|
convertVersionToSemver(jdkVersion) {
|
||||||
|
const [main, build] = jdkVersion.split('+');
|
||||||
|
const parts = main.split('.');
|
||||||
|
while (parts.length < 3) {
|
||||||
|
parts.push('0');
|
||||||
|
}
|
||||||
|
const base = parts.slice(0, 3).join('.');
|
||||||
|
const buildMeta = [...parts.slice(3), ...(build ? [build] : [])];
|
||||||
|
return buildMeta.length ? `${base}+${buildMeta.join('.')}` : base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+192
@@ -0,0 +1,192 @@
|
|||||||
|
export const id = 557;
|
||||||
|
export const ids = [557];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 7557:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ SapMachineDistribution: () => (/* binding */ SapMachineDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6242);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class SapMachineDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_6__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('SapMachine', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Only stable versions: ${this.stable}`);
|
||||||
|
if (!['jdk', 'jre'].includes(this.packageType)) {
|
||||||
|
throw new Error('SapMachine provides only the `jdk` and `jre` package type');
|
||||||
|
}
|
||||||
|
const availableVersions = await this.getAvailableVersions();
|
||||||
|
const matchedVersions = availableVersions
|
||||||
|
.filter(item => {
|
||||||
|
return (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .isVersionSatisfies */ .y)(version, item.version);
|
||||||
|
})
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.version,
|
||||||
|
url: item.downloadLink
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (!matchedVersions.length) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
const checksumUrl = resolvedVersion.url.replace(/\.(?:tar\.gz|zip)$/, '.sha256.txt');
|
||||||
|
return {
|
||||||
|
...resolvedVersion,
|
||||||
|
checksum: await this.fetchChecksum(checksumUrl, 'sha256')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
let fetchedReleasesJson = await this.fetchReleasesFromUrl('https://sapmachine.io/assets/data/sapmachine-releases-all.json');
|
||||||
|
if (!fetchedReleasesJson) {
|
||||||
|
fetchedReleasesJson = await this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json');
|
||||||
|
}
|
||||||
|
if (!fetchedReleasesJson) {
|
||||||
|
throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`);
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz('Successfully fetched information about available SapMachine versions');
|
||||||
|
const availableVersions = this.parseVersions(platform, arch, fetchedReleasesJson);
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableVersions.map(item => item.version).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_3___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_4___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
parseVersions(platform, arch, versions) {
|
||||||
|
const eligibleVersions = [];
|
||||||
|
for (const [, majorVersionMap] of Object.entries(versions)) {
|
||||||
|
for (const [, jdkVersionMap] of Object.entries(majorVersionMap.updates)) {
|
||||||
|
for (const [buildVersion, buildVersionMap] of Object.entries(jdkVersionMap)) {
|
||||||
|
let buildVersionWithoutPrefix = buildVersion.replace('sapmachine-', '');
|
||||||
|
if (!buildVersionWithoutPrefix.includes('.')) {
|
||||||
|
// replace major version with major.minor.patch and keep the remaining build identifier after the + as is with regex
|
||||||
|
buildVersionWithoutPrefix = buildVersionWithoutPrefix.replace(/(\d+)(\+.*)?/, '$1.0.0$2');
|
||||||
|
}
|
||||||
|
// replace + with . to convert to semver format if we have more than 3 version digits
|
||||||
|
if (buildVersionWithoutPrefix.split('.').length > 3) {
|
||||||
|
buildVersionWithoutPrefix = buildVersionWithoutPrefix.replace('+', '.');
|
||||||
|
}
|
||||||
|
buildVersionWithoutPrefix = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .convertVersionToSemver */ .ZY)(buildVersionWithoutPrefix);
|
||||||
|
// ignore invalid version
|
||||||
|
if (!semver__WEBPACK_IMPORTED_MODULE_2___default().valid(buildVersionWithoutPrefix)) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Invalid version: ${buildVersionWithoutPrefix}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// skip earlyAccessVersions if stable version requested
|
||||||
|
if (this.stable && buildVersionMap.ea === 'true') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const [edition, editionAssets] of Object.entries(buildVersionMap.assets)) {
|
||||||
|
if (this.packageType !== edition) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const [archAndPlatForm, archAssets] of Object.entries(editionAssets)) {
|
||||||
|
let expectedArchAndPlatform = `${platform}-${arch}`;
|
||||||
|
if (platform === 'linux-musl') {
|
||||||
|
expectedArchAndPlatform = `linux-${arch}-musl`;
|
||||||
|
}
|
||||||
|
if (archAndPlatForm !== expectedArchAndPlatform) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const [contentType, contentTypeAssets] of Object.entries(archAssets)) {
|
||||||
|
// skip if not tar.gz and zip files
|
||||||
|
if (contentType !== 'tar.gz' && contentType !== 'zip') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
eligibleVersions.push({
|
||||||
|
os: platform,
|
||||||
|
architecture: arch,
|
||||||
|
version: buildVersionWithoutPrefix,
|
||||||
|
checksum: contentTypeAssets.checksum,
|
||||||
|
downloadLink: contentTypeAssets.url,
|
||||||
|
packageType: edition
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const sortedVersions = this.sortParsedVersions(eligibleVersions);
|
||||||
|
return sortedVersions;
|
||||||
|
}
|
||||||
|
// Sorts versions in descending order as by default data in JSON isn't sorted
|
||||||
|
sortParsedVersions(eligibleVersions) {
|
||||||
|
const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => {
|
||||||
|
const version1 = versionObj1.version;
|
||||||
|
const version2 = versionObj2.version;
|
||||||
|
return semver__WEBPACK_IMPORTED_MODULE_2___default().compareBuild(version1, version2);
|
||||||
|
});
|
||||||
|
return sortedVersions.reverse();
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'linux':
|
||||||
|
// figure out if alpine/musl
|
||||||
|
if (fs__WEBPACK_IMPORTED_MODULE_3___default().existsSync('/etc/alpine-release')) {
|
||||||
|
return 'linux-musl';
|
||||||
|
}
|
||||||
|
return 'linux';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async fetchReleasesFromUrl(url, headers = {}) {
|
||||||
|
try {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Trying to fetch available SapMachine versions info from the primary url: ${url}`);
|
||||||
|
const releases = (await this.http.getJson(url, headers)).result;
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Fetching SapMachine versions info from the link: ${url} ended up with the error: ${err.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+152
@@ -0,0 +1,152 @@
|
|||||||
|
export const id = 63;
|
||||||
|
export const ids = [63];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 2063:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ LibericaDistributions: () => (/* binding */ LibericaDistributions)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
||||||
|
const supportedArchitectures = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
||||||
|
class LibericaDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_0__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Liberica', installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_5___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_6___default().join(extractedJavaPath, archiveName);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
const availableVersions = availableVersionsRaw.map(item => ({
|
||||||
|
url: item.downloadUrl,
|
||||||
|
version: this.convertVersionToSemver(item)
|
||||||
|
}));
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .isVersionSatisfies */ .y)(range, item.version))
|
||||||
|
.sort((a, b) => -semver__WEBPACK_IMPORTED_MODULE_1___default().compareBuild(a.version, b.version))[0];
|
||||||
|
if (!satisfiedVersion) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return satisfiedVersion;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Liberica took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const url = this.prepareAvailableVersionsUrl();
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Gathering available versions from '${url}'`);
|
||||||
|
const availableVersions = (await this.http.getJson(url)).result ?? [];
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Liberica took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(availableVersions.map(item => item.version).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
prepareAvailableVersionsUrl() {
|
||||||
|
const urlOptions = {
|
||||||
|
os: this.getPlatformOption(),
|
||||||
|
'bundle-type': this.getBundleType(),
|
||||||
|
...this.getArchitectureOptions(),
|
||||||
|
'build-type': this.stable ? 'all' : 'ea',
|
||||||
|
'installation-type': 'archive',
|
||||||
|
fields: 'downloadUrl,version,featureVersion,interimVersion,updateVersion,buildVersion'
|
||||||
|
};
|
||||||
|
const searchParams = new URLSearchParams(urlOptions).toString();
|
||||||
|
return `https://api.bell-sw.com/v1/liberica/releases?${searchParams}`;
|
||||||
|
}
|
||||||
|
getBundleType() {
|
||||||
|
const [bundleType, feature] = this.packageType.split('+');
|
||||||
|
if (feature?.includes('fx')) {
|
||||||
|
return bundleType + '-full';
|
||||||
|
}
|
||||||
|
return bundleType;
|
||||||
|
}
|
||||||
|
getArchitectureOptions() {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
|
case 'x86':
|
||||||
|
return { bitness: '32', arch: 'x86' };
|
||||||
|
case 'x64':
|
||||||
|
return { bitness: '64', arch: 'x86' };
|
||||||
|
case 'armv7':
|
||||||
|
return { bitness: '32', arch: 'arm' };
|
||||||
|
case 'aarch64':
|
||||||
|
return { bitness: '64', arch: 'arm' };
|
||||||
|
case 'ppc64le':
|
||||||
|
return { bitness: '64', arch: 'ppc' };
|
||||||
|
default:
|
||||||
|
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitectures}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getPlatformOption(platform = process.platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
case 'cygwin':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'linux';
|
||||||
|
case 'sunos':
|
||||||
|
return 'solaris';
|
||||||
|
default:
|
||||||
|
throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
convertVersionToSemver(version) {
|
||||||
|
const { buildVersion, featureVersion, interimVersion, updateVersion } = version;
|
||||||
|
const mainVersion = [featureVersion, interimVersion, updateVersion].join('.');
|
||||||
|
if (buildVersion != 0) {
|
||||||
|
return `${mainVersion}+${buildVersion}`;
|
||||||
|
}
|
||||||
|
return mainVersion;
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
const arch = super.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
|
case 'arm':
|
||||||
|
return 'armv7';
|
||||||
|
default:
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+188
@@ -0,0 +1,188 @@
|
|||||||
|
export const id = 675;
|
||||||
|
export const ids = [675];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 7675:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ DragonwellDistribution: () => (/* binding */ DragonwellDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DragonwellDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Dragonwell', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('Early access versions are not supported by Dragonwell');
|
||||||
|
}
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Dragonwell provides only the `jdk` package type');
|
||||||
|
}
|
||||||
|
const availableVersions = await this.getAvailableVersions();
|
||||||
|
const matchedVersions = availableVersions
|
||||||
|
.filter(item => {
|
||||||
|
return (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(version, item.jdk_version);
|
||||||
|
})
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.jdk_version,
|
||||||
|
url: item.download_link,
|
||||||
|
checksum: item.checksum
|
||||||
|
? {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.checksum
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (!matchedVersions.length) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.jdk_version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
return resolvedVersion;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
let fetchedDragonwellJson = await this.fetchJsonFromPrimaryUrl();
|
||||||
|
if (!fetchedDragonwellJson) {
|
||||||
|
fetchedDragonwellJson = await this.fetchJsonFromBackupUrl();
|
||||||
|
}
|
||||||
|
if (!fetchedDragonwellJson) {
|
||||||
|
throw new Error(`Couldn't fetch Dragonwell versions information from both primary and backup urls`);
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz('Successfully fetched information about available Dragonwell versions');
|
||||||
|
const availableVersions = this.parseVersions(platform, arch, fetchedDragonwellJson);
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableVersions.map(item => item.jdk_version).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_3___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_4___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
parseVersions(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') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits).
|
||||||
|
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
|
||||||
|
const jdkVersionNums = jdkVersion
|
||||||
|
.replace('+', '.')
|
||||||
|
.split('.');
|
||||||
|
jdkVersion = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(`${jdkVersionNums.slice(0, 3).join('.')}.${jdkVersionNums[jdkVersionNums.length - 1]}`);
|
||||||
|
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'
|
||||||
|
});
|
||||||
|
break; // Get the first available link to the JDK. In most cases it should point to the Extended version of JDK, in rare cases like with v17 it points to the Standard version (the only available).
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const sortedVersions = this.sortParsedVersions(eligibleVersions);
|
||||||
|
return sortedVersions;
|
||||||
|
}
|
||||||
|
// Sorts versions in descending order as by default data in JSON isn't sorted
|
||||||
|
sortParsedVersions(eligibleVersions) {
|
||||||
|
const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => {
|
||||||
|
const version1 = versionObj1.jdk_version;
|
||||||
|
const version2 = versionObj2.jdk_version;
|
||||||
|
return semver__WEBPACK_IMPORTED_MODULE_2___default().compareBuild(version1, version2);
|
||||||
|
});
|
||||||
|
return sortedVersions.reverse();
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async fetchJsonFromPrimaryUrl() {
|
||||||
|
const primaryUrl = 'https://dragonwell-jdk.io/map_with_checksum.json';
|
||||||
|
try {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Trying to fetch available Dragonwell versions info from the primary url: ${primaryUrl}`);
|
||||||
|
const fetchedDragonwellJson = (await this.http.getJson(primaryUrl)).result;
|
||||||
|
return fetchedDragonwellJson;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Fetching Dragonwell versions info from the primary link: ${primaryUrl} ended up with the error: ${err.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async fetchJsonFromBackupUrl() {
|
||||||
|
const owner = 'dragonwell-releng';
|
||||||
|
const repository = 'dragonwell-setup-java';
|
||||||
|
const branch = 'main';
|
||||||
|
const filePath = 'releases.json';
|
||||||
|
const backupUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
||||||
|
const headers = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getGitHubHttpHeaders */ .U_)();
|
||||||
|
try {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Trying to fetch available Dragonwell versions info from the backup url: ${backupUrl}`);
|
||||||
|
const fetchedDragonwellJson = (await this.http.getJson(backupUrl, headers)).result;
|
||||||
|
return fetchedDragonwellJson;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Fetching Dragonwell versions info from the backup url: ${backupUrl} ended up with the error: ${err.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+130
@@ -0,0 +1,130 @@
|
|||||||
|
export const id = 735;
|
||||||
|
export const ids = [735];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 3735:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ OpenJdkDistribution: () => (/* binding */ OpenJdkDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const OPENJDK_BASE_URL = 'https://jdk.java.net';
|
||||||
|
class OpenJdkDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Oracle OpenJDK', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Oracle OpenJDK provides only the `jdk` package type');
|
||||||
|
}
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
if (!['x64', 'aarch64'].includes(arch)) {
|
||||||
|
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
||||||
|
}
|
||||||
|
const platform = this.getPlatform();
|
||||||
|
const releases = await this.getAvailableVersions(platform, arch);
|
||||||
|
const matchingReleases = releases
|
||||||
|
.filter(release => (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(range, release.version))
|
||||||
|
.sort((left, right) => -semver__WEBPACK_IMPORTED_MODULE_4___default().compareBuild(left.version, right.version));
|
||||||
|
if (!matchingReleases.length) {
|
||||||
|
throw this.createVersionNotFoundError(range, releases.map(release => release.version), `Platform: ${platform}`);
|
||||||
|
}
|
||||||
|
const release = matchingReleases[0];
|
||||||
|
return {
|
||||||
|
...release,
|
||||||
|
checksum: await this.fetchChecksum(`${release.url}.sha256`, 'sha256')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = javaRelease.url.endsWith('.zip') ? 'zip' : 'tar.gz';
|
||||||
|
if (extension === 'zip') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async getAvailableVersions(platform, arch) {
|
||||||
|
const homePage = await this.fetchPage(`${OPENJDK_BASE_URL}/`);
|
||||||
|
const releasePageUrls = Array.from(homePage.matchAll(/href="\/(\d+)\/">JDK\s+\d+/g), match => `${OPENJDK_BASE_URL}/${match[1]}/`);
|
||||||
|
const pages = await Promise.all(releasePageUrls.map(url => this.fetchPage(url)));
|
||||||
|
if (this.stable) {
|
||||||
|
pages.push(await this.fetchPage(`${OPENJDK_BASE_URL}/archive/`));
|
||||||
|
}
|
||||||
|
const releases = pages.flatMap(page => this.parseReleases(page, platform, arch));
|
||||||
|
return releases.filter(release => release.url.includes('/early_access/') !== this.stable);
|
||||||
|
}
|
||||||
|
async fetchPage(url) {
|
||||||
|
const response = await this.http.get(url);
|
||||||
|
return response.readBody();
|
||||||
|
}
|
||||||
|
parseReleases(html, platform, arch) {
|
||||||
|
const platformPattern = platform === 'macos' ? '(?:macos|osx)' : platform;
|
||||||
|
const extensionPattern = platform === 'windows' ? '(?:zip|tar\\.gz)' : 'tar\\.gz';
|
||||||
|
const pattern = new RegExp(`href="(https://download\\.java\\.net/[^"]+/openjdk-([^"_]+)_${platformPattern}-${arch}_bin\\.${extensionPattern})"`, 'g');
|
||||||
|
return Array.from(html.matchAll(pattern), match => {
|
||||||
|
const url = match[1];
|
||||||
|
const build = url.match(/\/(\d+)\/(?:GPL\/)?openjdk-/)?.[1] ??
|
||||||
|
this.findBuildInArchiveHeading(html, match.index, match[2]);
|
||||||
|
return {
|
||||||
|
version: this.toSemver(match[2], build),
|
||||||
|
url
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
findBuildInArchiveHeading(html, assetIndex, version) {
|
||||||
|
const headings = Array.from(html.slice(0, assetIndex).matchAll(/\(build\s+([^)]+)\)/g));
|
||||||
|
const headingVersion = headings.at(-1)?.[1];
|
||||||
|
if (!headingVersion) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const [javaVersion, build] = headingVersion.split('+');
|
||||||
|
return javaVersion === version ? build : undefined;
|
||||||
|
}
|
||||||
|
toSemver(version, urlBuild) {
|
||||||
|
const [javaVersion, filenameBuild] = version.replace('-ea', '').split('+');
|
||||||
|
const versionParts = javaVersion.split('.');
|
||||||
|
const normalizedVersion = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(versionParts.length === 1 ? `${javaVersion}.0.0` : javaVersion);
|
||||||
|
const build = filenameBuild ?? (versionParts.length <= 3 ? urlBuild : undefined);
|
||||||
|
return build ? `${normalizedVersion}+${build}` : normalizedVersion;
|
||||||
|
}
|
||||||
|
getPlatform(platform = process.platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'linux':
|
||||||
|
return 'linux';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+62535
File diff suppressed because it is too large
Load Diff
Vendored
+471
@@ -0,0 +1,471 @@
|
|||||||
|
export const id = 874;
|
||||||
|
export const ids = [874,463];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 7874:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ AdoptDistribution: () => (/* binding */ AdoptDistribution),
|
||||||
|
/* harmony export */ AdoptImplementation: () => (/* binding */ AdoptImplementation)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _temurin_installer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(463);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var AdoptImplementation;
|
||||||
|
(function (AdoptImplementation) {
|
||||||
|
AdoptImplementation["Hotspot"] = "Hotspot";
|
||||||
|
AdoptImplementation["OpenJ9"] = "OpenJ9";
|
||||||
|
})(AdoptImplementation || (AdoptImplementation = {}));
|
||||||
|
class AdoptDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
jvmImpl;
|
||||||
|
temurinDistribution;
|
||||||
|
constructor(installerOptions, jvmImpl, temurinDistribution = null) {
|
||||||
|
super(`Adopt-${jvmImpl}`, installerOptions);
|
||||||
|
this.jvmImpl = jvmImpl;
|
||||||
|
if (temurinDistribution !== null &&
|
||||||
|
jvmImpl !== AdoptImplementation.Hotspot) {
|
||||||
|
throw new Error('Only Hotspot JVM is supported by Temurin.');
|
||||||
|
}
|
||||||
|
// Only use the temurin repo for Hotspot JVMs
|
||||||
|
this.temurinDistribution =
|
||||||
|
temurinDistribution ??
|
||||||
|
(jvmImpl === AdoptImplementation.Hotspot
|
||||||
|
? new _temurin_installer_js__WEBPACK_IMPORTED_MODULE_7__.TemurinDistribution(installerOptions, _temurin_installer_js__WEBPACK_IMPORTED_MODULE_7__.TemurinImplementation.Hotspot)
|
||||||
|
: null);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
if (this.jvmImpl === AdoptImplementation.Hotspot) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .notice */ .lm("AdoptOpenJDK has moved to Eclipse Temurin https://github.com/actions/setup-java#supported-distributions please consider changing to the 'temurin' distribution type in your setup-java configuration.");
|
||||||
|
}
|
||||||
|
if (this.jvmImpl === AdoptImplementation.Hotspot &&
|
||||||
|
this.temurinDistribution !== null) {
|
||||||
|
try {
|
||||||
|
return await this.temurinDistribution.findPackageForDownload(version);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// Log the failure but always fall back to legacy AdoptOpenJDK for resilience
|
||||||
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
|
if (error instanceof Error && error.name === 'VersionNotFoundError') {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .notice */ .lm('The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
|
||||||
|
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Log other errors for debugging but gracefully fall back
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Temurin lookup failed: ${errorMessage}. Falling back to AdoptOpenJDK API.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// failed to find a Temurin version, so fall back to AdoptOpenJDK
|
||||||
|
return this.findPackageForDownloadOldAdoptOpenJdk(version);
|
||||||
|
}
|
||||||
|
async findPackageForDownloadOldAdoptOpenJdk(version) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
const availableVersionsWithBinaries = availableVersionsRaw
|
||||||
|
.filter(item => item.binaries.length > 0)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.version_data.semver,
|
||||||
|
url: item.binaries[0].package.link,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.binaries[0].package.checksum,
|
||||||
|
source: item.binaries[0].package.checksum_link
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = availableVersionsWithBinaries
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(version, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver__WEBPACK_IMPORTED_MODULE_4___default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return resolvedFullVersion;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
get toolcacheFolderName() {
|
||||||
|
if (this.jvmImpl === AdoptImplementation.Hotspot) {
|
||||||
|
// exclude Hotspot postfix from distribution name because Hosted runners have pre-cached Adopt OpenJDK under "Java_Adopt_jdk"
|
||||||
|
// for more information see: https://github.com/actions/setup-java/pull/155#discussion_r610451063
|
||||||
|
return `Java_Adopt_${this.packageType}`;
|
||||||
|
}
|
||||||
|
return super.toolcacheFolderName;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const imageType = this.packageType;
|
||||||
|
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
||||||
|
const releaseType = this.stable ? 'ga' : 'ea';
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Adopt took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const baseRequestArguments = [
|
||||||
|
`project=jdk`,
|
||||||
|
'vendor=adoptopenjdk',
|
||||||
|
`heap_size=normal`,
|
||||||
|
'sort_method=DEFAULT',
|
||||||
|
'sort_order=DESC',
|
||||||
|
`os=${platform}`,
|
||||||
|
`architecture=${arch}`,
|
||||||
|
`image_type=${imageType}`,
|
||||||
|
`release_type=${releaseType}`,
|
||||||
|
`jvm_impl=${this.jvmImpl.toLowerCase()}`
|
||||||
|
].join('&');
|
||||||
|
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||||
|
let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||||
|
const availableVersions = [];
|
||||||
|
let pageCount = 0;
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
|
}
|
||||||
|
while (availableVersionsUrl) {
|
||||||
|
pageCount++;
|
||||||
|
const response = await this.http.getJson(availableVersionsUrl);
|
||||||
|
const paginationPage = response.result;
|
||||||
|
const nextUrl = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getNextPageUrlFromLinkHeader */ .rC)(response.headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .validatePaginationUrl */ .SA)(nextUrl, 'https://api.adoptopenjdk.net')) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .warning */ .$e(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
availableVersionsUrl = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
availableVersionsUrl = nextUrl;
|
||||||
|
}
|
||||||
|
if (paginationPage === null || paginationPage.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
availableVersions.push(...paginationPage);
|
||||||
|
if (pageCount >= _util_js__WEBPACK_IMPORTED_MODULE_6__/* .MAX_PAGINATION_PAGES */ .Tp) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .warning */ .$e(`Reached pagination safeguard limit (${_util_js__WEBPACK_IMPORTED_MODULE_6__/* .MAX_PAGINATION_PAGES */ .Tp} pages) while listing Adopt releases.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Adopt took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableVersions.map(item => item.version_data.semver).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Adopt has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'mac';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
const architecture = super.distributionArchitecture();
|
||||||
|
return architecture === 'armv7' ? 'arm' : architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 463:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
|
||||||
|
// EXPORTS
|
||||||
|
__webpack_require__.d(__webpack_exports__, {
|
||||||
|
TemurinDistribution: () => (/* binding */ TemurinDistribution),
|
||||||
|
TemurinImplementation: () => (/* binding */ TemurinImplementation)
|
||||||
|
});
|
||||||
|
|
||||||
|
// UNUSED EXPORTS: ADOPTIUM_PUBLIC_KEY
|
||||||
|
|
||||||
|
// 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_);
|
||||||
|
// EXTERNAL MODULE: ./node_modules/semver/index.js
|
||||||
|
var semver = __webpack_require__(2088);
|
||||||
|
var semver_default = /*#__PURE__*/__webpack_require__.n(semver);
|
||||||
|
// EXTERNAL MODULE: ./src/gpg.ts
|
||||||
|
var gpg = __webpack_require__(8343);
|
||||||
|
;// CONCATENATED MODULE: ./src/distributions/temurin/adoptium-key.ts
|
||||||
|
// Adoptium GPG signing key (fingerprint: 3B04D753C9050D9A5D343F39843C48A565F8F04B)
|
||||||
|
// Retrieved from: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B04D753C9050D9A5D343F39843C48A565F8F04B
|
||||||
|
const ADOPTIUM_PUBLIC_KEY = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
xsBNBGGTvTQBCAC6ey144n7CG8foafF6mwgIBN1fIm1ILZDuGS4tMr0/XI8pgJnT
|
||||||
|
QvsPxZWEvtSm7bEMObzEoZJcXwjBcJl1B0ui8k5kHMTI75gCmZPsoKLFWIEpuRBQ
|
||||||
|
PBocusw80apDmLnNDQLVQvDFtEua5gaNa/fRw9YsmBoXBqvgrjFUIdGyWoQvH5+a
|
||||||
|
9OYlWD9n5VV0gnVMb+aclwVzB/zJw3kHGSgzuMtlAHeQiah7Y8yomQn/UIX8yqDf
|
||||||
|
+11sP3+c87YcjkRqImRTtmKEDcEtGPAIXC6SYA+uEEkbYE0Fy0chkvtnVWJ597fa
|
||||||
|
Epai4rnICU8zoJ6X5z3v1aM2WerhX9oq9X8PABEBAAHNQEFkb3B0aXVtIEdQRyBL
|
||||||
|
ZXkgKERFQi9SUE0gU2lnbmluZyBLZXkpIDx0ZW11cmluLWRldkBlY2xpcHNlLm9y
|
||||||
|
Zz7CwJIEEwEIADwWIQQ7BNdTyQUNml00PzmEPEilZfjwSwUCYZO9NAIbAwULCQgH
|
||||||
|
AgMiAgEGFQoJCAsCBBYCAwECHgcCF4AACgkQhDxIpWX48Et4AggAjjJzYWuKV3nG
|
||||||
|
7ngInngl8G/m9JoHr7BmwgcQXYhdy5hVkMcUx5JLeXz2LMBUH/F2nD595hgjMabk
|
||||||
|
kVib20X8lq9RsNbdfc2hBcWU6qyHKxsIqT4boI2/XDyEzzMyyZWWNGo/27Ci7Xmj
|
||||||
|
pWu31nh0pDdPqdyWDIKojbVVnxlCRY8as8Sm+1ufi709KCi4MuwHNsUlCSwb/fju
|
||||||
|
NKeHkrHbLcHKUUIEcmTSKRWrpMYBzm1HYOGBz4xPuELwUfUp71ehfoyBZlp6RDRf
|
||||||
|
l5TYI1FmCyHuvjNhrJgWv7bOTcf8yObGY+TEUhzc4xQqCrF4ur9d3opvsuPBQsv+
|
||||||
|
Klqi5KSZgs7ATQRhk700AQgAq14okly8cFrpYVenEQPiB75AUZfKRpMduiR6IxAj
|
||||||
|
SKcH7aSoFZ9AubUEBVpZsyT5svxoEPe1i4TdbF+m9FGy42EcOlLa3ArLTj5H8FRl
|
||||||
|
UdGZB9I5mk4GptOzPM+aHMMu92vW/ZwjuS8DvOiQSp+cUmG1EqOMJSM7e/4BM71z
|
||||||
|
E+OKaVJCj79pEzhG3SK/IC/OlxxyETT66NSfYJd7Sw5R6Vr19am/uNU690W0CJ+q
|
||||||
|
VQeFpmDMr7LnfdFRIh+lJe05+PvWXeidkGjox5cbG52wf8aRIR/FgkfcFvqRMN1f
|
||||||
|
B+dVOWueloUeVAnzcUznOKmUEs7LP9ObJhYHHgup4IAU2wARAQABwsB2BBgBCAAg
|
||||||
|
FiEEOwTXU8kFDZpdND85hDxIpWX48EsFAmGTvTQCGwwACgkQhDxIpWX48EvXHQf/
|
||||||
|
Q0nZsGDXnZHiBoojeSdpkO7WBjMIP3w1GdLvRpPQrS8TfOPbZuoevzCNh38Y3gwF
|
||||||
|
yelJspvzDQrBXhgkzAGlucYg8Y7KHa5Ebm7iDgMzc37L1hYSZTYCqwd7aowfgy34
|
||||||
|
hOk3B67LffkJpIh738Oa9CtlwxQ9xcytmBmQ1fBBOwm/9IhAwHPQuydYIs4DxWbj
|
||||||
|
0MGSP4fDntU7e4UjsHNmhudDcYol0FaqdHHIIB9C/G4CzetRwHFOn3b4JwXMU7YU
|
||||||
|
6aJA3mXhi3hggMC3wkT2HHZ/TquuOdNc02fypWOCDOHz0alBBJNqoVUNFNqU3tfJ
|
||||||
|
wI4qF/KKq9BfyfucAs0ykA==
|
||||||
|
=XLag
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./src/distributions/base-installer.ts + 2 modules
|
||||||
|
var base_installer = __webpack_require__(6242);
|
||||||
|
// EXTERNAL MODULE: ./src/constants.ts
|
||||||
|
var constants = __webpack_require__(7242);
|
||||||
|
// EXTERNAL MODULE: ./src/util.ts
|
||||||
|
var util = __webpack_require__(4527);
|
||||||
|
;// CONCATENATED MODULE: ./src/distributions/temurin/installer.ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var TemurinImplementation;
|
||||||
|
(function (TemurinImplementation) {
|
||||||
|
TemurinImplementation["Hotspot"] = "Hotspot";
|
||||||
|
})(TemurinImplementation || (TemurinImplementation = {}));
|
||||||
|
class TemurinDistribution extends base_installer/* JavaBase */.O {
|
||||||
|
jvmImpl;
|
||||||
|
includeJmods;
|
||||||
|
constructor(installerOptions, jvmImpl) {
|
||||||
|
super(`Temurin-${jvmImpl}`, installerOptions);
|
||||||
|
this.jvmImpl = jvmImpl;
|
||||||
|
this.includeJmods = this.packageType === 'jdk+jmods';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal For cross-distribution reuse only. Not intended as a public API.
|
||||||
|
*/
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
return this.resolvePackage(version, this.includeJmods ? 'jdk' : this.packageType);
|
||||||
|
}
|
||||||
|
async resolvePackage(version, imageType) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions(imageType);
|
||||||
|
const availableVersionsWithBinaries = availableVersionsRaw
|
||||||
|
.filter(item => item.binaries.length > 0)
|
||||||
|
.map(item => {
|
||||||
|
// normalize 17.0.0-beta+33.0.202107301459 to 17.0.0+33.0.202107301459 for earlier access versions
|
||||||
|
const formattedVersion = this.stable
|
||||||
|
? item.version_data.semver
|
||||||
|
: item.version_data.semver.replace('-beta+', '+');
|
||||||
|
return {
|
||||||
|
version: formattedVersion,
|
||||||
|
url: item.binaries[0].package.link,
|
||||||
|
signatureUrl: item.binaries[0].package.signature_link,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.binaries[0].package.checksum,
|
||||||
|
source: item.binaries[0].package.checksum_link
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = availableVersionsWithBinaries
|
||||||
|
.filter(item => (0,util/* isVersionSatisfies */.y)(version, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver_default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
return resolvedFullVersion;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
core/* info */.pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadPackage(javaRelease);
|
||||||
|
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 javaHome = process.platform === 'darwin'
|
||||||
|
? external_path_default().join(archivePath, constants/* MACOS_JAVA_CONTENT_POSTFIX */.PG)
|
||||||
|
: archivePath;
|
||||||
|
if (this.includeJmods && !external_fs_default().existsSync(external_path_default().join(javaHome, 'jmods'))) {
|
||||||
|
await this.installJmods(javaRelease.version, javaHome);
|
||||||
|
}
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await tool_cache/* cacheDir */.e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
supportsSignatureVerification() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
async downloadPackage(release) {
|
||||||
|
const archivePath = await this.downloadAndVerify(release);
|
||||||
|
if (this.verifySignature) {
|
||||||
|
if (!release.signatureUrl) {
|
||||||
|
throw new Error(`Input 'verify-signature' is enabled, but no signature URL was found for Temurin version ${release.version}.`);
|
||||||
|
}
|
||||||
|
core/* info */.pq(`Verifying Java package signature...`);
|
||||||
|
try {
|
||||||
|
await gpg/* verifyPackageSignature */.Yi(archivePath, release.signatureUrl, this.verifySignaturePublicKey ?? ADOPTIUM_PUBLIC_KEY);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw new Error(`Failed to verify signature for Temurin version ${release.version} from ${release.signatureUrl}: ${error.message}`, { cause: error });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return archivePath;
|
||||||
|
}
|
||||||
|
async installJmods(version, javaHome) {
|
||||||
|
const jmodsRelease = await this.resolvePackage(version, 'jmods');
|
||||||
|
core/* info */.pq(`Downloading JMODs ${jmodsRelease.version} (${this.distribution}) from ${jmodsRelease.url} ...`);
|
||||||
|
let jmodsArchivePath = await this.downloadPackage(jmodsRelease);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
jmodsArchivePath = (0,util/* renameWinArchive */.n2)(jmodsArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJmodsPath = await (0,util/* extractJdkFile */.PE)(jmodsArchivePath, (0,util/* getDownloadArchiveExtension */.ag)());
|
||||||
|
const jmodsDirectory = external_path_default().join(extractedJmodsPath, external_fs_default().readdirSync(extractedJmodsPath)[0]);
|
||||||
|
external_fs_default().cpSync(jmodsDirectory, external_path_default().join(javaHome, 'jmods'), { recursive: true });
|
||||||
|
}
|
||||||
|
async getAvailableVersions(imageType = this.includeJmods ? 'jdk' : this.packageType) {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
||||||
|
const releaseType = this.stable ? 'ga' : 'ea';
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
console.time('Retrieving available versions for Temurin took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const baseRequestArguments = [
|
||||||
|
`project=jdk`,
|
||||||
|
'vendor=adoptium',
|
||||||
|
`heap_size=normal`,
|
||||||
|
'sort_method=DEFAULT',
|
||||||
|
'sort_order=DESC',
|
||||||
|
`os=${platform}`,
|
||||||
|
`architecture=${arch}`,
|
||||||
|
`image_type=${imageType}`,
|
||||||
|
`release_type=${releaseType}`,
|
||||||
|
`jvm_impl=${this.jvmImpl.toLowerCase()}`
|
||||||
|
].join('&');
|
||||||
|
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||||
|
let availableVersionsUrl = `https://api.adoptium.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||||
|
const availableVersions = [];
|
||||||
|
let pageCount = 0;
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
core/* debug */.Yz(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
|
}
|
||||||
|
while (availableVersionsUrl) {
|
||||||
|
pageCount++;
|
||||||
|
const response = await this.http.getJson(availableVersionsUrl);
|
||||||
|
const paginationPage = response.result;
|
||||||
|
const nextUrl = (0,util/* getNextPageUrlFromLinkHeader */.rC)(response.headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0,util/* validatePaginationUrl */.SA)(nextUrl, 'https://api.adoptium.net')) {
|
||||||
|
core/* warning */.$e(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
availableVersionsUrl = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
availableVersionsUrl = nextUrl;
|
||||||
|
}
|
||||||
|
if (paginationPage === null || paginationPage.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
availableVersions.push(...paginationPage);
|
||||||
|
if (pageCount >= util/* MAX_PAGINATION_PAGES */.Tp) {
|
||||||
|
core/* warning */.$e(`Reached pagination safeguard limit (${util/* MAX_PAGINATION_PAGES */.Tp} pages) while listing Temurin releases.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (core/* isDebug */._o()) {
|
||||||
|
core/* startGroup */.Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Temurin took'); // eslint-disable-line no-console
|
||||||
|
core/* debug */.Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
core/* debug */.Yz(availableVersions.map(item => item.version_data.semver).join(', '));
|
||||||
|
core/* endGroup */.N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Adoptium has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'mac';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
if (external_fs_default().existsSync('/etc/alpine-release')) {
|
||||||
|
return 'alpine-linux';
|
||||||
|
}
|
||||||
|
return 'linux';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
distributionArchitecture() {
|
||||||
|
const architecture = super.distributionArchitecture();
|
||||||
|
return architecture === 'armv7' ? 'arm' : architecture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+177
@@ -0,0 +1,177 @@
|
|||||||
|
export const id = 939;
|
||||||
|
export const ids = [939];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 9939:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ SemeruDistribution: () => (/* binding */ SemeruDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const supportedArchitectures = [
|
||||||
|
'x64',
|
||||||
|
'x86',
|
||||||
|
'ppc64le',
|
||||||
|
'ppc64',
|
||||||
|
's390x',
|
||||||
|
'aarch64'
|
||||||
|
];
|
||||||
|
class SemeruDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_0__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('IBM_Semeru', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
if (!supportedArchitectures.includes(arch)) {
|
||||||
|
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture} for your current OS version, the following are supported: ${supportedArchitectures.join(', ')}`);
|
||||||
|
}
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('IBM Semeru does not provide builds for early access versions');
|
||||||
|
}
|
||||||
|
if (this.packageType !== 'jdk' && this.packageType !== 'jre') {
|
||||||
|
throw new Error('IBM Semeru only provide `jdk` and `jre` package types');
|
||||||
|
}
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
const availableVersionsWithBinaries = availableVersionsRaw
|
||||||
|
.filter(item => item.binaries.length > 0)
|
||||||
|
.map(item => {
|
||||||
|
// normalize 17.0.0-beta+33.0.202107301459 to 17.0.0+33.0.202107301459 for earlier access versions
|
||||||
|
const formattedVersion = this.stable
|
||||||
|
? item.version_data.semver
|
||||||
|
: item.version_data.semver.replace('-beta+', '+');
|
||||||
|
return {
|
||||||
|
version: formattedVersion,
|
||||||
|
url: item.binaries[0].package.link,
|
||||||
|
checksum: {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: item.binaries[0].package.checksum,
|
||||||
|
source: item.binaries[0].package.checksum_link
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = availableVersionsWithBinaries
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .isVersionSatisfies */ .y)(version, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
return -semver__WEBPACK_IMPORTED_MODULE_1___default().compareBuild(a.version, b.version);
|
||||||
|
});
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
||||||
|
// Include platform context to help users understand OS-specific version availability
|
||||||
|
// IBM Semeru builds are OS-specific, so platform info aids in troubleshooting
|
||||||
|
const platformContext = `Platform: ${process.platform}`;
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings, platformContext);
|
||||||
|
}
|
||||||
|
return resolvedFullVersion;
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_5___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_6___default().join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_4__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
get toolcacheFolderName() {
|
||||||
|
return super.toolcacheFolderName;
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const imageType = this.packageType;
|
||||||
|
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
||||||
|
const releaseType = this.stable ? 'ga' : 'ea';
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const baseRequestArguments = [
|
||||||
|
`project=jdk`,
|
||||||
|
'vendor=ibm',
|
||||||
|
`heap_size=normal`,
|
||||||
|
'sort_method=DEFAULT',
|
||||||
|
'sort_order=DESC',
|
||||||
|
`os=${platform}`,
|
||||||
|
`architecture=${arch}`,
|
||||||
|
`image_type=${imageType}`,
|
||||||
|
`release_type=${releaseType}`,
|
||||||
|
`jvm_impl=openj9`
|
||||||
|
].join('&');
|
||||||
|
const requestArguments = `${baseRequestArguments}&page_size=20&page=0`;
|
||||||
|
let availableVersionsUrl = `https://api.adoptopenjdk.net/v3/assets/version/${versionRange}?${requestArguments}`;
|
||||||
|
const availableVersions = [];
|
||||||
|
let pageCount = 0;
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
|
}
|
||||||
|
while (availableVersionsUrl) {
|
||||||
|
pageCount++;
|
||||||
|
const response = await this.http.getJson(availableVersionsUrl);
|
||||||
|
const paginationPage = response.result;
|
||||||
|
const nextUrl = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .getNextPageUrlFromLinkHeader */ .rC)(response.headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .validatePaginationUrl */ .SA)(nextUrl, 'https://api.adoptopenjdk.net')) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
availableVersionsUrl = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
availableVersionsUrl = nextUrl;
|
||||||
|
}
|
||||||
|
if (paginationPage === null || paginationPage.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
availableVersions.push(...paginationPage);
|
||||||
|
if (pageCount >= _util_js__WEBPACK_IMPORTED_MODULE_2__/* .MAX_PAGINATION_PAGES */ .Tp) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .warning */ .$e(`Reached pagination safeguard limit (${_util_js__WEBPACK_IMPORTED_MODULE_2__/* .MAX_PAGINATION_PAGES */ .Tp} pages) while listing Semeru releases.`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .debug */ .Yz(availableVersions.map(item => item.version_data.semver).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_3__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Adopt has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'mac';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+341
@@ -0,0 +1,341 @@
|
|||||||
|
export const id = 968;
|
||||||
|
export const ids = [968];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 6968:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ GraalVMCommunityDistribution: () => (/* binding */ GraalVMCommunityDistribution),
|
||||||
|
/* harmony export */ GraalVMDistribution: () => (/* binding */ GraalVMDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4942);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
|
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 GRAALVM_COMMUNITY_ASSET_PREFIX = 'graalvm-community-jdk-';
|
||||||
|
const GRAALVM_COMMUNITY_VERSION_PATTERN = /^\d+(?:\.\d+)*$/;
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
|
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'];
|
||||||
|
class GraalVMDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions, distributionName = 'GraalVM') {
|
||||||
|
super(distributionName, installerOptions);
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
try {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
// Add validation for extracted path
|
||||||
|
if (!fs__WEBPACK_IMPORTED_MODULE_2___default().existsSync(extractedJavaPath)) {
|
||||||
|
throw new Error(`Extraction failed: path ${extractedJavaPath} does not exist`);
|
||||||
|
}
|
||||||
|
const dirContents = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath);
|
||||||
|
if (dirContents.length === 0) {
|
||||||
|
throw new Error('Extraction failed: no files found in extracted directory');
|
||||||
|
}
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_3___default().join(extractedJavaPath, dirContents[0]);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .error */ .z3(`Failed to download and extract GraalVM: ${error}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setJavaDefault(version, toolPath) {
|
||||||
|
super.setJavaDefault(version, toolPath);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .exportVariable */ .dN('GRAALVM_HOME', toolPath);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
this.validateVersionRange(range);
|
||||||
|
const arch = this.getSupportedArchitecture();
|
||||||
|
if (!this.stable) {
|
||||||
|
return this.findEABuildDownloadUrl(`${range}-ea`);
|
||||||
|
}
|
||||||
|
// The `latest` alias is normalized to the SemVer wildcard. Oracle GraalVM
|
||||||
|
// builds its download URLs from a concrete major and has no endpoint to list
|
||||||
|
// releases, so resolve the newest available GA major from the Adoptium API.
|
||||||
|
if (this.latest) {
|
||||||
|
range = (await (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getLatestMajorVersion */ .ri)(this.http)).toString();
|
||||||
|
}
|
||||||
|
const { platform, extension, major } = this.validateStableBuildRequest(range);
|
||||||
|
const fileUrl = this.constructFileUrl(range, major, platform, arch, extension);
|
||||||
|
const response = await this.http.head(fileUrl);
|
||||||
|
this.handleHttpResponse(response, range);
|
||||||
|
return {
|
||||||
|
url: fileUrl,
|
||||||
|
version: range,
|
||||||
|
checksum: await this.fetchChecksum(`${fileUrl}.sha256`, 'sha256')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
validateVersionRange(range) {
|
||||||
|
if (!range || typeof range !== 'string') {
|
||||||
|
throw new Error('Version range is required and must be a string');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getSupportedArchitecture() {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
if (!SUPPORTED_ARCHITECTURES.includes(arch)) {
|
||||||
|
throw new Error(`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`);
|
||||||
|
}
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
validateStableBuildRequest(range) {
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error(`${this.distribution} provides only the \`jdk\` package type`);
|
||||||
|
}
|
||||||
|
const platform = this.getPlatform();
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
const major = range.includes('.') ? range.split('.')[0] : range;
|
||||||
|
const majorVersion = parseInt(major);
|
||||||
|
if (isNaN(majorVersion)) {
|
||||||
|
throw new Error(`Invalid version format: ${range}`);
|
||||||
|
}
|
||||||
|
if (majorVersion < GRAALVM_MIN_VERSION) {
|
||||||
|
throw new Error(`${this.distribution} is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
platform,
|
||||||
|
major,
|
||||||
|
extension
|
||||||
|
};
|
||||||
|
}
|
||||||
|
constructFileUrl(range, major, platform, arch, extension) {
|
||||||
|
return range.includes('.')
|
||||||
|
? `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`
|
||||||
|
: `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
|
||||||
|
}
|
||||||
|
handleHttpResponse(response, range) {
|
||||||
|
const statusCode = response.message.statusCode;
|
||||||
|
if (statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.NotFound) {
|
||||||
|
// Create the standard error with additional hint about checking the download URL
|
||||||
|
const error = this.createVersionNotFoundError(range);
|
||||||
|
if (this.latest) {
|
||||||
|
error.message += `\nThe latest Java major version (${range}) is not yet available for the ${this.distribution} distribution. Please specify a concrete version instead of 'latest'.`;
|
||||||
|
}
|
||||||
|
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
if (statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.Unauthorized ||
|
||||||
|
statusCode === _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.Forbidden) {
|
||||||
|
throw new Error(`Access denied when downloading GraalVM. Status code: ${statusCode}. Please check your credentials or permissions.`);
|
||||||
|
}
|
||||||
|
if (statusCode !== _actions_http_client__WEBPACK_IMPORTED_MODULE_6__/* .HttpCodes */ .Hv.OK) {
|
||||||
|
throw new Error(`HTTP request for GraalVM failed with status code: ${statusCode} (${response.message.statusMessage || 'Unknown error'})`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async findEABuildDownloadUrl(javaEaVersion) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Searching for EA build: ${javaEaVersion}`);
|
||||||
|
const versions = await this.fetchEAJson(javaEaVersion);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Found ${versions.length} EA versions`);
|
||||||
|
const latestVersion = versions.find(v => v.latest);
|
||||||
|
if (!latestVersion) {
|
||||||
|
const availableVersions = versions.map(v => v.version);
|
||||||
|
throw this.createVersionNotFoundError(javaEaVersion, availableVersions, 'Note: No EA build is marked as latest for this version.');
|
||||||
|
}
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Latest version found: ${latestVersion.version}`);
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
const file = latestVersion.files.find(f => f.arch === arch && f.platform === GRAALVM_PLATFORM);
|
||||||
|
if (!file) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .error */ .z3(`Available files for architecture ${arch}: ${JSON.stringify(latestVersion.files)}`);
|
||||||
|
throw new Error(`Unable to find file for architecture '${arch}' and platform '${GRAALVM_PLATFORM}'`);
|
||||||
|
}
|
||||||
|
if (!file.filename.startsWith('graalvm-jdk-')) {
|
||||||
|
throw new Error(`Invalid filename format: ${file.filename}. Expected to start with 'graalvm-jdk-'`);
|
||||||
|
}
|
||||||
|
const downloadUrl = `${latestVersion.download_base_url}${file.filename}`;
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Download URL: ${downloadUrl}`);
|
||||||
|
return {
|
||||||
|
url: downloadUrl,
|
||||||
|
version: latestVersion.version,
|
||||||
|
checksum: await this.fetchChecksum(`${downloadUrl}.sha256`, 'sha256')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async fetchEAJson(javaEaVersion) {
|
||||||
|
const url = `https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/${javaEaVersion}.json?ref=main`;
|
||||||
|
const headers = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getGitHubHttpHeaders */ .U_)();
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Trying to fetch available version info for GraalVM EA builds from '${url}'`);
|
||||||
|
try {
|
||||||
|
const response = await this.http.getJson(url, headers);
|
||||||
|
if (!response.result) {
|
||||||
|
throw new Error(`No GraalVM EA build found for version '${javaEaVersion}'. Please check if the version is correct.`);
|
||||||
|
}
|
||||||
|
return response.result;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
// Check if it's a 404 error (file not found)
|
||||||
|
if (error.message?.includes('404')) {
|
||||||
|
throw new Error(`GraalVM EA version '${javaEaVersion}' not found. Please verify the version exists in the EA builds repository.`, { cause: error });
|
||||||
|
}
|
||||||
|
// Re-throw with more context
|
||||||
|
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}': ${error.message}`, { cause: error });
|
||||||
|
}
|
||||||
|
// If it's not an Error instance, throw a generic error
|
||||||
|
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}'`, { cause: error });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getPlatform(platform = process.platform) {
|
||||||
|
const platformMap = {
|
||||||
|
darwin: 'macos',
|
||||||
|
win32: 'windows',
|
||||||
|
linux: 'linux'
|
||||||
|
};
|
||||||
|
const result = platformMap[platform];
|
||||||
|
if (!result) {
|
||||||
|
throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class GraalVMCommunityDistribution extends GraalVMDistribution {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super(installerOptions, 'GraalVM Community');
|
||||||
|
}
|
||||||
|
get toolcacheFolderName() {
|
||||||
|
return `Java_GraalVM_Community_${this.packageType}`;
|
||||||
|
}
|
||||||
|
async findPackageForDownload(range) {
|
||||||
|
this.validateVersionRange(range);
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('GraalVM Community does not provide early access builds');
|
||||||
|
}
|
||||||
|
const arch = this.getSupportedArchitecture();
|
||||||
|
// GraalVM Community publishes its releases on GitHub, so the `latest` alias
|
||||||
|
// (normalized to the SemVer wildcard `x`) can float to the newest GA it
|
||||||
|
// actually ships. Unlike Oracle GraalVM (which has no listing endpoint and
|
||||||
|
// must derive the newest major from the Adoptium API), we match against the
|
||||||
|
// real release list here, so `latest` never fails when GraalVM lags behind a
|
||||||
|
// brand-new Java major.
|
||||||
|
let platform;
|
||||||
|
let extension;
|
||||||
|
if (this.latest) {
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error(`${this.distribution} provides only the \`jdk\` package type`);
|
||||||
|
}
|
||||||
|
platform = this.getPlatform();
|
||||||
|
extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
({ platform, extension } = this.validateStableBuildRequest(range));
|
||||||
|
}
|
||||||
|
// GraalVM Community asset names embed the platform, architecture and
|
||||||
|
// archive type, e.g. `graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz`.
|
||||||
|
const assetSuffix = `_${platform}-${arch}_bin.${extension}`;
|
||||||
|
const availableVersions = await this.getAvailableVersions(assetSuffix);
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .isVersionSatisfies */ .y)(range, item.version))
|
||||||
|
.sort((a, b) => -semver__WEBPACK_IMPORTED_MODULE_4___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;
|
||||||
|
}
|
||||||
|
async getAvailableVersions(assetSuffix) {
|
||||||
|
const headers = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getGitHubHttpHeaders */ .U_)();
|
||||||
|
const versions = new Map();
|
||||||
|
let releasesUrl = GRAALVM_COMMUNITY_RELEASES_URL;
|
||||||
|
for (let pageIndex = 0; releasesUrl && pageIndex < _util_js__WEBPACK_IMPORTED_MODULE_7__/* .MAX_PAGINATION_PAGES */ .Tp; pageIndex++) {
|
||||||
|
const response = await this.http.getJson(releasesUrl, headers);
|
||||||
|
// A successful GitHub releases listing is always a JSON array (possibly
|
||||||
|
// empty). Anything else indicates an unexpected/error payload (rate
|
||||||
|
// limiting, auth failure, etc.) that must be surfaced instead of being
|
||||||
|
// silently treated as "no releases", which would later look like a
|
||||||
|
// misleading "version not found" error.
|
||||||
|
if (!Array.isArray(response.result)) {
|
||||||
|
throw new Error(`Unexpected response while listing GraalVM Community releases from ${releasesUrl} ` +
|
||||||
|
`(HTTP status code: ${response.statusCode}). Expected a JSON array of releases. ` +
|
||||||
|
`Please check if the service is available at ${GRAALVM_COMMUNITY_DOWNLOAD_URL}.`);
|
||||||
|
}
|
||||||
|
const releases = response.result;
|
||||||
|
if (releases.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (const release of releases) {
|
||||||
|
if (release.draft || release.prerelease) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const asset of release.assets ?? []) {
|
||||||
|
const version = this.extractAssetVersion(asset.name, assetSuffix);
|
||||||
|
if (version) {
|
||||||
|
const digest = asset.digest?.match(/^sha256:([a-f0-9]{64})$/i)?.[1];
|
||||||
|
if (!digest) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`No authoritative sha256 digest is available for ${asset.name}; skipping checksum verification for this asset.`);
|
||||||
|
}
|
||||||
|
versions.set(version, {
|
||||||
|
version,
|
||||||
|
url: asset.browser_download_url,
|
||||||
|
checksum: digest
|
||||||
|
? {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: digest,
|
||||||
|
source: GRAALVM_COMMUNITY_RELEASES_URL
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releasesUrl = this.getNextReleasesUrl(response.headers);
|
||||||
|
}
|
||||||
|
return [...versions.values()];
|
||||||
|
}
|
||||||
|
// Returns the GraalVM JDK version encoded in a release asset name when it
|
||||||
|
// matches the requested platform/architecture/archive suffix, otherwise null.
|
||||||
|
extractAssetVersion(assetName, assetSuffix) {
|
||||||
|
if (!assetName.startsWith(GRAALVM_COMMUNITY_ASSET_PREFIX) ||
|
||||||
|
!assetName.endsWith(assetSuffix)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const rawVersion = assetName.slice(GRAALVM_COMMUNITY_ASSET_PREFIX.length, -assetSuffix.length);
|
||||||
|
if (!GRAALVM_COMMUNITY_VERSION_PATTERN.test(rawVersion)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .convertVersionToSemver */ .ZY)(rawVersion);
|
||||||
|
}
|
||||||
|
getNextReleasesUrl(headers) {
|
||||||
|
const nextUrl = (0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .getNextPageUrlFromLinkHeader */ .rC)(headers);
|
||||||
|
if (nextUrl &&
|
||||||
|
!(0,_util_js__WEBPACK_IMPORTED_MODULE_7__/* .validatePaginationUrl */ .SA)(nextUrl, GRAALVM_COMMUNITY_RELEASES_PAGE_ORIGIN)) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .warning */ .$e(`Ignoring pagination link with unexpected origin: ${nextUrl}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return nextUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+197
@@ -0,0 +1,197 @@
|
|||||||
|
export const id = 978;
|
||||||
|
export const ids = [978];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 9597:
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ ZuluDistribution: () => (/* binding */ ZuluDistribution)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3838);
|
||||||
|
/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9805);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6928);
|
||||||
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9896);
|
||||||
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2088);
|
||||||
|
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6242);
|
||||||
|
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ZuluDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_5__/* .JavaBase */ .O {
|
||||||
|
constructor(installerOptions) {
|
||||||
|
super('Zulu', installerOptions);
|
||||||
|
}
|
||||||
|
async findPackageForDownload(version) {
|
||||||
|
const availableVersionsRaw = await this.getAvailableVersions();
|
||||||
|
const availableVersions = availableVersionsRaw.map(item => {
|
||||||
|
// The Azul Metadata API reports the JDK build number separately from
|
||||||
|
// java_version (e.g. java_version=[17,0,7], openjdk_build_number=7).
|
||||||
|
// Append it so the resulting semver retains the build (e.g. 17.0.7+7).
|
||||||
|
const javaVersion = item.openjdk_build_number != null
|
||||||
|
? [...item.java_version, item.openjdk_build_number]
|
||||||
|
: item.java_version;
|
||||||
|
return {
|
||||||
|
version: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(javaVersion),
|
||||||
|
url: item.download_url,
|
||||||
|
zuluVersion: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(item.distro_version),
|
||||||
|
packageUuid: item.package_uuid
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const satisfiedVersions = availableVersions
|
||||||
|
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(version, item.version))
|
||||||
|
.sort((a, b) => {
|
||||||
|
// Azul provides two versions: java_version and distro_version
|
||||||
|
// we should sort by both fields by descending
|
||||||
|
return (-semver__WEBPACK_IMPORTED_MODULE_4___default().compareBuild(a.version, b.version) ||
|
||||||
|
-semver__WEBPACK_IMPORTED_MODULE_4___default().compareBuild(a.zuluVersion, b.zuluVersion));
|
||||||
|
})
|
||||||
|
.map((item) => ({
|
||||||
|
version: item.version,
|
||||||
|
url: item.url,
|
||||||
|
packageUuid: item.packageUuid
|
||||||
|
}));
|
||||||
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
|
if (!resolvedFullVersion) {
|
||||||
|
const availableVersionStrings = availableVersions.map(item => item.version);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
|
}
|
||||||
|
const packageDetailsUrl = `https://api.azul.com/metadata/v1/zulu/packages/${resolvedFullVersion.packageUuid}`;
|
||||||
|
const packageDetails = (await this.http.getJson(packageDetailsUrl)).result;
|
||||||
|
const digest = packageDetails?.sha256_hash?.match(/^[a-f0-9]{64}$/i)?.[0];
|
||||||
|
if (!digest) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`No authoritative sha256 checksum is available for Zulu version ${resolvedFullVersion.version} from ${packageDetailsUrl}; skipping checksum verification.`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
version: resolvedFullVersion.version,
|
||||||
|
url: resolvedFullVersion.url,
|
||||||
|
checksum: digest
|
||||||
|
? {
|
||||||
|
algorithm: 'sha256',
|
||||||
|
value: digest,
|
||||||
|
source: packageDetailsUrl
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async downloadTool(javaRelease) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||||
|
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||||
|
}
|
||||||
|
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||||
|
const archiveName = fs__WEBPACK_IMPORTED_MODULE_3___default().readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path__WEBPACK_IMPORTED_MODULE_2___default().join(extractedJavaPath, archiveName);
|
||||||
|
const javaPath = await _actions_tool_cache__WEBPACK_IMPORTED_MODULE_1__/* .cacheDir */ .e8(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
async getAvailableVersions() {
|
||||||
|
const arch = this.getArchitectureOptions();
|
||||||
|
const [bundleType, features] = this.packageType.split('+');
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||||
|
const javafx = features?.includes('fx') ?? false;
|
||||||
|
const crac = features?.includes('crac') ?? false;
|
||||||
|
const releaseStatus = this.stable ? 'ga' : 'ea';
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
console.time('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
const baseRequestArguments = [
|
||||||
|
`os=${platform}`,
|
||||||
|
`archive_type=${extension}`,
|
||||||
|
`java_package_type=${bundleType}`,
|
||||||
|
`javafx_bundled=${javafx}`,
|
||||||
|
`crac_supported=${crac}`,
|
||||||
|
`arch=${arch}`,
|
||||||
|
`release_status=${releaseStatus}`,
|
||||||
|
`availability_types=ca`
|
||||||
|
].join('&');
|
||||||
|
// Need to iterate through all pages to retrieve the list of all versions.
|
||||||
|
// The Azul API doesn't return a total page count, so paginate until a page
|
||||||
|
// comes back empty (or short), guarding against a runaway loop with a cap.
|
||||||
|
const pageSize = 100;
|
||||||
|
const maxPages = 100;
|
||||||
|
let pageIndex = 1;
|
||||||
|
const availableVersions = [];
|
||||||
|
while (pageIndex <= maxPages) {
|
||||||
|
const requestArguments = `${baseRequestArguments}&page=${pageIndex}&page_size=${pageSize}`;
|
||||||
|
const availableVersionsUrl = `https://api.azul.com/metadata/v1/zulu/packages/?${requestArguments}`;
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o() && pageIndex === 1) {
|
||||||
|
// the url is identical except for the page number, so print it once for debug
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
|
}
|
||||||
|
const paginationPage = (await this.http.getJson(availableVersionsUrl)).result;
|
||||||
|
if (!paginationPage || paginationPage.length === 0) {
|
||||||
|
// stop paginating because we have reached the end of the results
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
availableVersions.push(...paginationPage);
|
||||||
|
if (paginationPage.length < pageSize) {
|
||||||
|
// a short page means this was the last one; avoid an extra empty request
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pageIndex++;
|
||||||
|
}
|
||||||
|
if (pageIndex > maxPages) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .warning */ .$e(`Reached the maximum of ${maxPages} pages while listing Zulu versions; results may be truncated.`);
|
||||||
|
}
|
||||||
|
if (_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .isDebug */ ._o()) {
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .startGroup */ .Oh('Print information about available versions');
|
||||||
|
console.timeEnd('Retrieving available versions for Zulu took'); // eslint-disable-line no-console
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(`Available versions: [${availableVersions.length}]`);
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .debug */ .Yz(availableVersions.map(item => item.java_version.join('.')).join(', '));
|
||||||
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .endGroup */ .N4();
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
getArchitectureOptions() {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
return 'x64';
|
||||||
|
case 'x86':
|
||||||
|
// The Azul Metadata API's "x86" value returns both 32-bit (i686) and
|
||||||
|
// 64-bit (x64) packages, which are indistinguishable by version and
|
||||||
|
// would let a 32-bit request resolve to a 64-bit JDK. Use "i686" to
|
||||||
|
// target only genuine 32-bit builds, matching the legacy API behavior.
|
||||||
|
return 'i686';
|
||||||
|
case 'armv7':
|
||||||
|
return 'arm';
|
||||||
|
case 'aarch64':
|
||||||
|
case 'arm64':
|
||||||
|
return 'aarch64';
|
||||||
|
default:
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getPlatformOption() {
|
||||||
|
// Azul has own platform names so need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
// The new Metadata API's "linux" value returns both glibc and musl packages;
|
||||||
|
// use "linux_glibc" to target only glibc, which is what standard runners use.
|
||||||
|
return 'linux_glibc';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
Vendored
+3232
-68528
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -9,7 +9,7 @@
|
|||||||
"node": ">=24.0.0"
|
"node": ">=24.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
|
"build": "node scripts/patch-is-unsafe.mjs && ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
|
||||||
"format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"",
|
"format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"",
|
||||||
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
|
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
|
||||||
"lint": "eslint \"**/*.ts\"",
|
"lint": "eslint \"**/*.ts\"",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"fix": "npm run format && npm run lint:fix && npm run build",
|
"fix": "npm run format && npm run lint:fix && npm run build",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"prerelease": "npm run-script build",
|
"prerelease": "npm run-script build",
|
||||||
"release": "git add -f dist/setup/index.js dist/cleanup/index.js",
|
"release": "git add -f dist/setup/*.js dist/setup/package.json dist/cleanup/index.js",
|
||||||
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand --coverage"
|
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand --coverage"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import {readFile, writeFile} from 'node:fs/promises';
|
||||||
|
|
||||||
|
const sourcePath = new URL('../node_modules/is-unsafe/src/contexts/xml.js', import.meta.url);
|
||||||
|
const vulnerablePattern = 'pattern: /-->/,';
|
||||||
|
const safePattern = 'pattern: /--!?>/,';
|
||||||
|
const source = await readFile(sourcePath, 'utf8');
|
||||||
|
|
||||||
|
// CodeQL treats this XML detector as an incomplete HTML comment-end filter.
|
||||||
|
if (source.includes(safePattern)) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const occurrences = source.split(vulnerablePattern).length - 1;
|
||||||
|
if (occurrences !== 1) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected one ${JSON.stringify(vulnerablePattern)} in ${sourcePath.pathname}, found ${occurrences}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeFile(sourcePath, source.replace(vulnerablePattern, safePattern));
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import {isGhes} from './util.js';
|
||||||
|
|
||||||
|
export function isCacheFeatureAvailable(): boolean {
|
||||||
|
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;
|
||||||
|
}
|
||||||
+1
-1
@@ -2,7 +2,6 @@ import * as core from '@actions/core';
|
|||||||
import * as gpg from './gpg.js';
|
import * as gpg from './gpg.js';
|
||||||
import * as constants from './constants.js';
|
import * as constants from './constants.js';
|
||||||
import {getBooleanInput, isJobStatusSuccess} from './util.js';
|
import {getBooleanInput, isJobStatusSuccess} from './util.js';
|
||||||
import {save} from './cache.js';
|
|
||||||
import {fileURLToPath} from 'url';
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
async function removePrivateKeyFromKeychain() {
|
async function removePrivateKeyFromKeychain() {
|
||||||
@@ -37,6 +36,7 @@ async function saveCache() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {save} = await import('./cache.js');
|
||||||
await save(cache);
|
await save(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,14 @@
|
|||||||
import {JavaBase} from './base-installer.js';
|
import {JavaBase} from './base-installer.js';
|
||||||
import {JavaInstallerOptions} from './base-models.js';
|
import {JavaInstallerOptions} from './base-models.js';
|
||||||
import {LocalDistribution} from './local/installer.js';
|
|
||||||
import {ZuluDistribution} from './zulu/installer.js';
|
|
||||||
import {AdoptDistribution, AdoptImplementation} from './adopt/installer.js';
|
|
||||||
import {
|
|
||||||
TemurinDistribution,
|
|
||||||
TemurinImplementation
|
|
||||||
} from './temurin/installer.js';
|
|
||||||
import {LibericaDistributions} from './liberica/installer.js';
|
|
||||||
import {LibericaNikDistributions} from './liberica-nik/installer.js';
|
|
||||||
import {MicrosoftDistributions} from './microsoft/installer.js';
|
|
||||||
import {SemeruDistribution} from './semeru/installer.js';
|
|
||||||
import {CorrettoDistribution} from './corretto/installer.js';
|
|
||||||
import {OracleDistribution} from './oracle/installer.js';
|
|
||||||
import {DragonwellDistribution} from './dragonwell/installer.js';
|
|
||||||
import {SapMachineDistribution} from './sapmachine/installer.js';
|
|
||||||
import {
|
|
||||||
GraalVMCommunityDistribution,
|
|
||||||
GraalVMDistribution
|
|
||||||
} from './graalvm/installer.js';
|
|
||||||
import {JetBrainsDistribution} from './jetbrains/installer.js';
|
|
||||||
import {KonaDistribution} from './kona/installer.js';
|
|
||||||
import {OpenJdkDistribution} from './openjdk/installer.js';
|
|
||||||
import {JavaDistribution, validateJavaPackage} from './package-types.js';
|
import {JavaDistribution, validateJavaPackage} from './package-types.js';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import {validateJavaPlatform} from './platform-types.js';
|
import {validateJavaPlatform} from './platform-types.js';
|
||||||
|
|
||||||
export function getJavaDistribution(
|
export async function getJavaDistribution(
|
||||||
distributionName: string,
|
distributionName: string,
|
||||||
installerOptions: JavaInstallerOptions,
|
installerOptions: JavaInstallerOptions,
|
||||||
jdkFile?: string
|
jdkFile?: string
|
||||||
): JavaBase | null {
|
): Promise<JavaBase | null> {
|
||||||
validateJavaPackage(
|
validateJavaPackage(
|
||||||
distributionName,
|
distributionName,
|
||||||
installerOptions.packageType,
|
installerOptions.packageType,
|
||||||
@@ -48,52 +26,95 @@ export function getJavaDistribution(
|
|||||||
};
|
};
|
||||||
|
|
||||||
switch (distributionName) {
|
switch (distributionName) {
|
||||||
case JavaDistribution.JdkFile:
|
case JavaDistribution.JdkFile: {
|
||||||
|
const {LocalDistribution} = await import('./local/installer.js');
|
||||||
return new LocalDistribution(normalizedInstallerOptions, jdkFile);
|
return new LocalDistribution(normalizedInstallerOptions, jdkFile);
|
||||||
|
}
|
||||||
case JavaDistribution.Adopt:
|
case JavaDistribution.Adopt:
|
||||||
case JavaDistribution.AdoptHotspot:
|
case JavaDistribution.AdoptHotspot: {
|
||||||
|
const {AdoptDistribution, AdoptImplementation} =
|
||||||
|
await import('./adopt/installer.js');
|
||||||
return new AdoptDistribution(
|
return new AdoptDistribution(
|
||||||
normalizedInstallerOptions,
|
normalizedInstallerOptions,
|
||||||
AdoptImplementation.Hotspot
|
AdoptImplementation.Hotspot
|
||||||
);
|
);
|
||||||
case JavaDistribution.AdoptOpenJ9:
|
}
|
||||||
|
case JavaDistribution.AdoptOpenJ9: {
|
||||||
|
const {AdoptDistribution, AdoptImplementation} =
|
||||||
|
await import('./adopt/installer.js');
|
||||||
return new AdoptDistribution(
|
return new AdoptDistribution(
|
||||||
normalizedInstallerOptions,
|
normalizedInstallerOptions,
|
||||||
AdoptImplementation.OpenJ9
|
AdoptImplementation.OpenJ9
|
||||||
);
|
);
|
||||||
case JavaDistribution.Temurin:
|
}
|
||||||
|
case JavaDistribution.Temurin: {
|
||||||
|
const {TemurinDistribution, TemurinImplementation} =
|
||||||
|
await import('./temurin/installer.js');
|
||||||
return new TemurinDistribution(
|
return new TemurinDistribution(
|
||||||
normalizedInstallerOptions,
|
normalizedInstallerOptions,
|
||||||
TemurinImplementation.Hotspot
|
TemurinImplementation.Hotspot
|
||||||
);
|
);
|
||||||
case JavaDistribution.Zulu:
|
}
|
||||||
|
case JavaDistribution.Zulu: {
|
||||||
|
const {ZuluDistribution} = await import('./zulu/installer.js');
|
||||||
return new ZuluDistribution(normalizedInstallerOptions);
|
return new ZuluDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Liberica:
|
}
|
||||||
|
case JavaDistribution.Liberica: {
|
||||||
|
const {LibericaDistributions} = await import('./liberica/installer.js');
|
||||||
return new LibericaDistributions(normalizedInstallerOptions);
|
return new LibericaDistributions(normalizedInstallerOptions);
|
||||||
case JavaDistribution.LibericaNik:
|
}
|
||||||
|
case JavaDistribution.LibericaNik: {
|
||||||
|
const {LibericaNikDistributions} =
|
||||||
|
await import('./liberica-nik/installer.js');
|
||||||
return new LibericaNikDistributions(normalizedInstallerOptions);
|
return new LibericaNikDistributions(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Microsoft:
|
}
|
||||||
|
case JavaDistribution.Microsoft: {
|
||||||
|
const {MicrosoftDistributions} = await import('./microsoft/installer.js');
|
||||||
return new MicrosoftDistributions(normalizedInstallerOptions);
|
return new MicrosoftDistributions(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Semeru:
|
}
|
||||||
|
case JavaDistribution.Semeru: {
|
||||||
|
const {SemeruDistribution} = await import('./semeru/installer.js');
|
||||||
return new SemeruDistribution(normalizedInstallerOptions);
|
return new SemeruDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Corretto:
|
}
|
||||||
|
case JavaDistribution.Corretto: {
|
||||||
|
const {CorrettoDistribution} = await import('./corretto/installer.js');
|
||||||
return new CorrettoDistribution(normalizedInstallerOptions);
|
return new CorrettoDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Oracle:
|
}
|
||||||
|
case JavaDistribution.Oracle: {
|
||||||
|
const {OracleDistribution} = await import('./oracle/installer.js');
|
||||||
return new OracleDistribution(normalizedInstallerOptions);
|
return new OracleDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Dragonwell:
|
}
|
||||||
|
case JavaDistribution.Dragonwell: {
|
||||||
|
const {DragonwellDistribution} =
|
||||||
|
await import('./dragonwell/installer.js');
|
||||||
return new DragonwellDistribution(normalizedInstallerOptions);
|
return new DragonwellDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.SapMachine:
|
}
|
||||||
|
case JavaDistribution.SapMachine: {
|
||||||
|
const {SapMachineDistribution} =
|
||||||
|
await import('./sapmachine/installer.js');
|
||||||
return new SapMachineDistribution(normalizedInstallerOptions);
|
return new SapMachineDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.GraalVM:
|
}
|
||||||
|
case JavaDistribution.GraalVM: {
|
||||||
|
const {GraalVMDistribution} = await import('./graalvm/installer.js');
|
||||||
return new GraalVMDistribution(normalizedInstallerOptions);
|
return new GraalVMDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.GraalVMCommunity:
|
}
|
||||||
|
case JavaDistribution.GraalVMCommunity: {
|
||||||
|
const {GraalVMCommunityDistribution} =
|
||||||
|
await import('./graalvm/installer.js');
|
||||||
return new GraalVMCommunityDistribution(normalizedInstallerOptions);
|
return new GraalVMCommunityDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.JetBrains:
|
}
|
||||||
|
case JavaDistribution.JetBrains: {
|
||||||
|
const {JetBrainsDistribution} = await import('./jetbrains/installer.js');
|
||||||
return new JetBrainsDistribution(normalizedInstallerOptions);
|
return new JetBrainsDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.Kona:
|
}
|
||||||
|
case JavaDistribution.Kona: {
|
||||||
|
const {KonaDistribution} = await import('./kona/installer.js');
|
||||||
return new KonaDistribution(normalizedInstallerOptions);
|
return new KonaDistribution(normalizedInstallerOptions);
|
||||||
case JavaDistribution.OracleOpenJdk:
|
}
|
||||||
|
case JavaDistribution.OracleOpenJdk: {
|
||||||
|
const {OpenJdkDistribution} = await import('./openjdk/installer.js');
|
||||||
return new OpenJdkDistribution(normalizedInstallerOptions);
|
return new OpenJdkDistribution(normalizedInstallerOptions);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+62
-38
@@ -1,14 +1,9 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as auth from './auth.js';
|
import * as auth from './auth.js';
|
||||||
import {
|
import {getBooleanInput, getVersionFromFileContent} from './util.js';
|
||||||
getBooleanInput,
|
|
||||||
isCacheFeatureAvailable,
|
|
||||||
getVersionFromFileContent
|
|
||||||
} from './util.js';
|
|
||||||
import * as toolchains from './toolchains.js';
|
import * as toolchains from './toolchains.js';
|
||||||
import * as constants from './constants.js';
|
import * as constants from './constants.js';
|
||||||
import {restore} from './cache.js';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {fileURLToPath} from 'url';
|
import {fileURLToPath} from 'url';
|
||||||
import {getJavaDistribution} from './distributions/distribution-factory.js';
|
import {getJavaDistribution} from './distributions/distribution-factory.js';
|
||||||
@@ -17,34 +12,32 @@ import {configureMavenArgs} from './maven-args.js';
|
|||||||
import {configureProblemMatcher} from './problem-matcher.js';
|
import {configureProblemMatcher} from './problem-matcher.js';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
||||||
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
let distributionName = core.getInput(constants.INPUT_DISTRIBUTION);
|
||||||
let distributionName = core.getInput(constants.INPUT_DISTRIBUTION);
|
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
|
||||||
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
|
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
|
||||||
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
|
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
|
||||||
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
|
const jdkFile = getJdkFileInput();
|
||||||
const jdkFile = getJdkFileInput();
|
const cache = core.getInput(constants.INPUT_CACHE);
|
||||||
const cache = core.getInput(constants.INPUT_CACHE);
|
const cacheDependencyPath = core.getInput(
|
||||||
const cacheDependencyPath = core.getInput(
|
constants.INPUT_CACHE_DEPENDENCY_PATH
|
||||||
constants.INPUT_CACHE_DEPENDENCY_PATH
|
);
|
||||||
);
|
const cachePath = core.getMultilineInput(constants.INPUT_CACHE_PATH);
|
||||||
const cachePath = core.getMultilineInput(constants.INPUT_CACHE_PATH);
|
const checkLatest = getBooleanInput(constants.INPUT_CHECK_LATEST, false);
|
||||||
const checkLatest = getBooleanInput(constants.INPUT_CHECK_LATEST, false);
|
const forceDownload = getBooleanInput(constants.INPUT_FORCE_DOWNLOAD, false);
|
||||||
const forceDownload = getBooleanInput(
|
const setDefault = getBooleanInput(constants.INPUT_SET_DEFAULT, true);
|
||||||
constants.INPUT_FORCE_DOWNLOAD,
|
const verifySignature = getBooleanInput(
|
||||||
false
|
constants.INPUT_VERIFY_SIGNATURE,
|
||||||
);
|
false
|
||||||
const setDefault = getBooleanInput(constants.INPUT_SET_DEFAULT, true);
|
);
|
||||||
const verifySignature = getBooleanInput(
|
const verifySignaturePublicKey =
|
||||||
constants.INPUT_VERIFY_SIGNATURE,
|
core.getInput(constants.INPUT_VERIFY_SIGNATURE_PUBLIC_KEY) || undefined;
|
||||||
false
|
const toolchainIds = core.getMultilineInput(constants.INPUT_MVN_TOOLCHAIN_ID);
|
||||||
);
|
|
||||||
const verifySignaturePublicKey =
|
|
||||||
core.getInput(constants.INPUT_VERIFY_SIGNATURE_PUBLIC_KEY) || undefined;
|
|
||||||
const toolchainIds = core.getMultilineInput(
|
|
||||||
constants.INPUT_MVN_TOOLCHAIN_ID
|
|
||||||
);
|
|
||||||
|
|
||||||
|
let actionError: Error | undefined;
|
||||||
|
let cacheRestore: Promise<void> | undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
core.startGroup('Installed distributions');
|
core.startGroup('Installed distributions');
|
||||||
|
|
||||||
if (!versions.length && !versionFile) {
|
if (!versions.length && !versionFile) {
|
||||||
@@ -97,6 +90,9 @@ export async function run() {
|
|||||||
toolchainIds
|
toolchainIds
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cacheRestore = cache
|
||||||
|
? startCacheRestore(cache, cacheDependencyPath, cachePath)
|
||||||
|
: undefined;
|
||||||
await installVersion(versionInfo.version, installerInputsOptions);
|
await installVersion(versionInfo.version, installerInputsOptions);
|
||||||
} else {
|
} else {
|
||||||
// When using java-version input, distribution is still required
|
// When using java-version input, distribution is still required
|
||||||
@@ -117,6 +113,9 @@ export async function run() {
|
|||||||
toolchainIds
|
toolchainIds
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cacheRestore = cache
|
||||||
|
? startCacheRestore(cache, cacheDependencyPath, cachePath)
|
||||||
|
: undefined;
|
||||||
for (const [index, version] of versions.entries()) {
|
for (const [index, version] of versions.entries()) {
|
||||||
await installVersion(version, installerInputsOptions, index);
|
await installVersion(version, installerInputsOptions, index);
|
||||||
}
|
}
|
||||||
@@ -132,11 +131,22 @@ export async function run() {
|
|||||||
|
|
||||||
await auth.configureAuthentication();
|
await auth.configureAuthentication();
|
||||||
configureMavenArgs();
|
configureMavenArgs();
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
|
||||||
await restore(cache, cacheDependencyPath, cachePath);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message);
|
actionError = error as Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cacheRestore) {
|
||||||
|
try {
|
||||||
|
await cacheRestore;
|
||||||
|
} catch (error) {
|
||||||
|
if (!actionError) {
|
||||||
|
actionError = error as Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actionError) {
|
||||||
|
core.setFailed(actionError.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +199,7 @@ async function installVersion(
|
|||||||
version
|
version
|
||||||
};
|
};
|
||||||
|
|
||||||
const distribution = getJavaDistribution(
|
const distribution = await getJavaDistribution(
|
||||||
distributionName,
|
distributionName,
|
||||||
installerOptions,
|
installerOptions,
|
||||||
jdkFile
|
jdkFile
|
||||||
@@ -234,3 +244,17 @@ interface installerInputsOptions {
|
|||||||
jdkFile: string;
|
jdkFile: string;
|
||||||
toolchainIds: Array<string>;
|
toolchainIds: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function startCacheRestore(
|
||||||
|
cache: string,
|
||||||
|
cacheDependencyPath: string,
|
||||||
|
cachePath: string[]
|
||||||
|
): Promise<void> {
|
||||||
|
const {isCacheFeatureAvailable} = await import('./cache-feature.js');
|
||||||
|
if (!isCacheFeatureAvailable()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {restore} = await import('./cache.js');
|
||||||
|
await restore(cache, cacheDependencyPath, cachePath);
|
||||||
|
}
|
||||||
|
|||||||
-19
@@ -2,7 +2,6 @@ import os from 'os';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as cache from '@actions/cache';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
@@ -126,24 +125,6 @@ export function isGhes(): boolean {
|
|||||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheFeatureAvailable(): boolean {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface VersionInfo {
|
export interface VersionInfo {
|
||||||
version: string;
|
version: string;
|
||||||
distribution?: string;
|
distribution?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user