mirror of
https://gitea.com/actions/setup-java.git
synced 2026-05-02 07:42:06 +08:00
Compare commits
1 Commits
0756542bc5
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4076f99f8 |
@@ -17,7 +17,6 @@ describe('dependency cache', () => {
|
|||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
||||||
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
||||||
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
||||||
@@ -52,10 +51,6 @@ describe('dependency cache', () => {
|
|||||||
|
|
||||||
spySaveState = jest.spyOn(core, 'saveState');
|
spySaveState = jest.spyOn(core, 'saveState');
|
||||||
spySaveState.mockImplementation(() => null);
|
spySaveState.mockImplementation(() => null);
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -63,10 +58,6 @@ describe('dependency cache', () => {
|
|||||||
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
||||||
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
||||||
resetState();
|
resetState();
|
||||||
|
|
||||||
jest.resetAllMocks();
|
|
||||||
jest.clearAllMocks();
|
|
||||||
jest.restoreAllMocks();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('restore', () => {
|
describe('restore', () => {
|
||||||
|
|||||||
@@ -11,32 +11,19 @@ describe('cleanup', () => {
|
|||||||
Parameters<typeof cache.saveCache>
|
Parameters<typeof cache.saveCache>
|
||||||
>;
|
>;
|
||||||
let spyJobStatusSuccess: jest.SpyInstance;
|
let spyJobStatusSuccess: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
spyWarning = jest.spyOn(core, 'warning');
|
||||||
spyWarning.mockImplementation(() => null);
|
spyWarning.mockImplementation(() => null);
|
||||||
|
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
spyInfo = jest.spyOn(core, 'info');
|
||||||
spyInfo.mockImplementation(() => null);
|
spyInfo.mockImplementation(() => null);
|
||||||
|
|
||||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
||||||
|
|
||||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
||||||
spyJobStatusSuccess.mockReturnValue(true);
|
spyJobStatusSuccess.mockReturnValue(true);
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
|
|
||||||
createStateForSuccessfulRestore();
|
createStateForSuccessfulRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
resetState();
|
resetState();
|
||||||
jest.resetAllMocks();
|
|
||||||
jest.clearAllMocks();
|
|
||||||
jest.restoreAllMocks();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import manifestData from '../data/adopt.json';
|
import manifestData from '../data/adopt.json';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -22,10 +20,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -268,7 +262,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/No matching version found for SemVer */);
|
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -283,7 +277,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -299,7 +293,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class EmptyJavaBase extends JavaBase {
|
|||||||
): Promise<JavaDownloadRelease> {
|
): Promise<JavaDownloadRelease> {
|
||||||
const availableVersion = '11.0.9';
|
const availableVersion = '11.0.9';
|
||||||
if (!semver.satisfies(availableVersion, range)) {
|
if (!semver.satisfies(availableVersion, range)) {
|
||||||
throw this.createVersionNotFoundError(range, [availableVersion]);
|
throw new Error('Available version not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -248,7 +248,6 @@ describe('setupJava', () => {
|
|||||||
let spyCoreExportVariable: jest.SpyInstance;
|
let spyCoreExportVariable: jest.SpyInstance;
|
||||||
let spyCoreAddPath: jest.SpyInstance;
|
let spyCoreAddPath: jest.SpyInstance;
|
||||||
let spyCoreSetOutput: jest.SpyInstance;
|
let spyCoreSetOutput: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
||||||
@@ -288,10 +287,6 @@ describe('setupJava', () => {
|
|||||||
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
||||||
spyCoreSetOutput.mockImplementation(() => undefined);
|
spyCoreSetOutput.mockImplementation(() => undefined);
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => undefined);
|
|
||||||
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -535,16 +530,19 @@ describe('setupJava', () => {
|
|||||||
checkLatest: false
|
checkLatest: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
])('should throw an error for version not found for %s', async input => {
|
])(
|
||||||
mockJavaBase = new EmptyJavaBase(input);
|
'should throw an error for Available version not found for %s',
|
||||||
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
async input => {
|
||||||
`No matching version found for SemVer '${input.version}'`
|
mockJavaBase = new EmptyJavaBase(input);
|
||||||
);
|
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
||||||
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
'Available version not found'
|
||||||
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
);
|
||||||
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
||||||
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
||||||
});
|
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
||||||
|
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('normalizeVersion', () => {
|
describe('normalizeVersion', () => {
|
||||||
@@ -572,97 +570,6 @@ describe('normalizeVersion', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('createVersionNotFoundError', () => {
|
|
||||||
it('should include all required fields in error message without available versions', () => {
|
|
||||||
const mockJavaBase = new EmptyJavaBase({
|
|
||||||
version: '17.0.5',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
|
|
||||||
const error = (mockJavaBase as any).createVersionNotFoundError('17.0.5');
|
|
||||||
|
|
||||||
expect(error.message).toContain(
|
|
||||||
"No matching version found for SemVer '17.0.5'"
|
|
||||||
);
|
|
||||||
expect(error.message).toContain('Distribution: Empty');
|
|
||||||
expect(error.message).toContain('Package type: jdk');
|
|
||||||
expect(error.message).toContain('Architecture: x64');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should include available versions when provided', () => {
|
|
||||||
const mockJavaBase = new EmptyJavaBase({
|
|
||||||
version: '17.0.5',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
|
|
||||||
const availableVersions = ['11.0.1', '11.0.2', '17.0.1', '17.0.2'];
|
|
||||||
const error = (mockJavaBase as any).createVersionNotFoundError(
|
|
||||||
'17.0.5',
|
|
||||||
availableVersions
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(error.message).toContain(
|
|
||||||
"No matching version found for SemVer '17.0.5'"
|
|
||||||
);
|
|
||||||
expect(error.message).toContain('Distribution: Empty');
|
|
||||||
expect(error.message).toContain('Package type: jdk');
|
|
||||||
expect(error.message).toContain('Architecture: x64');
|
|
||||||
expect(error.message).toContain(
|
|
||||||
'Available versions: 11.0.1, 11.0.2, 17.0.1, 17.0.2'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should truncate available versions when there are many', () => {
|
|
||||||
const mockJavaBase = new EmptyJavaBase({
|
|
||||||
version: '17.0.5',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create 60 versions to test truncation
|
|
||||||
const availableVersions = Array.from({length: 60}, (_, i) => `11.0.${i}`);
|
|
||||||
const error = (mockJavaBase as any).createVersionNotFoundError(
|
|
||||||
'17.0.5',
|
|
||||||
availableVersions
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(error.message).toContain('Available versions:');
|
|
||||||
expect(error.message).toContain('...');
|
|
||||||
expect(error.message).toContain('(showing first 50 of 60 versions');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should include additional context when provided', () => {
|
|
||||||
const mockJavaBase = new EmptyJavaBase({
|
|
||||||
version: '17.0.5',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
|
|
||||||
const availableVersions = ['11.0.1', '11.0.2'];
|
|
||||||
const additionalContext = 'Platform: linux';
|
|
||||||
const error = (mockJavaBase as any).createVersionNotFoundError(
|
|
||||||
'17.0.5',
|
|
||||||
availableVersions,
|
|
||||||
additionalContext
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(error.message).toContain(
|
|
||||||
"No matching version found for SemVer '17.0.5'"
|
|
||||||
);
|
|
||||||
expect(error.message).toContain('Distribution: Empty');
|
|
||||||
expect(error.message).toContain('Package type: jdk');
|
|
||||||
expect(error.message).toContain('Architecture: x64');
|
|
||||||
expect(error.message).toContain('Platform: linux');
|
|
||||||
expect(error.message).toContain('Available versions: 11.0.1, 11.0.2');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getToolcacheVersionName', () => {
|
describe('getToolcacheVersionName', () => {
|
||||||
const DummyJavaBase = JavaBase as any;
|
const DummyJavaBase = JavaBase as any;
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
||||||
import * as util from '../../src/util';
|
import * as util from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
import {isGeneratorFunction} from 'util/types';
|
||||||
|
|
||||||
import manifestData from '../data/corretto.json';
|
import manifestData from '../data/corretto.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -24,10 +23,6 @@ describe('getAvailableVersions', () => {
|
|||||||
util,
|
util,
|
||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -203,7 +198,7 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](version)
|
distribution['findPackageForDownload'](version)
|
||||||
).rejects.toThrow("No matching version found for SemVer '4'");
|
).rejects.toThrow("Could not find satisfied version for SemVer '4'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/dragonwell.json';
|
import manifestData from '../data/dragonwell.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -23,10 +21,6 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -238,7 +232,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](jdkVersion)
|
distribution['findPackageForDownload'](jdkVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`No matching version found for SemVer '${jdkVersion}'`
|
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ beforeAll(() => {
|
|||||||
describe('GraalVMDistribution', () => {
|
describe('GraalVMDistribution', () => {
|
||||||
let distribution: GraalVMDistribution;
|
let distribution: GraalVMDistribution;
|
||||||
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
const defaultOptions: JavaInstallerOptions = {
|
const defaultOptions: JavaInstallerOptions = {
|
||||||
version: '17',
|
version: '17',
|
||||||
@@ -60,10 +59,6 @@ describe('GraalVMDistribution', () => {
|
|||||||
(distribution as any).http = mockHttpClient;
|
(distribution as any).http = mockHttpClient;
|
||||||
|
|
||||||
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
@@ -353,19 +348,11 @@ describe('GraalVMDistribution', () => {
|
|||||||
} as http.HttpClientResponse;
|
} as http.HttpClientResponse;
|
||||||
mockHttpClient.head.mockResolvedValue(mockResponse);
|
mockHttpClient.head.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
// Verify the error is thrown with the expected message
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
).rejects.toThrow("No matching version found for SemVer '17.0.99'");
|
).rejects.toThrow(
|
||||||
// Verify distribution info is included
|
'Could not find GraalVM for SemVer 17.0.99. Please check if this version is available at https://download.oracle.com/graalvm'
|
||||||
await expect(
|
);
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
|
||||||
).rejects.toThrow('GraalVM');
|
|
||||||
|
|
||||||
// Verify the hint about checking the base URL is included
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
|
||||||
).rejects.toThrow('https://www.graalvm.org/downloads/');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for unauthorized access (401)', async () => {
|
it('should throw error for unauthorized access (401)', async () => {
|
||||||
@@ -509,19 +496,12 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('23')
|
(distribution as any).findPackageForDownload('23')
|
||||||
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
||||||
|
|
||||||
await expect(
|
// Verify error logging
|
||||||
(distribution as any).findPackageForDownload('23')
|
expect(core.error).toHaveBeenCalledWith(
|
||||||
).rejects.toThrow(
|
'Available versions: 23-ea-20240716'
|
||||||
'Note: No EA build is marked as latest for this version.'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findPackageForDownload('23')
|
|
||||||
).rejects.toThrow('23-ea-20240716');
|
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture in EA build', async () => {
|
it('should throw error when no matching file for architecture in EA build', async () => {
|
||||||
@@ -728,19 +708,11 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
||||||
|
|
||||||
await expect(
|
expect(core.error).toHaveBeenCalledWith(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
'Available versions: 23-ea-20240716, 23-ea-20240709'
|
||||||
).rejects.toThrow(
|
|
||||||
'Note: No EA build is marked as latest for this version.'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
|
||||||
).rejects.toThrow('23-ea-20240716');
|
|
||||||
|
|
||||||
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture', async () => {
|
it('should throw error when no matching file for architecture', async () => {
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer
|
|||||||
|
|
||||||
import manifestData from '../data/jetbrains.json';
|
import manifestData from '../data/jetbrains.json';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -17,10 +15,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -104,7 +98,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -117,7 +111,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/liberica.json';
|
import manifestData from '../data/liberica.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -20,10 +18,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -215,7 +209,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
||||||
/No matching version found for SemVer/
|
/Could not find satisfied version for semver */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/liberica-linux.json';
|
import manifestData from '../data/liberica-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -20,10 +18,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -215,7 +209,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/No matching version found for SemVer/
|
/Could not find satisfied version for semver */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/liberica-windows.json';
|
import manifestData from '../data/liberica-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -20,9 +18,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -214,7 +209,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/No matching version found for SemVer/
|
/Could not find satisfied version for semver */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ describe('setupJava', () => {
|
|||||||
let spyFsReadDir: jest.SpyInstance;
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
||||||
let spyPathResolve: jest.SpyInstance;
|
let spyPathResolve: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
const expectedJdkFile = 'JavaLocalJdkFile';
|
const expectedJdkFile = 'JavaLocalJdkFile';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -94,10 +93,6 @@ describe('setupJava', () => {
|
|||||||
// Spy on path methods
|
// Spy on path methods
|
||||||
spyPathResolve = jest.spyOn(path, 'resolve');
|
spyPathResolve = jest.spyOn(path, 'resolve');
|
||||||
spyPathResolve.mockImplementation((path: string) => path);
|
spyPathResolve.mockImplementation((path: string) => path);
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: MicrosoftDistributions;
|
let distribution: MicrosoftDistributions;
|
||||||
let spyGetManifestFromRepo: jest.SpyInstance;
|
let spyGetManifestFromRepo: jest.SpyInstance;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new MicrosoftDistributions({
|
distribution = new MicrosoftDistributions({
|
||||||
@@ -27,10 +26,6 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
@@ -179,7 +174,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: OracleDistribution;
|
let distribution: OracleDistribution;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new OracleDistribution({
|
distribution = new OracleDistribution({
|
||||||
@@ -20,10 +19,6 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/sapmachine.json';
|
import manifestData from '../data/sapmachine.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -23,10 +21,6 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -272,7 +266,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](normalizedVersion)
|
distribution['findPackageForDownload'](normalizedVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`No matching version found for SemVer '${normalizedVersion}'`
|
`Couldn't find any satisfied version for the specified java-version: "${normalizedVersion}" and architecture: "${arch}".`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
||||||
|
|
||||||
import manifestData from '../data/semeru.json';
|
import manifestData from '../data/semeru.json';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -17,9 +15,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -157,7 +152,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/No matching version found for SemVer */);
|
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -169,7 +164,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -182,7 +177,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import {
|
|||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
||||||
|
|
||||||
import manifestData from '../data/temurin.json';
|
import manifestData from '../data/temurin.json';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -20,9 +18,6 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -218,7 +213,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/No matching version found for SemVer */);
|
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -233,7 +228,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -249,7 +244,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/No matching version found for SemVer */
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/zulu-releases-default.json';
|
import manifestData from '../data/zulu-releases-default.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -25,10 +23,6 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -231,6 +225,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/No matching version found for SemVer/);
|
).rejects.toThrow(/Could not find satisfied version for semver */);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,14 +4,12 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/zulu-linux.json';
|
import manifestData from '../data/zulu-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -26,10 +24,6 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -234,6 +228,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/No matching version found for SemVer/);
|
).rejects.toThrow(/Could not find satisfied version for semver */);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,14 +4,12 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import * as core from '@actions/core';
|
|
||||||
|
|
||||||
import manifestData from '../data/zulu-windows.json';
|
import manifestData from '../data/zulu-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
let spyCoreError: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -26,10 +24,6 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
// Mock core.error to suppress error logs
|
|
||||||
spyCoreError = jest.spyOn(core, 'error');
|
|
||||||
spyCoreError.mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -232,6 +226,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/No matching version found for SemVer/);
|
).rejects.toThrow(/Could not find satisfied version for semver */);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
111
dist/setup/index.js
vendored
111
dist/setup/index.js
vendored
@@ -112219,8 +112219,13 @@ class AdoptDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
const availableOptions = availableVersionsWithBinaries
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
});
|
});
|
||||||
@@ -112569,28 +112574,6 @@ class JavaBase {
|
|||||||
stable
|
stable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
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() ? 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)`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Error(parts.join('\n'));
|
|
||||||
}
|
|
||||||
setJavaDefault(version, toolPath) {
|
setJavaDefault(version, toolPath) {
|
||||||
const majorVersion = version.split('.')[0];
|
const majorVersion = version.split('.')[0];
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
@@ -112712,8 +112695,13 @@ class CorrettoDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedVersion = matchingVersions.length > 0 ? matchingVersions[0] : null;
|
const resolvedVersion = matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
if (!resolvedVersion) {
|
if (!resolvedVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
const availableOptions = availableVersions
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
});
|
});
|
||||||
@@ -112947,8 +112935,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
const availableVersionStrings = availableVersions.map(item => item.jdk_version);
|
throw new Error(`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
@@ -113139,7 +113126,6 @@ const base_installer_1 = __nccwpck_require__(59741);
|
|||||||
const http_client_1 = __nccwpck_require__(96255);
|
const http_client_1 = __nccwpck_require__(96255);
|
||||||
const util_1 = __nccwpck_require__(92629);
|
const util_1 = __nccwpck_require__(92629);
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@@ -113218,10 +113204,7 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
handleHttpResponse(response, range) {
|
handleHttpResponse(response, range) {
|
||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
if (statusCode === http_client_1.HttpCodes.NotFound) {
|
if (statusCode === http_client_1.HttpCodes.NotFound) {
|
||||||
// Create the standard error with additional hint about checking the download URL
|
throw new Error(`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`);
|
||||||
const error = this.createVersionNotFoundError(range);
|
|
||||||
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
|
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
|
||||||
statusCode === http_client_1.HttpCodes.Forbidden) {
|
statusCode === http_client_1.HttpCodes.Forbidden) {
|
||||||
@@ -113238,8 +113221,8 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
|
|||||||
core.debug(`Found ${versions.length} EA versions`);
|
core.debug(`Found ${versions.length} EA versions`);
|
||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
core.error(`Available versions: ${versions.map(v => v.version).join(', ')}`);
|
||||||
throw this.createVersionNotFoundError(javaEaVersion, availableVersions, 'Note: No EA build is marked as latest for this version.');
|
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
||||||
}
|
}
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
const arch = this.distributionArchitecture();
|
const arch = this.distributionArchitecture();
|
||||||
@@ -113375,8 +113358,13 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = versionsRaw.map(item => `${item.tag_name} (${item.semver}+${item.build})`);
|
const availableOptions = versionsRaw
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
.map(item => `${item.tag_name} (${item.semver}+${item.build})`)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for SemVer '${range}'. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
});
|
});
|
||||||
@@ -113613,8 +113601,13 @@ class LibericaDistributions extends base_installer_1.JavaBase {
|
|||||||
.filter(item => (0, util_1.isVersionSatisfies)(range, item.version))
|
.filter(item => (0, util_1.isVersionSatisfies)(range, item.version))
|
||||||
.sort((a, b) => -semver_1.default.compareBuild(a.version, b.version))[0];
|
.sort((a, b) => -semver_1.default.compareBuild(a.version, b.version))[0];
|
||||||
if (!satisfiedVersion) {
|
if (!satisfiedVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
const availableOptions = availableVersions
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return satisfiedVersion;
|
return satisfiedVersion;
|
||||||
});
|
});
|
||||||
@@ -113900,8 +113893,9 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
|
|||||||
}
|
}
|
||||||
const foundRelease = yield tc.findFromManifest(range, true, manifest, arch);
|
const foundRelease = yield tc.findFromManifest(range, true, manifest, arch);
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
throw new Error(`Could not find satisfied version for SemVer ${range}.\nAvailable versions: ${manifest
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ')}`);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
url: foundRelease.files[0].download_url,
|
url: foundRelease.files[0].download_url,
|
||||||
@@ -114064,7 +114058,7 @@ class OracleDistribution extends base_installer_1.JavaBase {
|
|||||||
throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
|
throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw this.createVersionNotFoundError(range);
|
throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getPlatform(platform = process.platform) {
|
getPlatform(platform = process.platform) {
|
||||||
@@ -114156,8 +114150,7 @@ class SapMachineDistribution extends base_installer_1.JavaBase {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
throw new Error(`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
@@ -114396,11 +114389,13 @@ class SemeruDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
const availableOptions = availableVersionsWithBinaries
|
||||||
// Include platform context to help users understand OS-specific version availability
|
.map(item => item.version)
|
||||||
// IBM Semeru builds are OS-specific, so platform info aids in troubleshooting
|
.join(', ');
|
||||||
const platformContext = `Platform: ${process.platform}`;
|
const availableOptionsMessage = availableOptions
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings, platformContext);
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
});
|
});
|
||||||
@@ -114573,8 +114568,13 @@ class TemurinDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(item => item.version);
|
const availableOptions = availableVersionsWithBinaries
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
});
|
});
|
||||||
@@ -114746,8 +114746,13 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(item => item.version);
|
const availableOptions = availableVersions
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(`Could not find satisfied version for semver ${version}. ${availableOptionsMessage}`);
|
||||||
}
|
}
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
});
|
});
|
||||||
|
|||||||
82
package-lock.json
generated
82
package-lock.json
generated
@@ -13,7 +13,7 @@
|
|||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^4.0.0",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
@@ -109,15 +109,6 @@
|
|||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache/node_modules/undici": {
|
|
||||||
"version": "6.23.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
|
||||||
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.17"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.11.1",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
||||||
@@ -127,6 +118,28 @@
|
|||||||
"@actions/http-client": "^2.0.1"
|
"@actions/http-client": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
||||||
|
"version": "2.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
|
||||||
|
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "^0.0.6",
|
||||||
|
"undici": "^5.25.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@actions/core/node_modules/undici": {
|
||||||
|
"version": "5.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
||||||
|
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@fastify/busboy": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@actions/exec": {
|
"node_modules/@actions/exec": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||||
@@ -146,13 +159,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/http-client": {
|
"node_modules/@actions/http-client": {
|
||||||
"version": "2.2.3",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
|
||||||
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
|
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tunnel": "^0.0.6",
|
"tunnel": "^0.0.6",
|
||||||
"undici": "^5.25.4"
|
"undici": "^6.23.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/io": {
|
"node_modules/@actions/io": {
|
||||||
@@ -173,6 +186,16 @@
|
|||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@actions/tool-cache/node_modules/@actions/http-client": {
|
||||||
|
"version": "2.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
|
||||||
|
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "^0.0.6",
|
||||||
|
"undici": "^5.25.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@actions/tool-cache/node_modules/semver": {
|
"node_modules/@actions/tool-cache/node_modules/semver": {
|
||||||
"version": "6.3.1",
|
"version": "6.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||||
@@ -181,6 +204,18 @@
|
|||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@actions/tool-cache/node_modules/undici": {
|
||||||
|
"version": "5.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
||||||
|
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@fastify/busboy": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
|
||||||
@@ -1038,9 +1073,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/busboy": {
|
"node_modules/@fastify/busboy": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
||||||
"integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==",
|
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
@@ -5328,14 +5364,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "5.29.0",
|
"version": "6.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
||||||
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
||||||
"dependencies": {
|
"license": "MIT",
|
||||||
"@fastify/busboy": "^2.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0"
|
"node": ">=18.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^4.0.0",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
|
|||||||
@@ -54,10 +54,15 @@ export class AdoptDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(
|
const availableOptions = availableVersionsWithBinaries
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -259,42 +259,6 @@ export abstract class JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected createVersionNotFoundError(
|
|
||||||
versionOrRange: string,
|
|
||||||
availableVersions?: string[],
|
|
||||||
additionalContext?: string
|
|
||||||
): Error {
|
|
||||||
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() ? 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)`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Error(parts.join('\n'));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected setJavaDefault(version: string, toolPath: string) {
|
protected setJavaDefault(version: string, toolPath: string) {
|
||||||
const majorVersion = version.split('.')[0];
|
const majorVersion = version.split('.')[0];
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
|
|||||||
@@ -75,10 +75,15 @@ export class CorrettoDistribution extends JavaBase {
|
|||||||
const resolvedVersion =
|
const resolvedVersion =
|
||||||
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
if (!resolvedVersion) {
|
if (!resolvedVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(
|
const availableOptions = availableVersions
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,10 +51,9 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
const availableVersionStrings = availableVersions.map(
|
throw new Error(
|
||||||
item => item.jdk_version
|
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import {
|
|||||||
} from '../../util';
|
} from '../../util';
|
||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@@ -150,10 +149,9 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
|
|
||||||
if (statusCode === HttpCodes.NotFound) {
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
// Create the standard error with additional hint about checking the download URL
|
throw new Error(
|
||||||
const error = this.createVersionNotFoundError(range);
|
`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`
|
||||||
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -182,12 +180,10 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
|
|
||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
const availableVersions = versions.map(v => v.version);
|
core.error(
|
||||||
throw this.createVersionNotFoundError(
|
`Available versions: ${versions.map(v => v.version).join(', ')}`
|
||||||
javaEaVersion,
|
|
||||||
availableVersions,
|
|
||||||
'Note: No EA build is marked as latest for this version.'
|
|
||||||
);
|
);
|
||||||
|
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
|
|||||||
@@ -44,10 +44,15 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = versionsRaw.map(
|
const availableOptions = versionsRaw
|
||||||
item => `${item.tag_name} (${item.semver}+${item.build})`
|
.map(item => `${item.tag_name} (${item.semver}+${item.build})`)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for SemVer '${range}'. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -69,10 +69,15 @@ export class LibericaDistributions extends JavaBase {
|
|||||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||||
|
|
||||||
if (!satisfiedVersion) {
|
if (!satisfiedVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(
|
const availableOptions = availableVersions
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return satisfiedVersion;
|
return satisfiedVersion;
|
||||||
|
|||||||
@@ -76,8 +76,11 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
||||||
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
throw new Error(
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
`Could not find satisfied version for SemVer ${range}.\nAvailable versions: ${manifest
|
||||||
|
.map(item => item.version)
|
||||||
|
.join(', ')}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export class OracleDistribution extends JavaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw this.createVersionNotFoundError(range);
|
throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||||
|
|||||||
@@ -49,10 +49,9 @@ export class SapMachineDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
const availableVersionStrings = availableVersions.map(
|
throw new Error(
|
||||||
item => item.version
|
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@@ -79,16 +79,14 @@ export class SemeruDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(
|
const availableOptions = availableVersionsWithBinaries
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
);
|
.join(', ');
|
||||||
// Include platform context to help users understand OS-specific version availability
|
const availableOptionsMessage = availableOptions
|
||||||
// IBM Semeru builds are OS-specific, so platform info aids in troubleshooting
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
const platformContext = `Platform: ${process.platform}`;
|
: '';
|
||||||
throw this.createVersionNotFoundError(
|
throw new Error(
|
||||||
version,
|
`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`
|
||||||
availableVersionStrings,
|
|
||||||
platformContext
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,10 +57,15 @@ export class TemurinDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersionsWithBinaries.map(
|
const availableOptions = availableVersionsWithBinaries
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -57,10 +57,15 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableVersionStrings = availableVersions.map(
|
const availableOptions = availableVersions
|
||||||
item => item.version
|
.map(item => item.version)
|
||||||
|
.join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for semver ${version}. ${availableOptionsMessage}`
|
||||||
);
|
);
|
||||||
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user