mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
fix comments
This commit is contained in:
parent
1d25bcb6a7
commit
e6d2942770
6 changed files with 24 additions and 42 deletions
12
dist/cleanup/index.js
vendored
12
dist/cleanup/index.js
vendored
|
@ -1549,9 +1549,7 @@ exports.getVersionFromToolcachePath = getVersionFromToolcachePath;
|
||||||
function extractJdkFile(toolPath, extension) {
|
function extractJdkFile(toolPath, extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
extension = toolPath.endsWith('.tar.gz')
|
extension = toolPath.endsWith('.tar.gz') ? 'tar.gz' : path_1.default.extname(toolPath);
|
||||||
? 'tar.gz'
|
|
||||||
: path_1.default.extname(toolPath);
|
|
||||||
if (extension.startsWith('.')) {
|
if (extension.startsWith('.')) {
|
||||||
extension = extension.substring(1);
|
extension = extension.substring(1);
|
||||||
}
|
}
|
||||||
|
@ -5091,13 +5089,7 @@ function importKey(privateKey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
yield exec.exec('gpg', [
|
yield exec.exec('gpg', ['--batch', '--import-options', 'import-show', '--import', exports.PRIVATE_KEY_FILE], options);
|
||||||
'--batch',
|
|
||||||
'--import-options',
|
|
||||||
'import-show',
|
|
||||||
'--import',
|
|
||||||
exports.PRIVATE_KEY_FILE
|
|
||||||
], options);
|
|
||||||
yield io.rmRF(exports.PRIVATE_KEY_FILE);
|
yield io.rmRF(exports.PRIVATE_KEY_FILE);
|
||||||
const match = output.match(PRIVATE_KEY_FINGERPRINT_REGEX);
|
const match = output.match(PRIVATE_KEY_FINGERPRINT_REGEX);
|
||||||
return match && match[0];
|
return match && match[0];
|
||||||
|
|
38
dist/setup/index.js
vendored
38
dist/setup/index.js
vendored
|
@ -3951,7 +3951,7 @@ const util_1 = __webpack_require__(322);
|
||||||
class JavaBase {
|
class JavaBase {
|
||||||
constructor(distribution, installerOptions) {
|
constructor(distribution, installerOptions) {
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
this.http = new httpm.HttpClient('setup-java', undefined, {
|
this.http = new httpm.HttpClient('actions/setup-java', undefined, {
|
||||||
allowRetries: true,
|
allowRetries: true,
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
});
|
});
|
||||||
|
@ -3966,12 +3966,12 @@ class JavaBase {
|
||||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`Java ${this.version.raw} is not found in tool-cache. Trying to download...`);
|
core.info(`Java ${this.version.raw} was not found in tool-cache. Trying to download...`);
|
||||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||||
foundJava = yield this.downloadTool(javaRelease);
|
foundJava = yield this.downloadTool(javaRelease);
|
||||||
core.info(`Java ${foundJava.version} was downloaded`);
|
core.info(`Java ${foundJava.version} was downloaded`);
|
||||||
}
|
}
|
||||||
core.info(`Setting Java ${foundJava.version} as default`);
|
core.info(`Setting Java ${foundJava.version} as the default`);
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
return foundJava;
|
return foundJava;
|
||||||
});
|
});
|
||||||
|
@ -4023,7 +4023,7 @@ class JavaBase {
|
||||||
stable = false;
|
stable = false;
|
||||||
}
|
}
|
||||||
if (!semver_1.default.validRange(version)) {
|
if (!semver_1.default.validRange(version)) {
|
||||||
throw new Error(`The string '${version}' is not valid SemVer notation for Java version. Please check README file for code snippets and more detailed information`);
|
throw new Error(`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
version: new semver_1.default.Range(version),
|
version: new semver_1.default.Range(version),
|
||||||
|
@ -9352,14 +9352,14 @@ class LocalDistribution extends base_installer_1.JavaBase {
|
||||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`Java ${this.version.raw} is not found in tool-cache. Trying to unpack JDK file...`);
|
core.info(`Java ${this.version.raw} was not found in tool-cache. Trying to unpack JDK file...`);
|
||||||
if (!this.jdkFile) {
|
if (!this.jdkFile) {
|
||||||
throw new Error("'jdkFile' is not specified");
|
throw new Error("'jdkFile' is not specified");
|
||||||
}
|
}
|
||||||
const jdkFilePath = path_1.default.resolve(this.jdkFile);
|
const jdkFilePath = path_1.default.resolve(this.jdkFile);
|
||||||
const stats = fs_1.default.statSync(jdkFilePath);
|
const stats = fs_1.default.statSync(jdkFilePath);
|
||||||
if (!stats.isFile()) {
|
if (!stats.isFile()) {
|
||||||
throw new Error(`JDK file is not found in path '${jdkFilePath}'`);
|
throw new Error(`JDK file was not found in path '${jdkFilePath}'`);
|
||||||
}
|
}
|
||||||
core.info(`Extracting Java from '${jdkFilePath}'`);
|
core.info(`Extracting Java from '${jdkFilePath}'`);
|
||||||
const extractedJavaPath = yield util_1.extractJdkFile(jdkFilePath);
|
const extractedJavaPath = yield util_1.extractJdkFile(jdkFilePath);
|
||||||
|
@ -12944,9 +12944,7 @@ exports.getVersionFromToolcachePath = getVersionFromToolcachePath;
|
||||||
function extractJdkFile(toolPath, extension) {
|
function extractJdkFile(toolPath, extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
extension = toolPath.endsWith('.tar.gz')
|
extension = toolPath.endsWith('.tar.gz') ? 'tar.gz' : path_1.default.extname(toolPath);
|
||||||
? 'tar.gz'
|
|
||||||
: path_1.default.extname(toolPath);
|
|
||||||
if (extension.startsWith('.')) {
|
if (extension.startsWith('.')) {
|
||||||
extension = extension.substring(1);
|
extension = extension.substring(1);
|
||||||
}
|
}
|
||||||
|
@ -13230,8 +13228,7 @@ function configureAuthentication() {
|
||||||
const id = core.getInput(constants.INPUT_SERVER_ID);
|
const id = core.getInput(constants.INPUT_SERVER_ID);
|
||||||
const username = core.getInput(constants.INPUT_SERVER_USERNAME);
|
const username = core.getInput(constants.INPUT_SERVER_USERNAME);
|
||||||
const password = core.getInput(constants.INPUT_SERVER_PASSWORD);
|
const password = core.getInput(constants.INPUT_SERVER_PASSWORD);
|
||||||
const gpgPrivateKey = core.getInput(constants.INPUT_GPG_PRIVATE_KEY) ||
|
const gpgPrivateKey = core.getInput(constants.INPUT_GPG_PRIVATE_KEY) || constants.INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
||||||
constants.INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
|
||||||
const gpgPassphrase = core.getInput(constants.INPUT_GPG_PASSPHRASE) ||
|
const gpgPassphrase = core.getInput(constants.INPUT_GPG_PASSPHRASE) ||
|
||||||
(gpgPrivateKey ? constants.INPUT_DEFAULT_GPG_PASSPHRASE : undefined);
|
(gpgPrivateKey ? constants.INPUT_DEFAULT_GPG_PASSPHRASE : undefined);
|
||||||
if (gpgPrivateKey) {
|
if (gpgPrivateKey) {
|
||||||
|
@ -13774,9 +13771,7 @@ class AdoptiumDistribution extends base_installer_1.JavaBase {
|
||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersionsWithBinaries
|
const availableOptions = availableVersionsWithBinaries.map(item => item.version).join(', ');
|
||||||
.map(item => item.version)
|
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
const availableOptionsMessage = availableOptions
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
: '';
|
: '';
|
||||||
|
@ -14103,9 +14098,7 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
||||||
});
|
});
|
||||||
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
const resolvedFullVersion = satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||||
if (!resolvedFullVersion) {
|
if (!resolvedFullVersion) {
|
||||||
const availableOptions = availableVersions
|
const availableOptions = availableVersions.map(item => item.version).join(', ');
|
||||||
.map(item => item.version)
|
|
||||||
.join(', ');
|
|
||||||
const availableOptionsMessage = availableOptions
|
const availableOptionsMessage = availableOptions
|
||||||
? `\nAvailable versions: ${availableOptions}`
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
: '';
|
: '';
|
||||||
|
@ -14155,8 +14148,7 @@ class ZuluDistribution extends base_installer_1.JavaBase {
|
||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
|
core.debug(`Gathering available versions from '${availableVersionsUrl}'`);
|
||||||
}
|
}
|
||||||
const availableVersions = (_b = (yield this.http.getJson(availableVersionsUrl))
|
const availableVersions = (_b = (yield this.http.getJson(availableVersionsUrl)).result) !== null && _b !== void 0 ? _b : [];
|
||||||
.result) !== null && _b !== void 0 ? _b : [];
|
|
||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
core.startGroup('Print information about available versions');
|
core.startGroup('Print information about available versions');
|
||||||
console.timeEnd('azul-retrieve-available-versions');
|
console.timeEnd('azul-retrieve-available-versions');
|
||||||
|
@ -41118,13 +41110,7 @@ function importKey(privateKey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
yield exec.exec('gpg', [
|
yield exec.exec('gpg', ['--batch', '--import-options', 'import-show', '--import', exports.PRIVATE_KEY_FILE], options);
|
||||||
'--batch',
|
|
||||||
'--import-options',
|
|
||||||
'import-show',
|
|
||||||
'--import',
|
|
||||||
exports.PRIVATE_KEY_FILE
|
|
||||||
], options);
|
|
||||||
yield io.rmRF(exports.PRIVATE_KEY_FILE);
|
yield io.rmRF(exports.PRIVATE_KEY_FILE);
|
||||||
const match = output.match(PRIVATE_KEY_FINGERPRINT_REGEX);
|
const match = output.match(PRIVATE_KEY_FINGERPRINT_REGEX);
|
||||||
return match && match[0];
|
return match && match[0];
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Models from https://api.adoptopenjdk.net/swagger-ui/#/Assets/get_v3_assets_version__version
|
||||||
|
|
||||||
export interface IAdoptiumAvailableVersions {
|
export interface IAdoptiumAvailableVersions {
|
||||||
binaries: [
|
binaries: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ export abstract class JavaBase {
|
||||||
protected stable: boolean;
|
protected stable: boolean;
|
||||||
|
|
||||||
constructor(protected distribution: string, installerOptions: JavaInstallerOptions) {
|
constructor(protected distribution: string, installerOptions: JavaInstallerOptions) {
|
||||||
this.http = new httpm.HttpClient('setup-java', undefined, {
|
this.http = new httpm.HttpClient('actions/setup-java', undefined, {
|
||||||
allowRetries: true,
|
allowRetries: true,
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
});
|
});
|
||||||
|
@ -34,13 +34,13 @@ export abstract class JavaBase {
|
||||||
if (foundJava) {
|
if (foundJava) {
|
||||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
} else {
|
} else {
|
||||||
core.info(`Java ${this.version.raw} is not found in tool-cache. Trying to download...`);
|
core.info(`Java ${this.version.raw} was not found in tool-cache. Trying to download...`);
|
||||||
const javaRelease = await this.findPackageForDownload(this.version);
|
const javaRelease = await this.findPackageForDownload(this.version);
|
||||||
foundJava = await this.downloadTool(javaRelease);
|
foundJava = await this.downloadTool(javaRelease);
|
||||||
core.info(`Java ${foundJava.version} was downloaded`);
|
core.info(`Java ${foundJava.version} was downloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Setting Java ${foundJava.version} as default`);
|
core.info(`Setting Java ${foundJava.version} as the default`);
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
|
|
||||||
return foundJava;
|
return foundJava;
|
||||||
|
@ -103,7 +103,7 @@ export abstract class JavaBase {
|
||||||
|
|
||||||
if (!semver.validRange(version)) {
|
if (!semver.validRange(version)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The string '${version}' is not valid SemVer notation for Java version. Please check README file for code snippets and more detailed information`
|
`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class LocalDistribution extends JavaBase {
|
||||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||||
} else {
|
} else {
|
||||||
core.info(
|
core.info(
|
||||||
`Java ${this.version.raw} is not found in tool-cache. Trying to unpack JDK file...`
|
`Java ${this.version.raw} was not found in tool-cache. Trying to unpack JDK file...`
|
||||||
);
|
);
|
||||||
if (!this.jdkFile) {
|
if (!this.jdkFile) {
|
||||||
throw new Error("'jdkFile' is not specified");
|
throw new Error("'jdkFile' is not specified");
|
||||||
|
@ -31,7 +31,7 @@ export class LocalDistribution extends JavaBase {
|
||||||
const stats = fs.statSync(jdkFilePath);
|
const stats = fs.statSync(jdkFilePath);
|
||||||
|
|
||||||
if (!stats.isFile()) {
|
if (!stats.isFile()) {
|
||||||
throw new Error(`JDK file is not found in path '${jdkFilePath}'`);
|
throw new Error(`JDK file was not found in path '${jdkFilePath}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Extracting Java from '${jdkFilePath}'`);
|
core.info(`Extracting Java from '${jdkFilePath}'`);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Models from https://app.swaggerhub.com/apis-docs/azul/zulu-download-community/1.0
|
||||||
|
|
||||||
export interface IZuluVersions {
|
export interface IZuluVersions {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue