Compare commits

...

3 Commits

Author SHA1 Message Date
David Liu
9e95785472
Merge 8cd9b686db into 8e04ddff28 2024-08-29 12:04:30 -07:00
mahabaleshwars
8e04ddff28
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
2024-08-29 13:48:24 -05:00
David Liu
8cd9b686db
Update README.md
A confusion introduced by running `java HelloWorldApp.java`
I believe the file is not an artifact of `setup-java`, thus user should provide it. But there is no tips in the guide that user should prepare it in advance. Directly copy the code snippets will introduce a straightforward error, which should not happen in a guide.
2024-03-22 11:47:03 +08:00
4 changed files with 15 additions and 14 deletions

View File

@ -74,7 +74,6 @@ steps:
with: with:
distribution: 'temurin' # See 'Supported distributions' for available options distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
- run: java HelloWorldApp.java
``` ```
#### Azul Zulu OpenJDK #### Azul Zulu OpenJDK
@ -85,7 +84,6 @@ steps:
with: with:
distribution: 'zulu' # See 'Supported distributions' for available options distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
- run: java HelloWorldApp.java
``` ```
#### Supported version syntax #### Supported version syntax
@ -206,7 +204,6 @@ steps:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
check-latest: true check-latest: true
- run: java HelloWorldApp.java
``` ```
### Testing against different Java versions ### Testing against different Java versions
@ -225,7 +222,6 @@ jobs:
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
- run: java HelloWorldApp.java
``` ```
### Install multiple JDKs ### Install multiple JDKs

View File

@ -207,7 +207,7 @@ describe('findPackageForDownload', () => {
}); });
distribution['getAvailableVersions'] = async () => []; distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( 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`
); );
} }
); );

11
dist/setup/index.js vendored
View File

@ -124939,8 +124939,9 @@ class SemeruDistribution extends base_installer_1.JavaBase {
} }
findPackageForDownload(version) { findPackageForDownload(version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (!supportedArchitectures.includes(this.architecture)) { const arch = this.distributionArchitecture();
throw new Error(`Unsupported architecture for IBM Semeru: ${this.architecture}, the following are supported: ${supportedArchitectures.join(', ')}`); 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) { if (!this.stable) {
throw new Error('IBM Semeru does not provide builds for early access versions'); 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 const availableOptionsMessage = availableOptions
? `\nAvailable versions: ${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; return resolvedFullVersion;
}); });
@ -124999,7 +125000,7 @@ class SemeruDistribution extends base_installer_1.JavaBase {
getAvailableVersions() { getAvailableVersions() {
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.architecture; const arch = this.distributionArchitecture();
const imageType = this.packageType; const imageType = this.packageType;
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea'; 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__; /******/ module.exports = __webpack_exports__;
/******/ /******/
/******/ })() /******/ })()
; ;

View File

@ -33,11 +33,15 @@ export class SemeruDistribution extends JavaBase {
protected async findPackageForDownload( protected async findPackageForDownload(
version: string version: string
): Promise<JavaDownloadRelease> { ): Promise<JavaDownloadRelease> {
if (!supportedArchitectures.includes(this.architecture)) { const arch = this.distributionArchitecture();
if (!supportedArchitectures.includes(arch)) {
throw new Error( throw new Error(
`Unsupported architecture for IBM Semeru: ${ `Unsupported architecture for IBM Semeru: ${
this.architecture 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}` ? `\nAvailable versions: ${availableOptions}`
: ''; : '';
throw new Error( 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<ISemeruAvailableVersions[]> { public async getAvailableVersions(): Promise<ISemeruAvailableVersions[]> {
const platform = this.getPlatformOption(); const platform = this.getPlatformOption();
const arch = this.architecture; const arch = this.distributionArchitecture();
const imageType = this.packageType; const imageType = this.packageType;
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea'; const releaseType = this.stable ? 'ga' : 'ea';