@@ -104159,6 +104159,7 @@ const installer_4 = __nccwpck_require__(8579);
104159104159const installer_5 = __nccwpck_require__(883);
104160104160const installer_6 = __nccwpck_require__(3613);
104161104161const installer_7 = __nccwpck_require__(4750);
104162+ const installer_8 = __nccwpck_require__(4298);
104162104163var JavaDistribution;
104163104164(function (JavaDistribution) {
104164104165 JavaDistribution["Adopt"] = "adopt";
@@ -104170,6 +104171,7 @@ var JavaDistribution;
104170104171 JavaDistribution["JdkFile"] = "jdkfile";
104171104172 JavaDistribution["Microsoft"] = "microsoft";
104172104173 JavaDistribution["Corretto"] = "corretto";
104174+ JavaDistribution["Oracle"] = "oracle";
104173104175})(JavaDistribution || (JavaDistribution = {}));
104174104176function getJavaDistribution(distributionName, installerOptions, jdkFile) {
104175104177 switch (distributionName) {
@@ -104190,6 +104192,8 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) {
104190104192 return new installer_6.MicrosoftDistributions(installerOptions);
104191104193 case JavaDistribution.Corretto:
104192104194 return new installer_7.CorrettoDistribution(installerOptions);
104195+ case JavaDistribution.Oracle:
104196+ return new installer_8.OracleDistribution(installerOptions);
104193104197 default:
104194104198 return null;
104195104199 }
@@ -104597,6 +104601,125 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
104597104601exports.MicrosoftDistributions = MicrosoftDistributions;
104598104602
104599104603
104604+ /***/ }),
104605+
104606+ /***/ 4298:
104607+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
104608+
104609+ "use strict";
104610+
104611+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
104612+ if (k2 === undefined) k2 = k;
104613+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
104614+ }) : (function(o, m, k, k2) {
104615+ if (k2 === undefined) k2 = k;
104616+ o[k2] = m[k];
104617+ }));
104618+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
104619+ Object.defineProperty(o, "default", { enumerable: true, value: v });
104620+ }) : function(o, v) {
104621+ o["default"] = v;
104622+ });
104623+ var __importStar = (this && this.__importStar) || function (mod) {
104624+ if (mod && mod.__esModule) return mod;
104625+ var result = {};
104626+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
104627+ __setModuleDefault(result, mod);
104628+ return result;
104629+ };
104630+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
104631+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104632+ return new (P || (P = Promise))(function (resolve, reject) {
104633+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
104634+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
104635+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
104636+ step((generator = generator.apply(thisArg, _arguments || [])).next());
104637+ });
104638+ };
104639+ var __importDefault = (this && this.__importDefault) || function (mod) {
104640+ return (mod && mod.__esModule) ? mod : { "default": mod };
104641+ };
104642+ Object.defineProperty(exports, "__esModule", ({ value: true }));
104643+ exports.OracleDistribution = void 0;
104644+ const core = __importStar(__nccwpck_require__(2186));
104645+ const tc = __importStar(__nccwpck_require__(7784));
104646+ const fs_1 = __importDefault(__nccwpck_require__(7147));
104647+ const path_1 = __importDefault(__nccwpck_require__(1017));
104648+ const base_installer_1 = __nccwpck_require__(9741);
104649+ const util_1 = __nccwpck_require__(2629);
104650+ const http_client_1 = __nccwpck_require__(9925);
104651+ const ORACLE_DL_BASE = 'https://download.oracle.com/java';
104652+ class OracleDistribution extends base_installer_1.JavaBase {
104653+ constructor(installerOptions) {
104654+ super('Oracle', installerOptions);
104655+ }
104656+ downloadTool(javaRelease) {
104657+ return __awaiter(this, void 0, void 0, function* () {
104658+ core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
104659+ const javaArchivePath = yield tc.downloadTool(javaRelease.url);
104660+ core.info(`Extracting Java archive...`);
104661+ let extension = util_1.getDownloadArchiveExtension();
104662+ let extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, extension);
104663+ const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
104664+ const archivePath = path_1.default.join(extractedJavaPath, archiveName);
104665+ const version = this.getToolcacheVersionName(javaRelease.version);
104666+ let javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
104667+ return { version: javaRelease.version, path: javaPath };
104668+ });
104669+ }
104670+ findPackageForDownload(range) {
104671+ return __awaiter(this, void 0, void 0, function* () {
104672+ const arch = this.distributionArchitecture();
104673+ if (arch !== 'x64' && arch !== 'aarch64') {
104674+ throw new Error(`Unsupported architecture: ${this.architecture}`);
104675+ }
104676+ if (!this.stable) {
104677+ throw new Error('Early access versions are not supported');
104678+ }
104679+ if (this.packageType !== 'jdk') {
104680+ throw new Error('Oracle JDK provides only the `jdk` package type');
104681+ }
104682+ const platform = this.getPlatform();
104683+ const extension = util_1.getDownloadArchiveExtension();
104684+ let major;
104685+ let fileUrl;
104686+ if (range.includes('.')) {
104687+ major = range.split('.')[0];
104688+ fileUrl = `${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`;
104689+ }
104690+ else {
104691+ major = range;
104692+ fileUrl = `${ORACLE_DL_BASE}/${range}/latest/jdk-${range}_${platform}-${arch}_bin.${extension}`;
104693+ }
104694+ if (parseInt(major) < 17) {
104695+ throw new Error('Oracle JDK is only supported for JDK 17 and later');
104696+ }
104697+ const response = yield this.http.head(fileUrl);
104698+ if (response.message.statusCode === http_client_1.HttpCodes.NotFound) {
104699+ throw new Error(`Could not find Oracle JDK for SemVer ${range}`);
104700+ }
104701+ if (response.message.statusCode !== http_client_1.HttpCodes.OK) {
104702+ throw new Error(`Http request for Oracle JDK failed with status code: ${response.message.statusCode}`);
104703+ }
104704+ return { url: fileUrl, version: range };
104705+ });
104706+ }
104707+ getPlatform(platform = process.platform) {
104708+ switch (platform) {
104709+ case 'darwin':
104710+ return 'macos';
104711+ case 'win32':
104712+ return 'windows';
104713+ case 'linux':
104714+ return 'linux';
104715+ default:
104716+ throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
104717+ }
104718+ }
104719+ }
104720+ exports.OracleDistribution = OracleDistribution;
104721+
104722+
104600104723/***/ }),
104601104724
104602104725/***/ 8579:
0 commit comments