From 8e04ddff28554375a9a1096c888a2ef2c9803cd7 Mon Sep 17 00:00:00 2001 From: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com> Date: Fri, 30 Aug 2024 00:18:24 +0530 Subject: [PATCH] Update Error Messages and Fix Architecture Detection for IBM Semeru (#677) * Updated Error message for Semuru * Enhanced error message * Added architecture to semeru * updated code to provide aarch64 for arm64 architecture for semeru * updated semver message * updated semver error message * Enhanced the error message for semeru * Enhanced error messaged for semeru distribution * enhanced error message for semeru --- __tests__/distributors/semeru-installer.test.ts | 2 +- dist/setup/index.js | 11 ++++++----- src/distributions/semeru/installer.ts | 12 ++++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/__tests__/distributors/semeru-installer.test.ts b/__tests__/distributors/semeru-installer.test.ts index 97f25cc..690478f 100644 --- a/__tests__/distributors/semeru-installer.test.ts +++ b/__tests__/distributors/semeru-installer.test.ts @@ -207,7 +207,7 @@ describe('findPackageForDownload', () => { }); distribution['getAvailableVersions'] = async () => []; await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( - `Unsupported architecture for IBM Semeru: ${arch}, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64` + `Unsupported architecture for IBM Semeru: ${arch} for your current OS version, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64` ); } ); diff --git a/dist/setup/index.js b/dist/setup/index.js index be40d6d..878191f 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -124939,8 +124939,9 @@ class SemeruDistribution extends base_installer_1.JavaBase { } findPackageForDownload(version) { return __awaiter(this, void 0, void 0, function* () { - if (!supportedArchitectures.includes(this.architecture)) { - throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture}, the following are supported: ${supportedArchitectures.join(', ')}`); + const arch = this.distributionArchitecture(); + if (!supportedArchitectures.includes(arch)) { + throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture} for your current OS version, the following are supported: ${supportedArchitectures.join(', ')}`); } if (!this.stable) { throw new Error('IBM Semeru does not provide builds for early access versions'); @@ -124974,7 +124975,7 @@ class SemeruDistribution extends base_installer_1.JavaBase { const availableOptionsMessage = availableOptions ? `\nAvailable versions: ${availableOptions}` : ''; - throw new Error(`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`); + throw new Error(`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`); } return resolvedFullVersion; }); @@ -124999,7 +125000,7 @@ class SemeruDistribution extends base_installer_1.JavaBase { getAvailableVersions() { return __awaiter(this, void 0, void 0, function* () { const platform = this.getPlatformOption(); - const arch = this.architecture; + const arch = this.distributionArchitecture(); const imageType = this.packageType; const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions const releaseType = this.stable ? 'ga' : 'ea'; @@ -127946,4 +127947,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ module.exports = __webpack_exports__; /******/ /******/ })() -; +; \ No newline at end of file diff --git a/src/distributions/semeru/installer.ts b/src/distributions/semeru/installer.ts index c407526..5e3e2fa 100644 --- a/src/distributions/semeru/installer.ts +++ b/src/distributions/semeru/installer.ts @@ -33,11 +33,15 @@ export class SemeruDistribution extends JavaBase { protected async findPackageForDownload( version: string ): Promise { - if (!supportedArchitectures.includes(this.architecture)) { + const arch = this.distributionArchitecture(); + + if (!supportedArchitectures.includes(arch)) { throw new Error( `Unsupported architecture for IBM Semeru: ${ this.architecture - }, the following are supported: ${supportedArchitectures.join(', ')}` + } for your current OS version, the following are supported: ${supportedArchitectures.join( + ', ' + )}` ); } @@ -81,7 +85,7 @@ export class SemeruDistribution extends JavaBase { ? `\nAvailable versions: ${availableOptions}` : ''; throw new Error( - `Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}` + `Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}` ); } @@ -124,7 +128,7 @@ export class SemeruDistribution extends JavaBase { public async getAvailableVersions(): Promise { const platform = this.getPlatformOption(); - const arch = this.architecture; + const arch = this.distributionArchitecture(); const imageType = this.packageType; const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions const releaseType = this.stable ? 'ga' : 'ea';