@@ -104133,6 +104133,7 @@ const installer_4 = __nccwpck_require__(8579);
104133104133const installer_5 = __nccwpck_require__(883);
104134104134const installer_6 = __nccwpck_require__(3613);
104135104135const installer_7 = __nccwpck_require__(4750);
104136+ const installer_8 = __nccwpck_require__(4298);
104136104137var JavaDistribution;
104137104138(function (JavaDistribution) {
104138104139 JavaDistribution["Adopt"] = "adopt";
@@ -104144,6 +104145,7 @@ var JavaDistribution;
104144104145 JavaDistribution["JdkFile"] = "jdkfile";
104145104146 JavaDistribution["Microsoft"] = "microsoft";
104146104147 JavaDistribution["Corretto"] = "corretto";
104148+ JavaDistribution["Oracle"] = "oracle";
104147104149})(JavaDistribution || (JavaDistribution = {}));
104148104150function getJavaDistribution(distributionName, installerOptions, jdkFile) {
104149104151 switch (distributionName) {
@@ -104164,6 +104166,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
104164104166 return new installer_6.MicrosoftDistributions(installerOptions);
104165104167 case JavaDistribution.Corretto:
104166104168 return new installer_7.CorrettoDistribution(installerOptions);
104169+ case JavaDistribution.Oracle:
104170+ return new installer_8.OracleDistribution(installerOptions);
104167104171 default:
104168104172 return null;
104169104173 }
@@ -104571,6 +104575,125 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
104571104575exports.MicrosoftDistributions = MicrosoftDistributions;
104572104576
104573104577
104578+ /***/ }),
104579+
104580+ /***/ 4298:
104581+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
104582+
104583+ "use strict";
104584+
104585+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
104586+ if (k2 === undefined) k2 = k;
104587+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
104588+ }) : (function(o, m, k, k2) {
104589+ if (k2 === undefined) k2 = k;
104590+ o[k2] = m[k];
104591+ }));
104592+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
104593+ Object.defineProperty(o, "default", { enumerable: true, value: v });
104594+ }) : function(o, v) {
104595+ o["default"] = v;
104596+ });
104597+ var __importStar = (this && this.__importStar) || function (mod) {
104598+ if (mod && mod.__esModule) return mod;
104599+ var result = {};
104600+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
104601+ __setModuleDefault(result, mod);
104602+ return result;
104603+ };
104604+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
104605+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104606+ return new (P || (P = Promise))(function (resolve, reject) {
104607+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
104608+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
104609+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
104610+ step((generator = generator.apply(thisArg, _arguments || [])).next());
104611+ });
104612+ };
104613+ var __importDefault = (this && this.__importDefault) || function (mod) {
104614+ return (mod && mod.__esModule) ? mod : { "default": mod };
104615+ };
104616+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104617+ exports.OracleDistribution = void 0;
104618+ const core = __importStar(__nccwpck_require__(2186));
104619+ const tc = __importStar(__nccwpck_require__(7784));
104620+ const fs_1 = __importDefault(__nccwpck_require__(7147));
104621+ const path_1 = __importDefault(__nccwpck_require__(1017));
104622+ const base_installer_1 = __nccwpck_require__(9741);
104623+ const util_1 = __nccwpck_require__(2629);
104624+ const http_client_1 = __nccwpck_require__(9925);
104625+ const ORACLE_DL_BASE = 'https://download.oracle.com/java';
104626+ class OracleDistribution extends base_installer_1.JavaBase {
104627+ constructor(installerOptions) {
104628+ super('Oracle', installerOptions);
104629+ }
104630+ downloadTool(javaRelease) {
104631+ return __awaiter(this, void 0, void 0, function* () {
104632+ core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
104633+ const javaArchivePath = yield tc.downloadTool(javaRelease.url);
104634+ core.info(`Extracting Java archive...`);
104635+ let extension = util_1.getDownloadArchiveExtension();
104636+ let extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, extension);
104637+ const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
104638+ const archivePath = path_1.default.join(extractedJavaPath, archiveName);
104639+ const version = this.getToolcacheVersionName(javaRelease.version);
104640+ let javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
104641+ return { version: javaRelease.version, path: javaPath };
104642+ });
104643+ }
104644+ findPackageForDownload(range) {
104645+ return __awaiter(this, void 0, void 0, function* () {
104646+ const arch = this.distributionArchitecture();
104647+ if (arch !== 'x64' && arch !== 'aarch64') {
104648+ throw new Error(`Unsupported architecture: ${this.architecture}`);
104649+ }
104650+ if (!this.stable) {
104651+ throw new Error('Early access versions are not supported');
104652+ }
104653+ if (this.packageType !== 'jdk') {
104654+ throw new Error('Oracle JDK provides only the `jdk` package type');
104655+ }
104656+ const platform = this.getPlatform();
104657+ const extension = util_1.getDownloadArchiveExtension();
104658+ let major;
104659+ let fileUrl;
104660+ if (range.includes('.')) {
104661+ major = range.split('.')[0];
104662+ fileUrl = `${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`;
104663+ }
104664+ else {
104665+ major = range;
104666+ fileUrl = `${ORACLE_DL_BASE}/${range}/latest/jdk-${range}_${platform}-${arch}_bin.${extension}`;
104667+ }
104668+ if (parseInt(major) < 17) {
104669+ throw new Error('Oracle JDK is only supported for JDK 17 and later');
104670+ }
104671+ const response = yield this.http.head(fileUrl);
104672+ if (response.message.statusCode === http_client_1.HttpCodes.NotFound) {
104673+ throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
104674+ }
104675+ if (response.message.statusCode !== http_client_1.HttpCodes.OK) {
104676+ throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
104677+ }
104678+ return { url: fileUrl, version: range };
104679+ });
104680+ }
104681+ getPlatform(platform = process.platform) {
104682+ switch (platform) {
104683+ case 'darwin':
104684+ return 'macos';
104685+ case 'win32':
104686+ return 'windows';
104687+ case 'linux':
104688+ return 'linux';
104689+ default:
104690+ throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
104691+ }
104692+ }
104693+ }
104694+ exports.OracleDistribution = OracleDistribution;
104695+
104696+
104574104697/***/ }),
104575104698
104576104699/***/ 8579:
0 commit comments