mirror of
https://gitea.com/actions/setup-java.git
synced 2026-04-19 05:32:00 +08:00
Compare commits
3 Commits
v5
...
0756542bc5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0756542bc5 | ||
|
|
1d018f9b8b | ||
|
|
fe779bf55e |
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/http-client"
|
name: "@actions/http-client"
|
||||||
version: 3.0.0
|
version: 3.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions Http Client
|
summary: Actions Http Client
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
32
.licenses/npm/fast-xml-builder.dep.yml
generated
Normal file
32
.licenses/npm/fast-xml-builder.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: fast-xml-builder
|
||||||
|
version: 1.0.0
|
||||||
|
type: npm
|
||||||
|
summary: Build XML from JSON without C/C++ based libraries
|
||||||
|
homepage:
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Natural Intelligence
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
notices: []
|
||||||
2
.licenses/npm/fast-xml-parser.dep.yml
generated
2
.licenses/npm/fast-xml-parser.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: fast-xml-parser
|
name: fast-xml-parser
|
||||||
version: 5.3.3
|
version: 5.4.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
4
.licenses/npm/minimatch.dep.yml
generated
4
.licenses/npm/minimatch.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: minimatch
|
name: minimatch
|
||||||
version: 3.1.2
|
version: 3.1.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: a glob matcher in javascript
|
summary: a glob matcher in javascript
|
||||||
homepage: https://github.com/isaacs/minimatch#readme
|
homepage:
|
||||||
license: isc
|
license: isc
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
34
.licenses/npm/undici-6.23.0.dep.yml
generated
Normal file
34
.licenses/npm/undici-6.23.0.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: undici
|
||||||
|
version: 6.23.0
|
||||||
|
type: npm
|
||||||
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
|
homepage: https://undici.nodejs.org
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: MIT
|
||||||
|
notices: []
|
||||||
18
README.md
18
README.md
@@ -82,7 +82,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
- run: java HelloWorldApp.java
|
- run: java HelloWorldApp.java
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -93,13 +93,13 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
- run: java HelloWorldApp.java
|
- run: java HelloWorldApp.java
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Supported version syntax
|
#### Supported version syntax
|
||||||
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
|
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
|
||||||
- major versions: `8`, `11`, `16`, `17`, `21`
|
- major versions: `8`, `11`, `16`, `17`, `21`, `25`
|
||||||
- more specific versions: `8.0.282+8`, `8.0.232`, `11.0`, `11.0.4`, `17.0`
|
- more specific versions: `8.0.282+8`, `8.0.232`, `11.0`, `11.0.4`, `17.0`
|
||||||
- early access (EA) versions: `15-ea`, `15.0.0-ea`
|
- early access (EA) versions: `15-ea`, `15.0.0-ea`
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
cache-dependency-path: | # optional
|
cache-dependency-path: | # optional
|
||||||
sub-project/*.gradle*
|
sub-project/*.gradle*
|
||||||
@@ -169,7 +169,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
cache-dependency-path: 'sub-project/pom.xml' # optional
|
cache-dependency-path: 'sub-project/pom.xml' # optional
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
@@ -183,7 +183,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
cache: 'sbt'
|
cache: 'sbt'
|
||||||
cache-dependency-path: | # optional
|
cache-dependency-path: | # optional
|
||||||
sub-project/build.sbt
|
sub-project/build.sbt
|
||||||
@@ -203,7 +203,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
- run: ./gradlew build --no-daemon
|
- run: ./gradlew build --no-daemon
|
||||||
```
|
```
|
||||||
@@ -223,7 +223,7 @@ steps:
|
|||||||
- uses: actions/setup-java@v5
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: java HelloWorldApp.java
|
- run: java HelloWorldApp.java
|
||||||
```
|
```
|
||||||
@@ -235,7 +235,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ '8', '11', '17', '21' ]
|
java: [ '8', '11', '17', '21', '25' ]
|
||||||
name: Java ${{ matrix.Java }} sample
|
name: Java ${{ matrix.Java }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ describe('dependency cache', () => {
|
|||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
||||||
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
||||||
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
||||||
@@ -51,6 +52,10 @@ describe('dependency cache', () => {
|
|||||||
|
|
||||||
spySaveState = jest.spyOn(core, 'saveState');
|
spySaveState = jest.spyOn(core, 'saveState');
|
||||||
spySaveState.mockImplementation(() => null);
|
spySaveState.mockImplementation(() => null);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -58,6 +63,10 @@ describe('dependency cache', () => {
|
|||||||
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
||||||
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
||||||
resetState();
|
resetState();
|
||||||
|
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('restore', () => {
|
describe('restore', () => {
|
||||||
|
|||||||
@@ -11,19 +11,32 @@ describe('cleanup', () => {
|
|||||||
Parameters<typeof cache.saveCache>
|
Parameters<typeof cache.saveCache>
|
||||||
>;
|
>;
|
||||||
let spyJobStatusSuccess: jest.SpyInstance;
|
let spyJobStatusSuccess: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
spyWarning = jest.spyOn(core, 'warning');
|
||||||
spyWarning.mockImplementation(() => null);
|
spyWarning.mockImplementation(() => null);
|
||||||
|
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
spyInfo = jest.spyOn(core, 'info');
|
||||||
spyInfo.mockImplementation(() => null);
|
spyInfo.mockImplementation(() => null);
|
||||||
|
|
||||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
||||||
|
|
||||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
||||||
spyJobStatusSuccess.mockReturnValue(true);
|
spyJobStatusSuccess.mockReturnValue(true);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
|
|
||||||
createStateForSuccessfulRestore();
|
createStateForSuccessfulRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
resetState();
|
resetState();
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import manifestData from '../data/adopt.json';
|
import manifestData from '../data/adopt.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -20,6 +22,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -262,7 +268,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -277,7 +283,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -293,7 +299,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class EmptyJavaBase extends JavaBase {
|
|||||||
): Promise<JavaDownloadRelease> {
|
): Promise<JavaDownloadRelease> {
|
||||||
const availableVersion = '11.0.9';
|
const availableVersion = '11.0.9';
|
||||||
if (!semver.satisfies(availableVersion, range)) {
|
if (!semver.satisfies(availableVersion, range)) {
|
||||||
throw new Error('Available version not found');
|
throw this.createVersionNotFoundError(range, [availableVersion]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -248,6 +248,7 @@ describe('setupJava', () => {
|
|||||||
let spyCoreExportVariable: jest.SpyInstance;
|
let spyCoreExportVariable: jest.SpyInstance;
|
||||||
let spyCoreAddPath: jest.SpyInstance;
|
let spyCoreAddPath: jest.SpyInstance;
|
||||||
let spyCoreSetOutput: jest.SpyInstance;
|
let spyCoreSetOutput: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
|
||||||
@@ -287,6 +288,10 @@ describe('setupJava', () => {
|
|||||||
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
||||||
spyCoreSetOutput.mockImplementation(() => undefined);
|
spyCoreSetOutput.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => undefined);
|
||||||
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -530,19 +535,16 @@ describe('setupJava', () => {
|
|||||||
checkLatest: false
|
checkLatest: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
])(
|
])('should throw an error for version not found for %s', async input => {
|
||||||
'should throw an error for Available version not found for %s',
|
mockJavaBase = new EmptyJavaBase(input);
|
||||||
async input => {
|
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
||||||
mockJavaBase = new EmptyJavaBase(input);
|
`No matching version found for SemVer '${input.version}'`
|
||||||
await expect(mockJavaBase.setupJava()).rejects.toThrow(
|
);
|
||||||
'Available version not found'
|
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
||||||
);
|
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
||||||
expect(spyTcFindAllVersions).toHaveBeenCalled();
|
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
||||||
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
});
|
||||||
expect(spyCoreSetOutput).not.toHaveBeenCalled();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('normalizeVersion', () => {
|
describe('normalizeVersion', () => {
|
||||||
@@ -570,6 +572,97 @@ describe('normalizeVersion', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('createVersionNotFoundError', () => {
|
||||||
|
it('should include all required fields in error message without available versions', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError('17.0.5');
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include available versions when provided', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const availableVersions = ['11.0.1', '11.0.2', '17.0.1', '17.0.2'];
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
expect(error.message).toContain(
|
||||||
|
'Available versions: 11.0.1, 11.0.2, 17.0.1, 17.0.2'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should truncate available versions when there are many', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create 60 versions to test truncation
|
||||||
|
const availableVersions = Array.from({length: 60}, (_, i) => `11.0.${i}`);
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain('Available versions:');
|
||||||
|
expect(error.message).toContain('...');
|
||||||
|
expect(error.message).toContain('(showing first 50 of 60 versions');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include additional context when provided', () => {
|
||||||
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
version: '17.0.5',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const availableVersions = ['11.0.1', '11.0.2'];
|
||||||
|
const additionalContext = 'Platform: linux';
|
||||||
|
const error = (mockJavaBase as any).createVersionNotFoundError(
|
||||||
|
'17.0.5',
|
||||||
|
availableVersions,
|
||||||
|
additionalContext
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(error.message).toContain(
|
||||||
|
"No matching version found for SemVer '17.0.5'"
|
||||||
|
);
|
||||||
|
expect(error.message).toContain('Distribution: Empty');
|
||||||
|
expect(error.message).toContain('Package type: jdk');
|
||||||
|
expect(error.message).toContain('Architecture: x64');
|
||||||
|
expect(error.message).toContain('Platform: linux');
|
||||||
|
expect(error.message).toContain('Available versions: 11.0.1, 11.0.2');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('getToolcacheVersionName', () => {
|
describe('getToolcacheVersionName', () => {
|
||||||
const DummyJavaBase = JavaBase as any;
|
const DummyJavaBase = JavaBase as any;
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
||||||
import * as util from '../../src/util';
|
import * as util from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import {isGeneratorFunction} from 'util/types';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/corretto.json';
|
import manifestData from '../data/corretto.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -23,6 +24,10 @@ describe('getAvailableVersions', () => {
|
|||||||
util,
|
util,
|
||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -198,7 +203,7 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](version)
|
distribution['findPackageForDownload'](version)
|
||||||
).rejects.toThrow("Could not find satisfied version for SemVer '4'");
|
).rejects.toThrow("No matching version found for SemVer '4'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/dragonwell.json';
|
import manifestData from '../data/dragonwell.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -21,6 +23,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -232,7 +238,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](jdkVersion)
|
distribution['findPackageForDownload'](jdkVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".`
|
`No matching version found for SemVer '${jdkVersion}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ beforeAll(() => {
|
|||||||
describe('GraalVMDistribution', () => {
|
describe('GraalVMDistribution', () => {
|
||||||
let distribution: GraalVMDistribution;
|
let distribution: GraalVMDistribution;
|
||||||
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
const defaultOptions: JavaInstallerOptions = {
|
const defaultOptions: JavaInstallerOptions = {
|
||||||
version: '17',
|
version: '17',
|
||||||
@@ -59,6 +60,10 @@ describe('GraalVMDistribution', () => {
|
|||||||
(distribution as any).http = mockHttpClient;
|
(distribution as any).http = mockHttpClient;
|
||||||
|
|
||||||
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
@@ -348,11 +353,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
} as http.HttpClientResponse;
|
} as http.HttpClientResponse;
|
||||||
mockHttpClient.head.mockResolvedValue(mockResponse);
|
mockHttpClient.head.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
|
// Verify the error is thrown with the expected message
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('17.0.99')
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
).rejects.toThrow(
|
).rejects.toThrow("No matching version found for SemVer '17.0.99'");
|
||||||
'Could not find GraalVM for SemVer 17.0.99. Please check if this version is available at https://download.oracle.com/graalvm'
|
// Verify distribution info is included
|
||||||
);
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
|
).rejects.toThrow('GraalVM');
|
||||||
|
|
||||||
|
// Verify the hint about checking the base URL is included
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('17.0.99')
|
||||||
|
).rejects.toThrow('https://www.graalvm.org/downloads/');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error for unauthorized access (401)', async () => {
|
it('should throw error for unauthorized access (401)', async () => {
|
||||||
@@ -496,12 +509,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findPackageForDownload('23')
|
(distribution as any).findPackageForDownload('23')
|
||||||
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
||||||
|
|
||||||
// Verify error logging
|
await expect(
|
||||||
expect(core.error).toHaveBeenCalledWith(
|
(distribution as any).findPackageForDownload('23')
|
||||||
'Available versions: 23-ea-20240716'
|
).rejects.toThrow(
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findPackageForDownload('23')
|
||||||
|
).rejects.toThrow('23-ea-20240716');
|
||||||
|
|
||||||
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture in EA build', async () => {
|
it('should throw error when no matching file for architecture in EA build', async () => {
|
||||||
@@ -708,11 +728,19 @@ describe('GraalVMDistribution', () => {
|
|||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
(distribution as any).findEABuildDownloadUrl('23-ea')
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
).rejects.toThrow("Unable to find latest version for '23-ea'");
|
).rejects.toThrow("No matching version found for SemVer '23-ea'");
|
||||||
|
|
||||||
expect(core.error).toHaveBeenCalledWith(
|
await expect(
|
||||||
'Available versions: 23-ea-20240716, 23-ea-20240709'
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
|
).rejects.toThrow(
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(distribution as any).findEABuildDownloadUrl('23-ea')
|
||||||
|
).rejects.toThrow('23-ea-20240716');
|
||||||
|
|
||||||
|
// Verify error logging - removed as we now use the helper method which doesn't call core.error
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error when no matching file for architecture', async () => {
|
it('should throw error when no matching file for architecture', async () => {
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer
|
|||||||
|
|
||||||
import manifestData from '../data/jetbrains.json';
|
import manifestData from '../data/jetbrains.json';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -15,6 +17,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -98,7 +104,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,7 +117,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica.json';
|
import manifestData from '../data/liberica.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -18,6 +20,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -209,7 +215,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica-linux.json';
|
import manifestData from '../data/liberica-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -18,6 +20,10 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -209,7 +215,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import {
|
|||||||
} from '../../src/distributions/liberica/models';
|
} from '../../src/distributions/liberica/models';
|
||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/liberica-windows.json';
|
import manifestData from '../data/liberica-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -18,6 +20,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as LibericaVersion[]
|
result: manifestData as LibericaVersion[]
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -209,7 +214,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
|
||||||
/Could not find satisfied version for semver */
|
/No matching version found for SemVer/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ describe('setupJava', () => {
|
|||||||
let spyFsReadDir: jest.SpyInstance;
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
let spyUtilsExtractJdkFile: jest.SpyInstance;
|
||||||
let spyPathResolve: jest.SpyInstance;
|
let spyPathResolve: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
const expectedJdkFile = 'JavaLocalJdkFile';
|
const expectedJdkFile = 'JavaLocalJdkFile';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -93,6 +94,10 @@ describe('setupJava', () => {
|
|||||||
// Spy on path methods
|
// Spy on path methods
|
||||||
spyPathResolve = jest.spyOn(path, 'resolve');
|
spyPathResolve = jest.spyOn(path, 'resolve');
|
||||||
spyPathResolve.mockImplementation((path: string) => path);
|
spyPathResolve.mockImplementation((path: string) => path);
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: MicrosoftDistributions;
|
let distribution: MicrosoftDistributions;
|
||||||
let spyGetManifestFromRepo: jest.SpyInstance;
|
let spyGetManifestFromRepo: jest.SpyInstance;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new MicrosoftDistributions({
|
distribution = new MicrosoftDistributions({
|
||||||
@@ -26,6 +27,10 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
@@ -174,7 +179,7 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it('should throw an error', async () => {
|
it('should throw an error', async () => {
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ describe('findPackageForDownload', () => {
|
|||||||
let distribution: OracleDistribution;
|
let distribution: OracleDistribution;
|
||||||
let spyDebug: jest.SpyInstance;
|
let spyDebug: jest.SpyInstance;
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
distribution = new OracleDistribution({
|
distribution = new OracleDistribution({
|
||||||
@@ -19,6 +20,10 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
spyDebug = jest.spyOn(core, 'debug');
|
||||||
spyDebug.mockImplementation(() => {});
|
spyDebug.mockImplementation(() => {});
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import {HttpClient} from '@actions/http-client';
|
import {HttpClient} from '@actions/http-client';
|
||||||
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/sapmachine.json';
|
import manifestData from '../data/sapmachine.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -21,6 +23,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -266,7 +272,7 @@ describe('getAvailableVersions', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](normalizedVersion)
|
distribution['findPackageForDownload'](normalizedVersion)
|
||||||
).rejects.toThrow(
|
).rejects.toThrow(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${normalizedVersion}" and architecture: "${arch}".`
|
`No matching version found for SemVer '${normalizedVersion}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|||||||
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
|
||||||
|
|
||||||
import manifestData from '../data/semeru.json';
|
import manifestData from '../data/semeru.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -15,6 +17,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -152,7 +157,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -164,7 +169,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +182,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import {
|
|||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
||||||
|
|
||||||
import manifestData from '../data/temurin.json';
|
import manifestData from '../data/temurin.json';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -18,6 +20,9 @@ describe('getAvailableVersions', () => {
|
|||||||
headers: {},
|
headers: {},
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -213,7 +218,7 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload']('9.0.8')
|
distribution['findPackageForDownload']('9.0.8')
|
||||||
).rejects.toThrow(/Could not find satisfied version for SemVer */);
|
).rejects.toThrow(/No matching version found for SemVer */);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('version is not found', async () => {
|
it('version is not found', async () => {
|
||||||
@@ -228,7 +233,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
distribution['getAvailableVersions'] = async () => manifestData as any;
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -244,7 +249,7 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
distribution['getAvailableVersions'] = async () => [];
|
distribution['getAvailableVersions'] = async () => [];
|
||||||
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
|
||||||
/Could not find satisfied version for SemVer */
|
/No matching version found for SemVer */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-releases-default.json';
|
import manifestData from '../data/zulu-releases-default.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -23,6 +25,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -225,6 +231,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-linux.json';
|
import manifestData from '../data/zulu-linux.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -24,6 +26,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -228,6 +234,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import {ZuluDistribution} from '../../src/distributions/zulu/installer';
|
|||||||
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
import {IZuluVersions} from '../../src/distributions/zulu/models';
|
||||||
import * as utils from '../../src/util';
|
import * as utils from '../../src/util';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import manifestData from '../data/zulu-windows.json';
|
import manifestData from '../data/zulu-windows.json';
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
|
||||||
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
@@ -24,6 +26,10 @@ describe('getAvailableVersions', () => {
|
|||||||
'getDownloadArchiveExtension'
|
'getDownloadArchiveExtension'
|
||||||
);
|
);
|
||||||
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
|
||||||
|
|
||||||
|
// Mock core.error to suppress error logs
|
||||||
|
spyCoreError = jest.spyOn(core, 'error');
|
||||||
|
spyCoreError.mockImplementation(() => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -226,6 +232,6 @@ describe('findPackageForDownload', () => {
|
|||||||
distribution['getAvailableVersions'] = async () => manifestData;
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrow(/Could not find satisfied version for semver */);
|
).rejects.toThrow(/No matching version found for SemVer/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
27790
dist/cleanup/index.js
vendored
27790
dist/cleanup/index.js
vendored
File diff suppressed because one or more lines are too long
27929
dist/setup/index.js
vendored
27929
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
77
package-lock.json
generated
77
package-lock.json
generated
@@ -86,13 +86,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache/node_modules/@actions/http-client": {
|
"node_modules/@actions/cache/node_modules/@actions/http-client": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz",
|
||||||
"integrity": "sha512-1s3tXAfVMSz9a4ZEBkXXRQD4QhY3+GAsWSbaYpeknPOKEeyRiU3lH+bHiLMZdo2x/fIeQ/hscL1wCkDLVM2DZQ==",
|
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tunnel": "^0.0.6",
|
"tunnel": "^0.0.6",
|
||||||
"undici": "^5.28.5"
|
"undici": "^6.23.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache/node_modules/@actions/io": {
|
"node_modules/@actions/cache/node_modules/@actions/io": {
|
||||||
@@ -109,6 +109,15 @@
|
|||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@actions/cache/node_modules/undici": {
|
||||||
|
"version": "6.23.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
||||||
|
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.11.1",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
||||||
@@ -496,7 +505,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.3.tgz",
|
||||||
"integrity": "sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==",
|
"integrity": "sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ampproject/remapping": "^2.2.0",
|
"@ampproject/remapping": "^2.2.0",
|
||||||
"@babel/code-frame": "^7.22.13",
|
"@babel/code-frame": "^7.22.13",
|
||||||
@@ -1788,7 +1796,6 @@
|
|||||||
"integrity": "sha512-B7RIQiTsCBBmY+yW4+ILd6mF5h1FUwJsVvpqkrgpszYifetQ2Ke+Z4u6aZh0CblkUGIdR59iYVyXqqZGkZ3aBw==",
|
"integrity": "sha512-B7RIQiTsCBBmY+yW4+ILd6mF5h1FUwJsVvpqkrgpszYifetQ2Ke+Z4u6aZh0CblkUGIdR59iYVyXqqZGkZ3aBw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.43.0",
|
"@typescript-eslint/scope-manager": "8.43.0",
|
||||||
"@typescript-eslint/types": "8.43.0",
|
"@typescript-eslint/types": "8.43.0",
|
||||||
@@ -1937,12 +1944,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
|
||||||
"version": "9.0.5",
|
"version": "9.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
|
||||||
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
"integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^2.0.1"
|
"brace-expansion": "^2.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16 || 14 >=14.17"
|
"node": ">=16 || 14 >=14.17"
|
||||||
@@ -2037,7 +2045,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -2064,10 +2071,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ajv": {
|
"node_modules/ajv": {
|
||||||
"version": "6.12.6",
|
"version": "6.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
|
||||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
"integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.1",
|
"fast-deep-equal": "^3.1.1",
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
@@ -2317,7 +2325,6 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001541",
|
"caniuse-lite": "^1.0.30001541",
|
||||||
"electron-to-chromium": "^1.4.535",
|
"electron-to-chromium": "^1.4.535",
|
||||||
@@ -2687,7 +2694,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
|
||||||
"integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==",
|
"integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
@@ -3066,18 +3072,32 @@
|
|||||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
|
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-builder": {
|
||||||
"version": "5.3.3",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.0.0.tgz",
|
||||||
"integrity": "sha512-2O3dkPAAC6JavuMm8+4+pgTk+5hoAs+CjZ+sWcQLkX9+/tHRuTkQh/Oaifr8qDmZ8iEHb771Ea6G8CdwkrgvYA==",
|
"integrity": "sha512-fpZuDogrAgnyt9oDDz+5DBz0zgPdPZz6D4IR7iESxRXElrlGTRkHJ9eEt+SACRJwT0FNFrt71DFQIUFBJfX/uQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/NaturalIntelligence"
|
"url": "https://github.com/sponsors/NaturalIntelligence"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/fast-xml-parser": {
|
||||||
|
"version": "5.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.4.1.tgz",
|
||||||
|
"integrity": "sha512-BQ30U1mKkvXQXXkAGcuyUA/GA26oEB7NzOtsxCDtyu62sjGw5QraKFhx2Em3WQNjPw9PG6MQ9yuIIgkSDfGu5A==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/NaturalIntelligence"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"strnum": "^2.1.0"
|
"fast-xml-builder": "^1.0.0",
|
||||||
|
"strnum": "^2.1.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"fxparser": "src/cli/cli.js"
|
"fxparser": "src/cli/cli.js"
|
||||||
@@ -3133,9 +3153,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/filelist/node_modules/minimatch": {
|
"node_modules/filelist/node_modules/minimatch": {
|
||||||
"version": "5.1.6",
|
"version": "5.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
|
||||||
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
|
"integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3634,7 +3654,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
||||||
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
|
"integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jest/core": "^29.7.0",
|
"@jest/core": "^29.7.0",
|
||||||
"@jest/types": "^29.6.3",
|
"@jest/types": "^29.6.3",
|
||||||
@@ -4404,9 +4423,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
"integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
},
|
},
|
||||||
@@ -5299,7 +5319,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
@@ -54,15 +54,10 @@ export class AdoptDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -259,6 +259,42 @@ export abstract class JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected createVersionNotFoundError(
|
||||||
|
versionOrRange: string,
|
||||||
|
availableVersions?: string[],
|
||||||
|
additionalContext?: string
|
||||||
|
): Error {
|
||||||
|
const parts = [
|
||||||
|
`No matching version found for SemVer '${versionOrRange}'.`,
|
||||||
|
`Distribution: ${this.distribution}`,
|
||||||
|
`Package type: ${this.packageType}`,
|
||||||
|
`Architecture: ${this.architecture}`
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add additional context if provided (e.g., platform/OS info)
|
||||||
|
if (additionalContext) {
|
||||||
|
parts.push(additionalContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableVersions && availableVersions.length > 0) {
|
||||||
|
const maxVersionsToShow = core.isDebug() ? availableVersions.length : 50;
|
||||||
|
const versionsToShow = availableVersions.slice(0, maxVersionsToShow);
|
||||||
|
const truncated = availableVersions.length > maxVersionsToShow;
|
||||||
|
|
||||||
|
parts.push(
|
||||||
|
`Available versions: ${versionsToShow.join(', ')}${truncated ? ', ...' : ''}`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (truncated) {
|
||||||
|
parts.push(
|
||||||
|
`(showing first ${maxVersionsToShow} of ${availableVersions.length} versions, enable debug mode to see all)`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Error(parts.join('\n'));
|
||||||
|
}
|
||||||
|
|
||||||
protected setJavaDefault(version: string, toolPath: string) {
|
protected setJavaDefault(version: string, toolPath: string) {
|
||||||
const majorVersion = version.split('.')[0];
|
const majorVersion = version.split('.')[0];
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
|
|||||||
@@ -75,15 +75,10 @@ export class CorrettoDistribution extends JavaBase {
|
|||||||
const resolvedVersion =
|
const resolvedVersion =
|
||||||
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
if (!resolvedVersion) {
|
if (!resolvedVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,10 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
throw new Error(
|
const availableVersionStrings = availableVersions.map(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
item => item.jdk_version
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
} from '../../util';
|
} from '../../util';
|
||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
|
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@@ -149,9 +150,10 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
|
|
||||||
if (statusCode === HttpCodes.NotFound) {
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
throw new Error(
|
// Create the standard error with additional hint about checking the download URL
|
||||||
`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`
|
const error = this.createVersionNotFoundError(range);
|
||||||
);
|
error.message += `\nPlease check if this version is available at ${GRAALVM_DOWNLOAD_URL} . Pick a version from the list.`;
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -180,10 +182,12 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
|
|
||||||
const latestVersion = versions.find(v => v.latest);
|
const latestVersion = versions.find(v => v.latest);
|
||||||
if (!latestVersion) {
|
if (!latestVersion) {
|
||||||
core.error(
|
const availableVersions = versions.map(v => v.version);
|
||||||
`Available versions: ${versions.map(v => v.version).join(', ')}`
|
throw this.createVersionNotFoundError(
|
||||||
|
javaEaVersion,
|
||||||
|
availableVersions,
|
||||||
|
'Note: No EA build is marked as latest for this version.'
|
||||||
);
|
);
|
||||||
throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(`Latest version found: ${latestVersion.version}`);
|
core.debug(`Latest version found: ${latestVersion.version}`);
|
||||||
|
|||||||
@@ -44,15 +44,10 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = versionsRaw
|
const availableVersionStrings = versionsRaw.map(
|
||||||
.map(item => `${item.tag_name} (${item.semver}+${item.build})`)
|
item => `${item.tag_name} (${item.semver}+${item.build})`
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${range}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -69,15 +69,10 @@ export class LibericaDistributions extends JavaBase {
|
|||||||
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||||
|
|
||||||
if (!satisfiedVersion) {
|
if (!satisfiedVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for semver ${range}. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return satisfiedVersion;
|
return satisfiedVersion;
|
||||||
|
|||||||
@@ -76,11 +76,8 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
||||||
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
throw new Error(
|
const availableVersionStrings = manifest.map(item => item.version);
|
||||||
`Could not find satisfied version for SemVer ${range}.\nAvailable versions: ${manifest
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
.map(item => item.version)
|
|
||||||
.join(', ')}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export class OracleDistribution extends JavaBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
|
throw this.createVersionNotFoundError(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
|
||||||
|
|||||||
@@ -49,9 +49,10 @@ export class SapMachineDistribution extends JavaBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!matchedVersions.length) {
|
if (!matchedVersions.length) {
|
||||||
throw new Error(
|
const availableVersionStrings = availableVersions.map(
|
||||||
`Couldn't find any satisfied version for the specified java-version: "${version}" and architecture: "${this.architecture}".`
|
item => item.version
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedVersion = matchedVersions[0];
|
const resolvedVersion = matchedVersions[0];
|
||||||
|
|||||||
@@ -79,14 +79,16 @@ export class SemeruDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
);
|
||||||
const availableOptionsMessage = availableOptions
|
// Include platform context to help users understand OS-specific version availability
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
// IBM Semeru builds are OS-specific, so platform info aids in troubleshooting
|
||||||
: '';
|
const platformContext = `Platform: ${process.platform}`;
|
||||||
throw new Error(
|
throw this.createVersionNotFoundError(
|
||||||
`Could not find satisfied version for SemVer version '${version}' for your current OS version for ${this.architecture} architecture ${availableOptionsMessage}`
|
version,
|
||||||
|
availableVersionStrings,
|
||||||
|
platformContext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,15 +57,10 @@ export class TemurinDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableVersionStrings = availableVersionsWithBinaries.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
@@ -57,15 +57,10 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
const resolvedFullVersion =
|
const resolvedFullVersion =
|
||||||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableVersionStrings = availableVersions.map(
|
||||||
.map(item => item.version)
|
item => item.version
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
|
||||||
: '';
|
|
||||||
throw new Error(
|
|
||||||
`Could not find satisfied version for semver ${version}. ${availableOptionsMessage}`
|
|
||||||
);
|
);
|
||||||
|
throw this.createVersionNotFoundError(version, availableVersionStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolvedFullVersion;
|
return resolvedFullVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user