2021-04-05 10:02:27 +00:00
|
|
|
import { JavaBase } from './base-installer';
|
|
|
|
import { JavaInstallerOptions } from './base-models';
|
|
|
|
import { LocalDistribution } from './local/installer';
|
|
|
|
import { ZuluDistribution } from './zulu/installer';
|
2021-05-17 13:33:21 +00:00
|
|
|
import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
2021-08-06 10:12:36 +00:00
|
|
|
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
2021-11-29 09:15:06 +00:00
|
|
|
import { LibericaDistributions } from './liberica/installer';
|
2021-12-08 18:50:14 +00:00
|
|
|
import { MicrosoftDistributions } from './microsoft/installer';
|
2021-04-05 10:02:27 +00:00
|
|
|
|
|
|
|
enum JavaDistribution {
|
|
|
|
Adopt = 'adopt',
|
2021-05-17 13:33:21 +00:00
|
|
|
AdoptHotspot = 'adopt-hotspot',
|
|
|
|
AdoptOpenJ9 = 'adopt-openj9',
|
2021-08-06 10:12:36 +00:00
|
|
|
Temurin = 'temurin',
|
2021-04-05 10:02:27 +00:00
|
|
|
Zulu = 'zulu',
|
2021-11-29 09:15:06 +00:00
|
|
|
Liberica = 'liberica',
|
2021-12-08 18:50:14 +00:00
|
|
|
JdkFile = 'jdkfile',
|
|
|
|
Microsoft = 'microsoft'
|
2021-04-05 10:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getJavaDistribution(
|
|
|
|
distributionName: string,
|
|
|
|
installerOptions: JavaInstallerOptions,
|
|
|
|
jdkFile?: string
|
|
|
|
): JavaBase | null {
|
|
|
|
switch (distributionName) {
|
|
|
|
case JavaDistribution.JdkFile:
|
|
|
|
return new LocalDistribution(installerOptions, jdkFile);
|
|
|
|
case JavaDistribution.Adopt:
|
2021-05-17 13:33:21 +00:00
|
|
|
case JavaDistribution.AdoptHotspot:
|
|
|
|
return new AdoptDistribution(installerOptions, AdoptImplementation.Hotspot);
|
|
|
|
case JavaDistribution.AdoptOpenJ9:
|
|
|
|
return new AdoptDistribution(installerOptions, AdoptImplementation.OpenJ9);
|
2021-08-06 10:12:36 +00:00
|
|
|
case JavaDistribution.Temurin:
|
|
|
|
return new TemurinDistribution(installerOptions, TemurinImplementation.Hotspot);
|
2021-04-05 10:02:27 +00:00
|
|
|
case JavaDistribution.Zulu:
|
|
|
|
return new ZuluDistribution(installerOptions);
|
2021-11-29 09:15:06 +00:00
|
|
|
case JavaDistribution.Liberica:
|
|
|
|
return new LibericaDistributions(installerOptions);
|
2021-12-08 18:50:14 +00:00
|
|
|
case JavaDistribution.Microsoft:
|
|
|
|
return new MicrosoftDistributions(installerOptions);
|
2021-04-05 10:02:27 +00:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|