2021-04-05 06:02:27 -04:00
|
|
|
import { JavaBase } from './base-installer';
|
|
|
|
import { JavaInstallerOptions } from './base-models';
|
|
|
|
import { LocalDistribution } from './local/installer';
|
|
|
|
import { ZuluDistribution } from './zulu/installer';
|
2021-05-17 09:33:21 -04:00
|
|
|
import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
2021-04-05 06:02:27 -04:00
|
|
|
|
|
|
|
enum JavaDistribution {
|
|
|
|
Adopt = 'adopt',
|
2021-05-17 09:33:21 -04:00
|
|
|
AdoptHotspot = 'adopt-hotspot',
|
|
|
|
AdoptOpenJ9 = 'adopt-openj9',
|
2021-04-05 06:02:27 -04:00
|
|
|
Zulu = 'zulu',
|
|
|
|
JdkFile = 'jdkfile'
|
|
|
|
}
|
|
|
|
|
|
|
|
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 09:33:21 -04:00
|
|
|
case JavaDistribution.AdoptHotspot:
|
|
|
|
return new AdoptDistribution(installerOptions, AdoptImplementation.Hotspot);
|
|
|
|
case JavaDistribution.AdoptOpenJ9:
|
|
|
|
return new AdoptDistribution(installerOptions, AdoptImplementation.OpenJ9);
|
2021-04-05 06:02:27 -04:00
|
|
|
case JavaDistribution.Zulu:
|
|
|
|
return new ZuluDistribution(installerOptions);
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|