mirror of
https://github.com/actions/setup-java.git
synced 2024-11-24 17:31:00 -05:00
0ab4596768
* add support for dragonwell * fix: update logic of parsing json file, refactor code * build: rebuild action * chore: update error message * build: rebuild action * tests: fix unit tests, add e2e tests * chore: prettier, lint and rebuild solution * feat: add check for the package type, update unit tests * tests: update e2e tests * tests: remove excess entries from e2e tests * feat: update logic of getting json file * feat: add logic for backuping getting json * chore: update wordings * chore: fix typos, add additional logs * fix: fix review points * chore: rebuild solution * chore: update wordings * chore: refactor code --------- Co-authored-by: Ivan Zosimov <ivanzosimov@github.com> Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
70 lines
2.4 KiB
TypeScript
70 lines
2.4 KiB
TypeScript
import {JavaBase} from './base-installer';
|
|
import {JavaInstallerOptions} from './base-models';
|
|
import {LocalDistribution} from './local/installer';
|
|
import {ZuluDistribution} from './zulu/installer';
|
|
import {AdoptDistribution, AdoptImplementation} from './adopt/installer';
|
|
import {TemurinDistribution, TemurinImplementation} from './temurin/installer';
|
|
import {LibericaDistributions} from './liberica/installer';
|
|
import {MicrosoftDistributions} from './microsoft/installer';
|
|
import {SemeruDistribution} from './semeru/installer';
|
|
import {CorrettoDistribution} from './corretto/installer';
|
|
import {OracleDistribution} from './oracle/installer';
|
|
import {DragonwellDistribution} from './dragonwell/installer';
|
|
|
|
enum JavaDistribution {
|
|
Adopt = 'adopt',
|
|
AdoptHotspot = 'adopt-hotspot',
|
|
AdoptOpenJ9 = 'adopt-openj9',
|
|
Temurin = 'temurin',
|
|
Zulu = 'zulu',
|
|
Liberica = 'liberica',
|
|
JdkFile = 'jdkfile',
|
|
Microsoft = 'microsoft',
|
|
Semeru = 'semeru',
|
|
Corretto = 'corretto',
|
|
Oracle = 'oracle',
|
|
Dragonwell = 'dragonwell'
|
|
}
|
|
|
|
export function getJavaDistribution(
|
|
distributionName: string,
|
|
installerOptions: JavaInstallerOptions,
|
|
jdkFile?: string
|
|
): JavaBase | null {
|
|
switch (distributionName) {
|
|
case JavaDistribution.JdkFile:
|
|
return new LocalDistribution(installerOptions, jdkFile);
|
|
case JavaDistribution.Adopt:
|
|
case JavaDistribution.AdoptHotspot:
|
|
return new AdoptDistribution(
|
|
installerOptions,
|
|
AdoptImplementation.Hotspot
|
|
);
|
|
case JavaDistribution.AdoptOpenJ9:
|
|
return new AdoptDistribution(
|
|
installerOptions,
|
|
AdoptImplementation.OpenJ9
|
|
);
|
|
case JavaDistribution.Temurin:
|
|
return new TemurinDistribution(
|
|
installerOptions,
|
|
TemurinImplementation.Hotspot
|
|
);
|
|
case JavaDistribution.Zulu:
|
|
return new ZuluDistribution(installerOptions);
|
|
case JavaDistribution.Liberica:
|
|
return new LibericaDistributions(installerOptions);
|
|
case JavaDistribution.Microsoft:
|
|
return new MicrosoftDistributions(installerOptions);
|
|
case JavaDistribution.Semeru:
|
|
return new SemeruDistribution(installerOptions);
|
|
case JavaDistribution.Corretto:
|
|
return new CorrettoDistribution(installerOptions);
|
|
case JavaDistribution.Oracle:
|
|
return new OracleDistribution(installerOptions);
|
|
case JavaDistribution.Dragonwell:
|
|
return new DragonwellDistribution(installerOptions);
|
|
default:
|
|
return null;
|
|
}
|
|
}
|