mirror of
https://github.com/actions/setup-java.git
synced 2024-11-14 14:08:05 +00:00
chore: refactor code
This commit is contained in:
parent
3fd8616c89
commit
4259d72e25
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
@ -102731,8 +102731,10 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
|||||||
if (jdkVersion === 'latest') {
|
if (jdkVersion === 'latest') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits).
|
||||||
|
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
|
||||||
if (jdkVersion.split('.').length > 3) {
|
if (jdkVersion.split('.').length > 3) {
|
||||||
jdkVersion = this.transformToSemver(jdkVersion);
|
jdkVersion = util_1.convertVersionToSemver(jdkVersion);
|
||||||
}
|
}
|
||||||
for (const edition in archMap) {
|
for (const edition in archMap) {
|
||||||
eligibleVersions.push({
|
eligibleVersions.push({
|
||||||
@ -102760,14 +102762,6 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
|||||||
});
|
});
|
||||||
return sortedVersions.reverse();
|
return sortedVersions.reverse();
|
||||||
}
|
}
|
||||||
// Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits).
|
|
||||||
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
|
|
||||||
transformToSemver(version) {
|
|
||||||
const splits = version.split('.');
|
|
||||||
const versionMainPart = splits.slice(0, 3).join('.');
|
|
||||||
const versionBuildPart = splits.slice(3).join('.');
|
|
||||||
return `${versionMainPart}+${versionBuildPart}`;
|
|
||||||
}
|
|
||||||
getPlatformOption() {
|
getPlatformOption() {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
@ -7,6 +7,7 @@ import path from 'path';
|
|||||||
|
|
||||||
import {JavaBase} from '../base-installer';
|
import {JavaBase} from '../base-installer';
|
||||||
import {
|
import {
|
||||||
|
convertVersionToSemver,
|
||||||
extractJdkFile,
|
extractJdkFile,
|
||||||
getDownloadArchiveExtension,
|
getDownloadArchiveExtension,
|
||||||
getGitHubHttpHeaders,
|
getGitHubHttpHeaders,
|
||||||
@ -146,8 +147,10 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits).
|
||||||
|
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
|
||||||
if (jdkVersion.split('.').length > 3) {
|
if (jdkVersion.split('.').length > 3) {
|
||||||
jdkVersion = this.transformToSemver(jdkVersion);
|
jdkVersion = convertVersionToSemver(jdkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const edition in archMap) {
|
for (const edition in archMap) {
|
||||||
@ -182,15 +185,6 @@ export class DragonwellDistribution extends JavaBase {
|
|||||||
return sortedVersions.reverse();
|
return sortedVersions.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some version of Dragonwell JDK are numerated with help of non-semver notation (more then 3 digits).
|
|
||||||
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
|
|
||||||
private transformToSemver(version: string) {
|
|
||||||
const splits = version.split('.');
|
|
||||||
const versionMainPart = splits.slice(0, 3).join('.');
|
|
||||||
const versionBuildPart = splits.slice(3).join('.');
|
|
||||||
return `${versionMainPart}+${versionBuildPart}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private getPlatformOption(): string {
|
private getPlatformOption(): string {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
Loading…
Reference in New Issue
Block a user