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