mirror of
https://github.com/actions/setup-java.git
synced 2026-07-01 17:41:38 +00:00
Compare commits
2 Commits
f2770c47c7
...
784bb48b94
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
784bb48b94 | ||
|
|
ec1af222f0 |
@ -51,7 +51,8 @@ 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 (
|
||||||
@ -73,23 +74,6 @@ 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', () => {
|
||||||
@ -220,7 +204,9 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](jdkVersion)
|
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
19
dist/setup/index.js
vendored
@ -102673,13 +102673,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
|||||||
url: item.download_link
|
url: item.download_link
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const resolvedVersion = matchedVersions.length > 0 ? matchedVersions[0] : null;
|
if (!matchedVersions.length) {
|
||||||
if (!resolvedVersion) {
|
throw new Error(`Couldn't find any satisfied version for the specified: "${version}".`);
|
||||||
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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -102688,17 +102685,11 @@ 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 majorVersion = this.version.includes('.')
|
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||||
? 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(`Could fetch any dragonwell versions from ${availableVersionsUrl}`);
|
throw Error(`Couldn't 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,16 +40,13 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
url: item.download_link
|
url: item.download_link
|
||||||
} as JavaDownloadRelease;
|
} as JavaDownloadRelease;
|
||||||
});
|
});
|
||||||
const resolvedVersion =
|
if (!matchedVersions.length) {
|
||||||
matchedVersions.length > 0 ? matchedVersions[0] : null;
|
|
||||||
if (!resolvedVersion) {
|
|
||||||
const versionsMsg = core.isDebug()
|
|
||||||
? `Available versions: ${availableVersions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
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;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,22 +54,15 @@ 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://dragonwell-jdk.io/map_with_checksum.json';
|
'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.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(
|
||||||
`Could fetch any dragonwell versions from ${availableVersionsUrl}`
|
`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const availableVersions = this.getEligibleAvailableVersions(
|
const availableVersions = this.getEligibleAvailableVersions(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user