Suggest minor changes to the code of Semeru related PR (#2)

This commit is contained in:
Ivan 2023-03-14 21:18:01 +02:00 committed by GitHub
parent 6457aa3c54
commit a73fb66f44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 44 deletions

View file

@ -103,8 +103,8 @@ Currently, the following distributions are supported:
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.

View file

@ -82,12 +82,12 @@ describe('getAvailableVersions', () => {
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,

35
dist/setup/index.js vendored
View file

@ -104316,9 +104316,9 @@ const installer_3 = __nccwpck_require__(8766);
const installer_4 = __nccwpck_require__(8579);
const installer_5 = __nccwpck_require__(883);
const installer_6 = __nccwpck_require__(3613);
const installer_7 = __nccwpck_require__(4750);
const installer_8 = __nccwpck_require__(4298);
const installer_9 = __nccwpck_require__(1121);
const installer_7 = __nccwpck_require__(1121);
const installer_8 = __nccwpck_require__(4750);
const installer_9 = __nccwpck_require__(4298);
var JavaDistribution;
(function (JavaDistribution) {
JavaDistribution["Adopt"] = "adopt";
@ -104351,11 +104351,11 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
case JavaDistribution.Microsoft:
return new installer_6.MicrosoftDistributions(installerOptions);
case JavaDistribution.Semeru:
return new installer_9.SemeruDistribution(installerOptions);
return new installer_7.SemeruDistribution(installerOptions);
case JavaDistribution.Corretto:
return new installer_7.CorrettoDistribution(installerOptions);
return new installer_8.CorrettoDistribution(installerOptions);
case JavaDistribution.Oracle:
return new installer_8.OracleDistribution(installerOptions);
return new installer_9.OracleDistribution(installerOptions);
default:
return null;
}
@ -105022,7 +105022,9 @@ class SemeruDistribution extends base_installer_1.JavaBase {
const imageType = this.packageType;
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea';
console.time('semeru-retrieve-available-versions'); // eslint-disable-line no-console
if (core.isDebug()) {
console.time('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
}
const baseRequestArguments = [
`project=jdk`,
'vendor=ibm',
@ -105046,17 +105048,7 @@ class SemeruDistribution extends base_installer_1.JavaBase {
// url is identical except page_index so print it once for debug
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
}
if (core.isDebug()) {
core.debug('Semeru distribution version URL: ' + availableVersionsUrl);
}
let iTypedResponse = null;
try {
iTypedResponse = yield this.http.getJson(availableVersionsUrl);
}
catch (element) {
console.log('error', element); // eslint-disable-line no-console
}
const paginationPage = iTypedResponse.result;
const paginationPage = (yield this.http.getJson(availableVersionsUrl)).result;
if (paginationPage === null || paginationPage.length === 0) {
// break infinity loop because we have reached end of pagination
break;
@ -105065,18 +105057,17 @@ class SemeruDistribution extends base_installer_1.JavaBase {
page_index++;
}
if (core.isDebug()) {
core.startGroup('Print information about available IBM Semeru versions');
console.timeEnd('semeru-retrieve-available-versions'); // eslint-disable-line no-console
core.startGroup('Print information about available versions');
console.timeEnd('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
core.debug(`Available versions: [${availableVersions.length}]`);
core.debug(availableVersions.map(item => item.version_data.semver).join(', '));
core.debug(JSON.stringify(availableVersions));
core.endGroup();
}
return availableVersions;
});
}
getPlatformOption() {
// Adoptium has own platform names so need to map them
// Adopt has own platform names so need to map them
switch (process.platform) {
case 'darwin':
return 'mac';

View file

@ -6,9 +6,9 @@ import {AdoptDistribution, AdoptImplementation} from './adopt/installer';
import {TemurinDistribution, TemurinImplementation} from './temurin/installer';
import {LibericaDistributions} from './liberica/installer';
import {MicrosoftDistributions} from './microsoft/installer';
import {SemeruDistribution} from './semeru/installer';
import {CorrettoDistribution} from './corretto/installer';
import {OracleDistribution} from './oracle/installer';
import {SemeruDistribution} from './semeru/installer';
enum JavaDistribution {
Adopt = 'adopt',

View file

@ -129,7 +129,9 @@ export class SemeruDistribution extends JavaBase {
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea';
console.time('semeru-retrieve-available-versions'); // eslint-disable-line no-console
if (core.isDebug()) {
console.time('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
}
const baseRequestArguments = [
`project=jdk`,
@ -158,20 +160,11 @@ export class SemeruDistribution extends JavaBase {
);
}
if (core.isDebug()) {
core.debug('Semeru distribution version URL: ' + availableVersionsUrl);
}
let iTypedResponse = null;
try {
iTypedResponse = await this.http.getJson<ISemeruAvailableVersions[]>(
const paginationPage = (
await this.http.getJson<ISemeruAvailableVersions[]>(
availableVersionsUrl
);
} catch (element) {
console.log('error', element); // eslint-disable-line no-console
}
const paginationPage = iTypedResponse!.result;
)
).result;
if (paginationPage === null || paginationPage.length === 0) {
// break infinity loop because we have reached end of pagination
break;
@ -182,13 +175,12 @@ export class SemeruDistribution extends JavaBase {
}
if (core.isDebug()) {
core.startGroup('Print information about available IBM Semeru versions');
console.timeEnd('semeru-retrieve-available-versions'); // eslint-disable-line no-console
core.startGroup('Print information about available versions');
console.timeEnd('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
core.debug(`Available versions: [${availableVersions.length}]`);
core.debug(
availableVersions.map(item => item.version_data.semver).join(', ')
);
core.debug(JSON.stringify(availableVersions));
core.endGroup();
}
@ -196,7 +188,7 @@ export class SemeruDistribution extends JavaBase {
}
private getPlatformOption(): string {
// Adoptium has own platform names so need to map them
// Adopt has own platform names so need to map them
switch (process.platform) {
case 'darwin':
return 'mac';