add custom jdk url

This commit is contained in:
suisrc 2025-06-26 09:05:01 +08:00
parent ebb356cc4e
commit d5ddf8cf5e
2 changed files with 31 additions and 4 deletions

17
dist/setup/index.js vendored
View File

@ -128794,8 +128794,21 @@ class JavaBase {
else {
core.info('Trying to resolve the latest version from remote');
try {
const javaRelease = yield this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
const javaRelease = { version: this.version };
const jdkUrl = core.getInput('jdk-url');
if (jdkUrl) {
if (!this.version) {
throw new Error('You must specify a version when using a custom JDK URL.');
}
core.info(`Using custom JDK URL: ${jdkUrl}`);
javaRelease.url = jdkUrl;
}
else {
const jdkPkg = yield this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
javaRelease.version = jdkPkg.version;
javaRelease.url = jdkPkg.url;
}
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
}

View File

@ -52,8 +52,22 @@ export abstract class JavaBase {
} else {
core.info('Trying to resolve the latest version from remote');
try {
const javaRelease = await this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
const javaRelease = { version: this.version } as JavaDownloadRelease;
const jdkUrl = core.getInput('jdk-url');
if (jdkUrl) {
if (!this.version) {
throw new Error(
'You must specify a version when using a custom JDK URL.'
);
}
core.info(`Using custom JDK URL: ${jdkUrl}`);
javaRelease.url = jdkUrl;
} else {
const jdkPkg = await this.findPackageForDownload(this.version)
core.info(`Resolved latest version as ${javaRelease.version}`);
javaRelease.version = jdkPkg.version;
javaRelease.url = jdkPkg.url;
}
if (foundJava?.version === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else {