Fixed adopt toolchain folder

This commit is contained in:
Marcel 2021-04-09 14:43:29 +02:00
commit 41f7318506
No known key found for this signature in database
GPG key ID: 45EB4FD5C25A5098
3 changed files with 25 additions and 7 deletions

View file

@ -110,6 +110,24 @@ describe('getAvailableVersions', () => {
expect(availableVersions).not.toBeNull(); expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe(manifestData.length * 2); expect(availableVersions.length).toBe(manifestData.length * 2);
}); });
it.each([
[AdoptImplementation.Hotspot, 'jdk', 'Java_Adopt_jdk'],
[AdoptImplementation.Hotspot, 'jre', 'Java_Adopt_jre'],
[AdoptImplementation.OpenJ9, 'jdk', 'Java_Adopt-OpenJ9_jdk'],
[AdoptImplementation.OpenJ9, 'jre', 'Java_Adopt-OpenJ9_jre']
])(
'find right toolchain folder',
(impl: AdoptImplementation, packageType: string, expected: string) => {
const distribution = new AdoptDistribution(
{ version: '11', architecture: 'x64', packageType: packageType, checkLatest: false },
impl
);
// @ts-ignore - because it is protected
expect(distribution.toolcacheFolderName).toBe(expected);
}
);
}); });
describe('findPackageForDownload', () => { describe('findPackageForDownload', () => {

4
dist/setup/index.js vendored
View file

@ -26910,7 +26910,7 @@ var AdoptImplementation;
class AdoptDistribution extends base_installer_1.JavaBase { class AdoptDistribution extends base_installer_1.JavaBase {
constructor(installerOptions, jvmImpl) { constructor(installerOptions, jvmImpl) {
super(`Adopt-${jvmImpl}`, installerOptions); super(`Adopt-${jvmImpl}`, installerOptions);
this.jvmImpl = jvmImpl.toLowerCase(); this.jvmImpl = jvmImpl;
} }
findPackageForDownload(version) { findPackageForDownload(version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -26981,7 +26981,7 @@ class AdoptDistribution extends base_installer_1.JavaBase {
`architecture=${arch}`, `architecture=${arch}`,
`image_type=${imageType}`, `image_type=${imageType}`,
`release_type=${releaseType}`, `release_type=${releaseType}`,
`jvm_impl=${this.jvmImpl}` `jvm_impl=${this.jvmImpl.toLowerCase()}`
].join('&'); ].join('&');
// need to iterate through all pages to retrieve the list of all versions // need to iterate through all pages to retrieve the list of all versions
// Adopt API doesn't provide way to retrieve the count of pages to iterate so infinity loop // Adopt API doesn't provide way to retrieve the count of pages to iterate so infinity loop

View file

@ -16,11 +16,11 @@ export enum AdoptImplementation {
} }
export class AdoptDistribution extends JavaBase { export class AdoptDistribution extends JavaBase {
private jvmImpl: string; constructor(
installerOptions: JavaInstallerOptions,
constructor(installerOptions: JavaInstallerOptions, jvmImpl: AdoptImplementation) { private readonly jvmImpl: AdoptImplementation
) {
super(`Adopt-${jvmImpl}`, installerOptions); super(`Adopt-${jvmImpl}`, installerOptions);
this.jvmImpl = jvmImpl.toLowerCase();
} }
protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> { protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
@ -105,7 +105,7 @@ export class AdoptDistribution extends JavaBase {
`architecture=${arch}`, `architecture=${arch}`,
`image_type=${imageType}`, `image_type=${imageType}`,
`release_type=${releaseType}`, `release_type=${releaseType}`,
`jvm_impl=${this.jvmImpl}` `jvm_impl=${this.jvmImpl.toLowerCase()}`
].join('&'); ].join('&');
// need to iterate through all pages to retrieve the list of all versions // need to iterate through all pages to retrieve the list of all versions