2023-03-09 07:49:35 -05:00
|
|
|
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';
|
2023-03-21 05:32:38 -04:00
|
|
|
import {SemeruDistribution} from './semeru/installer';
|
2023-03-09 07:49:35 -05:00
|
|
|
import {CorrettoDistribution} from './corretto/installer';
|
|
|
|
import {OracleDistribution} from './oracle/installer';
|
2023-09-20 07:22:11 -04:00
|
|
|
import {DragonwellDistribution} from './dragonwell/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-08-06 06:12:36 -04:00
|
|
|
Temurin = 'temurin',
|
2021-04-05 06:02:27 -04:00
|
|
|
Zulu = 'zulu',
|
2021-11-29 04:15:06 -05:00
|
|
|
Liberica = 'liberica',
|
2021-12-08 13:50:14 -05:00
|
|
|
JdkFile = 'jdkfile',
|
2022-04-29 06:38:36 -04:00
|
|
|
Microsoft = 'microsoft',
|
2023-03-21 05:32:38 -04:00
|
|
|
Semeru = 'semeru',
|
2023-02-07 10:29:21 -05:00
|
|
|
Corretto = 'corretto',
|
2023-09-20 07:22:11 -04:00
|
|
|
Oracle = 'oracle',
|
|
|
|
Dragonwell = 'dragonwell'
|
2021-04-05 06:02:27 -04: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 09:33:21 -04:00
|
|
|
case JavaDistribution.AdoptHotspot:
|
2023-03-09 07:49:35 -05:00
|
|
|
return new AdoptDistribution(
|
|
|
|
installerOptions,
|
|
|
|
AdoptImplementation.Hotspot
|
|
|
|
);
|
2021-05-17 09:33:21 -04:00
|
|
|
case JavaDistribution.AdoptOpenJ9:
|
2023-03-09 07:49:35 -05:00
|
|
|
return new AdoptDistribution(
|
|
|
|
installerOptions,
|
|
|
|
AdoptImplementation.OpenJ9
|
|
|
|
);
|
2021-08-06 06:12:36 -04:00
|
|
|
case JavaDistribution.Temurin:
|
2023-03-09 07:49:35 -05:00
|
|
|
return new TemurinDistribution(
|
|
|
|
installerOptions,
|
|
|
|
TemurinImplementation.Hotspot
|
|
|
|
);
|
2021-04-05 06:02:27 -04:00
|
|
|
case JavaDistribution.Zulu:
|
|
|
|
return new ZuluDistribution(installerOptions);
|
2021-11-29 04:15:06 -05:00
|
|
|
case JavaDistribution.Liberica:
|
|
|
|
return new LibericaDistributions(installerOptions);
|
2021-12-08 13:50:14 -05:00
|
|
|
case JavaDistribution.Microsoft:
|
|
|
|
return new MicrosoftDistributions(installerOptions);
|
2023-03-21 05:32:38 -04:00
|
|
|
case JavaDistribution.Semeru:
|
|
|
|
return new SemeruDistribution(installerOptions);
|
2022-04-29 06:38:36 -04:00
|
|
|
case JavaDistribution.Corretto:
|
|
|
|
return new CorrettoDistribution(installerOptions);
|
2023-02-07 10:29:21 -05:00
|
|
|
case JavaDistribution.Oracle:
|
|
|
|
return new OracleDistribution(installerOptions);
|
2023-09-20 07:22:11 -04:00
|
|
|
case JavaDistribution.Dragonwell:
|
|
|
|
return new DragonwellDistribution(installerOptions);
|
2021-04-05 06:02:27 -04:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|