Compare commits

..

2 Commits

Author SHA1 Message Date
Accelerator1996
784bb48b94
Merge ec1af222f0 into 4075bfc1b5 2023-09-04 07:30:29 +00:00
lvfei.lv
ec1af222f0 add support for dragonwell 2023-09-04 15:30:11 +08:00
3 changed files with 16 additions and 49 deletions

View File

@ -51,7 +51,8 @@ describe('getAvailableVersions', () => {
['8', 'x86', 'mac', 0],
['11', 'x64', 'linux', 36],
['11', 'aarch64', 'linux', 33],
['17', 'riscv', 'linux', 0]
['17', 'riscv', 'linux', 0],
['16.0.1', 'x64', 'linux', 36]
])(
'load available versions',
async (
@ -73,23 +74,6 @@ 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', () => {
@ -220,7 +204,9 @@ describe('getAvailableVersions', () => {
await expect(
distribution['findPackageForDownload'](jdkVersion)
).rejects.toThrow(`Cannot find satisfied version for ${jdkVersion}.`);
).rejects.toThrow(
`Couldn't find any satisfied version for the specified: "${jdkVersion}".`
);
}
);
});

19
dist/setup/index.js vendored
View File

@ -102673,13 +102673,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
url: item.download_link
};
});
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}`);
if (!matchedVersions.length) {
throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`);
}
const resolvedVersion = matchedVersions[0];
return resolvedVersion;
});
}
@ -102688,17 +102685,11 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
return __awaiter(this, void 0, void 0, function* () {
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://dragonwell-jdk.io/map_with_checksum.json';
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl))
.result) !== null && _a !== void 0 ? _a : {};
if (Object.keys(fetchedDragonwellVersions).length == 0) {
throw Error(`Could fetch any dragonwell versions from ${availableVersionsUrl}`);
throw Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`);
}
const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions);
if (core.isDebug()) {

View File

@ -40,16 +40,13 @@ export class DragonwellDistribution extends JavaBase {
url: item.download_link
} as JavaDownloadRelease;
});
const resolvedVersion =
matchedVersions.length > 0 ? matchedVersions[0] : null;
if (!resolvedVersion) {
const versionsMsg = core.isDebug()
? `Available versions: ${availableVersions}`
: '';
if (!matchedVersions.length) {
throw new Error(
`Cannot find satisfied version for ${version}.${versionsMsg}`
`Couldn't find any satisfied version for the specified: "${version}".`
);
}
const resolvedVersion = matchedVersions[0];
return resolvedVersion;
}
@ -57,22 +54,15 @@ 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://dragonwell-jdk.io/map_with_checksum.json';
'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
const fetchedDragonwellVersions =
(await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl))
.result ?? {};
if (Object.keys(fetchedDragonwellVersions).length == 0) {
throw Error(
`Could fetch any dragonwell versions from ${availableVersionsUrl}`
`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`
);
}
const availableVersions = this.getEligibleAvailableVersions(