mirror of
https://github.com/actions/setup-java.git
synced 2026-06-26 23:17:54 +00:00
Compare commits
2 Commits
784bb48b94
...
f2770c47c7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2770c47c7 | ||
|
|
d72fe4f5e7 |
@ -51,8 +51,7 @@ describe('getAvailableVersions', () => {
|
||||
['8', 'x86', 'mac', 0],
|
||||
['11', 'x64', 'linux', 36],
|
||||
['11', 'aarch64', 'linux', 33],
|
||||
['17', 'riscv', 'linux', 0],
|
||||
['16.0.1', 'x64', 'linux', 36]
|
||||
['17', 'riscv', 'linux', 0]
|
||||
])(
|
||||
'load available versions',
|
||||
async (
|
||||
@ -74,6 +73,23 @@ describe('getAvailableVersions', () => {
|
||||
expect(availableVersions.length).toBe(len);
|
||||
}
|
||||
);
|
||||
|
||||
it.each(['16', '16.0.1', '19'])(
|
||||
'load unsupported versions',
|
||||
async (jdkVersion: string) => {
|
||||
const distribution = new DragonwellDistribution({
|
||||
version: jdkVersion,
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
mockPlatform(distribution, 'linux');
|
||||
|
||||
await expect(distribution['getAvailableVersions']()).rejects.toThrow(
|
||||
'Support dragonwell versions: 8, 11, 17'
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('findPackageForDownload', () => {
|
||||
@ -204,9 +220,7 @@ describe('getAvailableVersions', () => {
|
||||
|
||||
await expect(
|
||||
distribution['findPackageForDownload'](jdkVersion)
|
||||
).rejects.toThrow(
|
||||
`Couldn't find any satisfied version for the specified: "${jdkVersion}".`
|
||||
);
|
||||
).rejects.toThrow(`Cannot find satisfied version for ${jdkVersion}.`);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
19
dist/setup/index.js
vendored
19
dist/setup/index.js
vendored
@ -102673,10 +102673,13 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
url: item.download_link
|
||||
};
|
||||
});
|
||||
if (!matchedVersions.length) {
|
||||
throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`);
|
||||
const resolvedVersion = matchedVersions.length > 0 ? matchedVersions[0] : null;
|
||||
if (!resolvedVersion) {
|
||||
const versionsMsg = core.isDebug()
|
||||
? `Available versions: ${availableVersions}`
|
||||
: '';
|
||||
throw new Error(`Cannot find satisfied version for ${version}.${versionsMsg}`);
|
||||
}
|
||||
const resolvedVersion = matchedVersions[0];
|
||||
return resolvedVersion;
|
||||
});
|
||||
}
|
||||
@ -102685,11 +102688,17 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||
const majorVersion = this.version.includes('.')
|
||||
? this.version.split('.')[0]
|
||||
: this.version;
|
||||
if (['8', '11', '17'].includes(majorVersion) != true) {
|
||||
throw new Error('Support dragonwell versions: 8, 11, 17');
|
||||
}
|
||||
const availableVersionsUrl = 'https://dragonwell-jdk.io/map_with_checksum.json';
|
||||
const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl))
|
||||
.result) !== null && _a !== void 0 ? _a : {};
|
||||
if (Object.keys(fetchedDragonwellVersions).length == 0) {
|
||||
throw Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`);
|
||||
throw Error(`Could fetch any dragonwell versions from ${availableVersionsUrl}`);
|
||||
}
|
||||
const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions);
|
||||
if (core.isDebug()) {
|
||||
|
||||
@ -40,13 +40,16 @@ export class DragonwellDistribution extends JavaBase {
|
||||
url: item.download_link
|
||||
} as JavaDownloadRelease;
|
||||
});
|
||||
if (!matchedVersions.length) {
|
||||
const resolvedVersion =
|
||||
matchedVersions.length > 0 ? matchedVersions[0] : null;
|
||||
if (!resolvedVersion) {
|
||||
const versionsMsg = core.isDebug()
|
||||
? `Available versions: ${availableVersions}`
|
||||
: '';
|
||||
throw new Error(
|
||||
`Couldn't find any satisfied version for the specified: "${version}".`
|
||||
`Cannot find satisfied version for ${version}.${versionsMsg}`
|
||||
);
|
||||
}
|
||||
|
||||
const resolvedVersion = matchedVersions[0];
|
||||
return resolvedVersion;
|
||||
}
|
||||
|
||||
@ -54,15 +57,22 @@ export class DragonwellDistribution extends JavaBase {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
|
||||
const majorVersion = this.version.includes('.')
|
||||
? this.version.split('.')[0]
|
||||
: this.version;
|
||||
if (['8', '11', '17'].includes(majorVersion) != true) {
|
||||
throw new Error('Support dragonwell versions: 8, 11, 17');
|
||||
}
|
||||
|
||||
const availableVersionsUrl =
|
||||
'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||
'https://dragonwell-jdk.io/map_with_checksum.json';
|
||||
|
||||
const fetchedDragonwellVersions =
|
||||
(await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl))
|
||||
.result ?? {};
|
||||
if (Object.keys(fetchedDragonwellVersions).length == 0) {
|
||||
throw Error(
|
||||
`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`
|
||||
`Could fetch any dragonwell versions from ${availableVersionsUrl}`
|
||||
);
|
||||
}
|
||||
const availableVersions = this.getEligibleAvailableVersions(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user