mirror of
https://github.com/actions/setup-java.git
synced 2026-06-26 07:04:30 +00:00
Compare commits
2 Commits
b6470b162b
...
09e2f7fa4c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e2f7fa4c | ||
|
|
40c66d5b62 |
@ -43,11 +43,11 @@ describe('getAvailableVersions', () => {
|
||||
|
||||
describe('getAvailableVersions', () => {
|
||||
it.each([
|
||||
['8', 'x86', 'linux', 0],
|
||||
['8', 'x86', 'linux', 36],
|
||||
['8', 'aarch64', 'linux', 33],
|
||||
['8.6.6', 'x64', 'linux', 36],
|
||||
['8', 'x86', 'anolis', 0],
|
||||
['8', 'x86', 'windows', 0],
|
||||
['8', 'x86', 'windows', 35],
|
||||
['8', 'x86', 'mac', 0],
|
||||
['11', 'x64', 'linux', 36],
|
||||
['11', 'aarch64', 'linux', 33],
|
||||
|
||||
16
dist/setup/index.js
vendored
16
dist/setup/index.js
vendored
@ -102665,7 +102665,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
}
|
||||
const edition = majorVersion == '17' ? 'Standard' : 'Extended';
|
||||
const availableVersions = yield this.getAvailableVersions();
|
||||
const matchedVersions = availableVersions
|
||||
const matchVersions = availableVersions
|
||||
.filter(item => item.jdk_version == version && item.edition == edition)
|
||||
.map(item => {
|
||||
return {
|
||||
@ -102673,10 +102673,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
url: item.download_link
|
||||
};
|
||||
});
|
||||
const resolvedVersion = matchedVersions.length > 0 ? matchedVersions[0] : null;
|
||||
const resolvedVersion = matchVersions.length > 0 ? matchVersions[0] : null;
|
||||
if (!resolvedVersion) {
|
||||
const versionsMsg = core.isDebug()
|
||||
? `Available versions: ${availableVersions}`
|
||||
? ' Available versions: ${availableVersions}'
|
||||
: '';
|
||||
throw new Error(`Cannot find satisfied version for ${version}.${versionsMsg}`);
|
||||
}
|
||||
@ -102694,16 +102694,16 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
if (['8', '11', '17'].includes(majorVersion) != true) {
|
||||
throw new Error('Support dragonwell versions: 8, 11, 17');
|
||||
}
|
||||
arch = arch.includes('x86') ? 'x64' : arch;
|
||||
const availableVersionsUrl = 'https://dragonwell-jdk.io/map_with_checksum.json';
|
||||
const fetchedDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl))
|
||||
const fetchDragonwellVersions = (_a = (yield this.http.getJson(availableVersionsUrl))
|
||||
.result) !== null && _a !== void 0 ? _a : {};
|
||||
if (Object.keys(fetchedDragonwellVersions).length == 0) {
|
||||
if (!fetchDragonwellVersions) {
|
||||
throw Error(`Could fetch any dragonwell versions from ${availableVersionsUrl}`);
|
||||
}
|
||||
const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchedDragonwellVersions);
|
||||
const availableVersions = this.getEligibleAvailableVersions(platform, arch, fetchDragonwellVersions);
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
core.debug(availableVersions.map(item => item.jdk_version).join(', '));
|
||||
core.endGroup();
|
||||
}
|
||||
return availableVersions;
|
||||
@ -102736,7 +102736,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
continue;
|
||||
}
|
||||
const archMap = platformMap[arch];
|
||||
if (jdkVersion === 'latest') {
|
||||
if (jdkVersion == 'latest') {
|
||||
jdkVersion = majorVersion;
|
||||
}
|
||||
if (jdkVersion.includes('.')) {
|
||||
|
||||
@ -125,18 +125,6 @@ steps:
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
### Alibaba Dragonwell
|
||||
**NOTE:** Alibaba Dragonwell only provides jdk.
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'dragonwell'
|
||||
java-version: '8'
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
## Installing custom Java package type
|
||||
```yaml
|
||||
steps:
|
||||
@ -247,6 +235,18 @@ jobs:
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
### Alibaba Dragonwell
|
||||
**NOTE:** Alibaba Dragonwell only provides jdk.
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'dragonwell'
|
||||
java-version: '8'
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
## Publishing using Apache Maven
|
||||
### Yaml example:
|
||||
```yaml
|
||||
|
||||
@ -32,7 +32,7 @@ export class DragonwellDistribution extends JavaBase {
|
||||
}
|
||||
const edition = majorVersion == '17' ? 'Standard' : 'Extended';
|
||||
const availableVersions = await this.getAvailableVersions();
|
||||
const matchedVersions = availableVersions
|
||||
const matchVersions = availableVersions
|
||||
.filter(item => item.jdk_version == version && item.edition == edition)
|
||||
.map(item => {
|
||||
return {
|
||||
@ -40,11 +40,10 @@ export class DragonwellDistribution extends JavaBase {
|
||||
url: item.download_link
|
||||
} as JavaDownloadRelease;
|
||||
});
|
||||
const resolvedVersion =
|
||||
matchedVersions.length > 0 ? matchedVersions[0] : null;
|
||||
const resolvedVersion = matchVersions.length > 0 ? matchVersions[0] : null;
|
||||
if (!resolvedVersion) {
|
||||
const versionsMsg = core.isDebug()
|
||||
? `Available versions: ${availableVersions}`
|
||||
? ' Available versions: ${availableVersions}'
|
||||
: '';
|
||||
throw new Error(
|
||||
`Cannot find satisfied version for ${version}.${versionsMsg}`
|
||||
@ -64,13 +63,15 @@ export class DragonwellDistribution extends JavaBase {
|
||||
throw new Error('Support dragonwell versions: 8, 11, 17');
|
||||
}
|
||||
|
||||
arch = arch.includes('x86') ? 'x64' : arch;
|
||||
|
||||
const availableVersionsUrl =
|
||||
'https://dragonwell-jdk.io/map_with_checksum.json';
|
||||
|
||||
const fetchedDragonwellVersions =
|
||||
const fetchDragonwellVersions =
|
||||
(await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl))
|
||||
.result ?? {};
|
||||
if (Object.keys(fetchedDragonwellVersions).length == 0) {
|
||||
if (!fetchDragonwellVersions) {
|
||||
throw Error(
|
||||
`Could fetch any dragonwell versions from ${availableVersionsUrl}`
|
||||
);
|
||||
@ -78,12 +79,11 @@ export class DragonwellDistribution extends JavaBase {
|
||||
const availableVersions = this.getEligibleAvailableVersions(
|
||||
platform,
|
||||
arch,
|
||||
fetchedDragonwellVersions
|
||||
fetchDragonwellVersions
|
||||
);
|
||||
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
core.debug(availableVersions.map(item => item.jdk_version).join(', '));
|
||||
core.endGroup();
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ export class DragonwellDistribution extends JavaBase {
|
||||
continue;
|
||||
}
|
||||
const archMap = platformMap[arch];
|
||||
if (jdkVersion === 'latest') {
|
||||
if (jdkVersion == 'latest') {
|
||||
jdkVersion = majorVersion;
|
||||
}
|
||||
if (jdkVersion.includes('.')) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user