Fix Semeru distribution details

This commit is contained in:
Jordie 2022-09-16 18:18:56 +02:00
parent f854a50c5a
commit ff60477aef
5 changed files with 7940 additions and 6660 deletions

File diff suppressed because it is too large Load Diff

8787
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

1
package-lock.json generated
View File

@ -5,7 +5,6 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-java",
"version": "3.4.1", "version": "3.4.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -8,23 +8,19 @@ import fs from 'fs';
import path from 'path'; import path from 'path';
import { ISemeruAvailableVersions } from './models'; import { ISemeruAvailableVersions } from './models';
const supportedArchitectures = ['x64', 'x86', 'ppc64le', 'ppc64', 's390x', 'aarch64'];
export class SemeruDistribution extends JavaBase { export class SemeruDistribution extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) { constructor(installerOptions: JavaInstallerOptions) {
super('IBM_Semeru', installerOptions); super('IBM_Semeru', installerOptions);
} }
protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> { protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
if ( if (!supportedArchitectures.includes(this.architecture)) {
this.architecture !== 'x64' &&
this.architecture !== 'x86' &&
this.architecture !== 'ppc64le' &&
this.architecture !== 'ppc64' &&
this.architecture !== 's390x' &&
this.architecture !== 'aarch64'
) {
throw new Error( throw new Error(
`Unsupported architecture for IBM Semeru: ${this.architecture}, the following are supported: ` + `Unsupported architecture for IBM Semeru: ${
'x64, x86, ppc64le, ppc64, s390x, aarch64' this.architecture
}, the following are supported: ${supportedArchitectures.join(', ')}`
); );
} }
@ -131,9 +127,19 @@ export class SemeruDistribution extends JavaBase {
core.debug(`Gathering available versions from '${availableVersionsUrl}'`); core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
} }
const paginationPage = ( if (core.isDebug()) {
await this.http.getJson<ISemeruAvailableVersions[]>(availableVersionsUrl) core.debug('Semeru distribution version URL: ' + availableVersionsUrl);
).result; }
let iTypedResponse = null;
try {
iTypedResponse = await this.http.getJson<ISemeruAvailableVersions[]>(availableVersionsUrl);
} catch (element) {
console.log('error', element);
}
// @ts-ignore
const paginationPage = iTypedResponse.result;
if (paginationPage === null || paginationPage.length === 0) { if (paginationPage === null || paginationPage.length === 0) {
// break infinity loop because we have reached end of pagination // break infinity loop because we have reached end of pagination
break; break;
@ -148,6 +154,7 @@ export class SemeruDistribution extends JavaBase {
console.timeEnd('semeru-retrieve-available-versions'); console.timeEnd('semeru-retrieve-available-versions');
console.log(`Available versions: [${availableVersions.length}]`); console.log(`Available versions: [${availableVersions.length}]`);
console.log(availableVersions.map(item => item.version_data.semver).join(', ')); console.log(availableVersions.map(item => item.version_data.semver).join(', '));
console.log(JSON.stringify(availableVersions));
core.endGroup(); core.endGroup();
} }