Compare commits

..

2 Commits

Author SHA1 Message Date
Accelerator1996
09e2f7fa4c
Merge 40c66d5b62 into 5b86b67f5b 2023-08-16 12:46:38 +02:00
lvfei.lv
40c66d5b62 add support for dragonwell 2023-03-23 11:22:26 +08:00
4 changed files with 31 additions and 31 deletions

View File

@ -43,11 +43,11 @@ describe('getAvailableVersions', () => {
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
it.each([ it.each([
['8', 'x86', 'linux', 0], ['8', 'x86', 'linux', 36],
['8', 'aarch64', 'linux', 33], ['8', 'aarch64', 'linux', 33],
['8.6.6', 'x64', 'linux', 36], ['8.6.6', 'x64', 'linux', 36],
['8', 'x86', 'anolis', 0], ['8', 'x86', 'anolis', 0],
['8', 'x86', 'windows', 0], ['8', 'x86', 'windows', 35],
['8', 'x86', 'mac', 0], ['8', 'x86', 'mac', 0],
['11', 'x64', 'linux', 36], ['11', 'x64', 'linux', 36],
['11', 'aarch64', 'linux', 33], ['11', 'aarch64', 'linux', 33],

16
dist/setup/index.js vendored
View File

@ -102665,7 +102665,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
} }
const edition = majorVersion == '17' ? 'Standard' : 'Extended'; const edition = majorVersion == '17' ? 'Standard' : 'Extended';
const availableVersions = yield this.getAvailableVersions(); const availableVersions = yield this.getAvailableVersions();
const matchedVersions = availableVersions const matchVersions = availableVersions
.filter(item => item.jdk_version == version && item.edition == edition) .filter(item => item.jdk_version == version && item.edition == edition)
.map(item => { .map(item => {
return { return {
@ -102673,10 +102673,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
url: item.download_link url: item.download_link
}; };
}); });
const resolvedVersion = matchedVersions.length > 0 ? matchedVersions[0] : null; const resolvedVersion = matchVersions.length > 0 ? matchVersions[0] : null;
if (!resolvedVersion) { if (!resolvedVersion) {
const versionsMsg = core.isDebug() const versionsMsg = core.isDebug()
? `Available versions: ${availableVersions}` ? ' Available versions: ${availableVersions}'
: ''; : '';
throw new Error(`Cannot find satisfied version for ${version}.${versionsMsg}`); 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) { if (['8', '11', '17'].includes(majorVersion) != true) {
throw new Error('Support dragonwell versions: 8, 11, 17'); 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 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 : {}; .result) !== null && _a !== void 0 ? _a : {};
if (Object.keys(fetchedDragonwellVersions).length == 0) { if (!fetchDragonwellVersions) {
throw Error(`Could fetch any dragonwell versions from ${availableVersionsUrl}`); 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()) { if (core.isDebug()) {
core.startGroup('Print information about available versions'); core.startGroup('Print information about available versions');
core.debug(availableVersions.map(item => item.jdk_version).join(', '));
core.endGroup(); core.endGroup();
} }
return availableVersions; return availableVersions;
@ -102736,7 +102736,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
continue; continue;
} }
const archMap = platformMap[arch]; const archMap = platformMap[arch];
if (jdkVersion === 'latest') { if (jdkVersion == 'latest') {
jdkVersion = majorVersion; jdkVersion = majorVersion;
} }
if (jdkVersion.includes('.')) { if (jdkVersion.includes('.')) {

View File

@ -125,18 +125,6 @@ steps:
- run: java -cp java HelloWorldApp - 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 ## Installing custom Java package type
```yaml ```yaml
steps: steps:
@ -247,6 +235,18 @@ jobs:
- run: java -cp java HelloWorldApp - 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 ## Publishing using Apache Maven
### Yaml example: ### Yaml example:
```yaml ```yaml

View File

@ -32,7 +32,7 @@ export class DragonwellDistribution extends JavaBase {
} }
const edition = majorVersion == '17' ? 'Standard' : 'Extended'; const edition = majorVersion == '17' ? 'Standard' : 'Extended';
const availableVersions = await this.getAvailableVersions(); const availableVersions = await this.getAvailableVersions();
const matchedVersions = availableVersions const matchVersions = availableVersions
.filter(item => item.jdk_version == version && item.edition == edition) .filter(item => item.jdk_version == version && item.edition == edition)
.map(item => { .map(item => {
return { return {
@ -40,11 +40,10 @@ export class DragonwellDistribution extends JavaBase {
url: item.download_link url: item.download_link
} as JavaDownloadRelease; } as JavaDownloadRelease;
}); });
const resolvedVersion = const resolvedVersion = matchVersions.length > 0 ? matchVersions[0] : null;
matchedVersions.length > 0 ? matchedVersions[0] : null;
if (!resolvedVersion) { if (!resolvedVersion) {
const versionsMsg = core.isDebug() const versionsMsg = core.isDebug()
? `Available versions: ${availableVersions}` ? ' Available versions: ${availableVersions}'
: ''; : '';
throw new Error( throw new Error(
`Cannot find satisfied version for ${version}.${versionsMsg}` `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'); throw new Error('Support dragonwell versions: 8, 11, 17');
} }
arch = arch.includes('x86') ? 'x64' : arch;
const availableVersionsUrl = const availableVersionsUrl =
'https://dragonwell-jdk.io/map_with_checksum.json'; 'https://dragonwell-jdk.io/map_with_checksum.json';
const fetchedDragonwellVersions = const fetchDragonwellVersions =
(await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl)) (await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl))
.result ?? {}; .result ?? {};
if (Object.keys(fetchedDragonwellVersions).length == 0) { if (!fetchDragonwellVersions) {
throw Error( throw Error(
`Could fetch any dragonwell versions from ${availableVersionsUrl}` `Could fetch any dragonwell versions from ${availableVersionsUrl}`
); );
@ -78,12 +79,11 @@ export class DragonwellDistribution extends JavaBase {
const availableVersions = this.getEligibleAvailableVersions( const availableVersions = this.getEligibleAvailableVersions(
platform, platform,
arch, arch,
fetchedDragonwellVersions fetchDragonwellVersions
); );
if (core.isDebug()) { if (core.isDebug()) {
core.startGroup('Print information about available versions'); core.startGroup('Print information about available versions');
core.debug(availableVersions.map(item => item.jdk_version).join(', '));
core.endGroup(); core.endGroup();
} }
@ -138,7 +138,7 @@ export class DragonwellDistribution extends JavaBase {
continue; continue;
} }
const archMap = platformMap[arch]; const archMap = platformMap[arch];
if (jdkVersion === 'latest') { if (jdkVersion == 'latest') {
jdkVersion = majorVersion; jdkVersion = majorVersion;
} }
if (jdkVersion.includes('.')) { if (jdkVersion.includes('.')) {