Add option add-toolchain-only
This commit is contained in:
parent
eb6157cd13
commit
fa4b328aab
@ -87,7 +87,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: altHome,
|
settingsDirectory: altHome,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(false);
|
expect(fs.existsSync(m2Dir)).toBe(false);
|
||||||
@ -136,7 +136,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -218,7 +218,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -304,7 +304,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -382,7 +382,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -453,7 +453,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -546,7 +546,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -606,7 +606,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -665,7 +665,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -749,7 +749,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -829,7 +829,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: true
|
addToolchain: true
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -884,7 +884,7 @@ describe('toolchains tests', () => {
|
|||||||
await toolchains.createToolchainsSettings({
|
await toolchains.createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory: m2Dir,
|
settingsDirectory: m2Dir,
|
||||||
overwriteSettings: false
|
addToolchain: false
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(true);
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
@ -944,6 +944,7 @@ describe('toolchains tests', () => {
|
|||||||
version,
|
version,
|
||||||
distributionName,
|
distributionName,
|
||||||
jdkHome,
|
jdkHome,
|
||||||
|
true,
|
||||||
undefined
|
undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
12
action.yml
12
action.yml
@ -31,9 +31,9 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
set-default:
|
set-default:
|
||||||
description: 'Set this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME_<major>_<arch> is still set.'
|
description: 'Set this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME_<major>_<arch> is still set. Default is "!add-toolchain-only". If explcitly set "true", it will update JAVA_HOME and PATH regardless of "add-toolchain-only".'
|
||||||
required: false
|
required: false
|
||||||
default: true
|
# DO NOT set a default here! If not explicitly set, the default will be propagated from input 'add-toolchain-only'!
|
||||||
verify-signature:
|
verify-signature:
|
||||||
description: 'Verify downloaded Java package signatures when supported by the selected distribution'
|
description: 'Verify downloaded Java package signatures when supported by the selected distribution'
|
||||||
required: false
|
required: false
|
||||||
@ -60,9 +60,13 @@ inputs:
|
|||||||
description: 'Path to where the settings.xml file will be written. Default is ~/.m2.'
|
description: 'Path to where the settings.xml file will be written. Default is ~/.m2.'
|
||||||
required: false
|
required: false
|
||||||
overwrite-settings:
|
overwrite-settings:
|
||||||
description: 'Overwrite the settings.xml file if it exists. Default is "true".'
|
description: 'Overwrite the settings.xml file if it exists. Default is "!add-toolchain-only". If explcitly set "true", it will update settings.xml regardless of "add-toolchain-only".'
|
||||||
required: false
|
required: false
|
||||||
default: true
|
# DO NOT set a default here! If not explicitly set, the default will be propagated from input 'add-toolchain-only'!
|
||||||
|
add-toolchain-only:
|
||||||
|
description: 'Update toolchains.xml only. Default is "false". No update of settings.xml, no update of JAVA_HOME and PATH unless "overwrite-settings" or "set-default" are explicitly set "true".'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
gpg-private-key:
|
gpg-private-key:
|
||||||
description: 'GPG private key to import. Default is empty string.'
|
description: 'GPG private key to import. Default is empty string.'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@ -8,19 +8,14 @@ import * as os from 'os';
|
|||||||
import {create as xmlCreate} from 'xmlbuilder2';
|
import {create as xmlCreate} from 'xmlbuilder2';
|
||||||
import * as constants from './constants.js';
|
import * as constants from './constants.js';
|
||||||
import * as gpg from './gpg.js';
|
import * as gpg from './gpg.js';
|
||||||
import {getBooleanInput} from './util.js';
|
|
||||||
|
|
||||||
export async function configureAuthentication() {
|
export async function configureAuthentication(overwriteSettings: boolean) {
|
||||||
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 settingsDirectory =
|
const settingsDirectory =
|
||||||
core.getInput(constants.INPUT_SETTINGS_PATH) ||
|
core.getInput(constants.INPUT_SETTINGS_PATH) ||
|
||||||
path.join(os.homedir(), constants.M2_DIR);
|
path.join(os.homedir(), constants.M2_DIR);
|
||||||
const overwriteSettings = getBooleanInput(
|
|
||||||
constants.INPUT_OVERWRITE_SETTINGS,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
const gpgPrivateKey =
|
const gpgPrivateKey =
|
||||||
core.getInput(constants.INPUT_GPG_PRIVATE_KEY) ||
|
core.getInput(constants.INPUT_GPG_PRIVATE_KEY) ||
|
||||||
constants.INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
constants.INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
||||||
|
|||||||
@ -15,6 +15,7 @@ export const INPUT_SERVER_USERNAME = 'server-username';
|
|||||||
export const INPUT_SERVER_PASSWORD = 'server-password';
|
export const INPUT_SERVER_PASSWORD = 'server-password';
|
||||||
export const INPUT_SETTINGS_PATH = 'settings-path';
|
export const INPUT_SETTINGS_PATH = 'settings-path';
|
||||||
export const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
export const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
||||||
|
export const INPUT_ADD_TOOLCHAIN_ONLY = 'add-toolchain-only';
|
||||||
export const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
export const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
||||||
export const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
export const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,20 @@ import {getJavaDistribution} from './distributions/distribution-factory.js';
|
|||||||
import {JavaInstallerOptions} from './distributions/base-models.js';
|
import {JavaInstallerOptions} from './distributions/base-models.js';
|
||||||
import {configureMavenArgs} from './maven-args.js';
|
import {configureMavenArgs} from './maven-args.js';
|
||||||
|
|
||||||
|
interface IInstallerInputsOptions {
|
||||||
|
architecture: string;
|
||||||
|
packageType: string;
|
||||||
|
checkLatest: boolean;
|
||||||
|
setDefault: boolean;
|
||||||
|
overwriteSettings: boolean;
|
||||||
|
addToolchainOnly: boolean;
|
||||||
|
verifySignature: boolean;
|
||||||
|
verifySignaturePublicKey: string | undefined;
|
||||||
|
distributionName: string;
|
||||||
|
jdkFile: string;
|
||||||
|
toolchainIds: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
||||||
@ -28,7 +42,18 @@ async function run() {
|
|||||||
constants.INPUT_CACHE_DEPENDENCY_PATH
|
constants.INPUT_CACHE_DEPENDENCY_PATH
|
||||||
);
|
);
|
||||||
const checkLatest = getBooleanInput(constants.INPUT_CHECK_LATEST, false);
|
const checkLatest = getBooleanInput(constants.INPUT_CHECK_LATEST, false);
|
||||||
const setDefault = getBooleanInput(constants.INPUT_SET_DEFAULT, true);
|
const addToolchainOnly = getBooleanInput(
|
||||||
|
constants.INPUT_ADD_TOOLCHAIN_ONLY,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
const setDefault = getBooleanInput(
|
||||||
|
constants.INPUT_SET_DEFAULT,
|
||||||
|
!addToolchainOnly
|
||||||
|
);
|
||||||
|
const overwriteSettings = getBooleanInput(
|
||||||
|
constants.INPUT_OVERWRITE_SETTINGS,
|
||||||
|
!addToolchainOnly
|
||||||
|
);
|
||||||
const verifySignature = getBooleanInput(
|
const verifySignature = getBooleanInput(
|
||||||
constants.INPUT_VERIFY_SIGNATURE,
|
constants.INPUT_VERIFY_SIGNATURE,
|
||||||
false
|
false
|
||||||
@ -78,16 +103,18 @@ async function run() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const installerInputsOptions: installerInputsOptions = {
|
const installerInputsOptions: IInstallerInputsOptions = {
|
||||||
architecture,
|
architecture: architecture,
|
||||||
packageType,
|
packageType: packageType,
|
||||||
checkLatest,
|
checkLatest: checkLatest,
|
||||||
setDefault,
|
setDefault: setDefault,
|
||||||
verifySignature,
|
overwriteSettings: overwriteSettings,
|
||||||
verifySignaturePublicKey,
|
addToolchainOnly: addToolchainOnly,
|
||||||
distributionName,
|
verifySignature: verifySignature,
|
||||||
jdkFile,
|
verifySignaturePublicKey: verifySignaturePublicKey,
|
||||||
toolchainIds
|
distributionName: distributionName,
|
||||||
|
jdkFile: jdkFile,
|
||||||
|
toolchainIds: toolchainIds
|
||||||
};
|
};
|
||||||
|
|
||||||
await installVersion(versionInfo.version, installerInputsOptions);
|
await installVersion(versionInfo.version, installerInputsOptions);
|
||||||
@ -97,16 +124,18 @@ async function run() {
|
|||||||
throw new Error('distribution input is required');
|
throw new Error('distribution input is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
const installerInputsOptions: installerInputsOptions = {
|
const installerInputsOptions: IInstallerInputsOptions = {
|
||||||
architecture,
|
architecture: architecture,
|
||||||
packageType,
|
packageType: packageType,
|
||||||
checkLatest,
|
checkLatest: checkLatest,
|
||||||
setDefault,
|
setDefault: setDefault,
|
||||||
verifySignature,
|
overwriteSettings: overwriteSettings,
|
||||||
verifySignaturePublicKey,
|
addToolchainOnly: addToolchainOnly,
|
||||||
distributionName,
|
verifySignature: verifySignature,
|
||||||
jdkFile,
|
verifySignaturePublicKey: verifySignaturePublicKey,
|
||||||
toolchainIds
|
distributionName: distributionName,
|
||||||
|
jdkFile: jdkFile,
|
||||||
|
toolchainIds: toolchainIds
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const [index, version] of versions.entries()) {
|
for (const [index, version] of versions.entries()) {
|
||||||
@ -122,7 +151,7 @@ async function run() {
|
|||||||
);
|
);
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
|
|
||||||
await auth.configureAuthentication();
|
await auth.configureAuthentication(overwriteSettings);
|
||||||
configureMavenArgs();
|
configureMavenArgs();
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
await restore(cache, cacheDependencyPath);
|
await restore(cache, cacheDependencyPath);
|
||||||
@ -149,39 +178,27 @@ function getJdkFileInput(): string {
|
|||||||
|
|
||||||
async function installVersion(
|
async function installVersion(
|
||||||
version: string,
|
version: string,
|
||||||
options: installerInputsOptions,
|
options: IInstallerInputsOptions,
|
||||||
toolchainId = 0
|
toolchainId = 0
|
||||||
) {
|
) {
|
||||||
const {
|
|
||||||
distributionName,
|
|
||||||
jdkFile,
|
|
||||||
architecture,
|
|
||||||
packageType,
|
|
||||||
checkLatest,
|
|
||||||
setDefault,
|
|
||||||
verifySignature,
|
|
||||||
verifySignaturePublicKey,
|
|
||||||
toolchainIds
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
const installerOptions: JavaInstallerOptions = {
|
const installerOptions: JavaInstallerOptions = {
|
||||||
architecture,
|
architecture: options.architecture,
|
||||||
packageType,
|
packageType: options.packageType,
|
||||||
checkLatest,
|
checkLatest: options.checkLatest,
|
||||||
setDefault,
|
setDefault: options.setDefault,
|
||||||
verifySignature,
|
verifySignature: options.verifySignature,
|
||||||
verifySignaturePublicKey,
|
verifySignaturePublicKey: options.verifySignaturePublicKey,
|
||||||
version
|
version
|
||||||
};
|
};
|
||||||
|
|
||||||
const distribution = getJavaDistribution(
|
const distribution = getJavaDistribution(
|
||||||
distributionName,
|
options.distributionName,
|
||||||
installerOptions,
|
installerOptions,
|
||||||
jdkFile
|
options.jdkFile
|
||||||
);
|
);
|
||||||
if (!distribution) {
|
if (!distribution) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No supported distribution was found for input ${distributionName}`
|
`No supported distribution was found for input ${options.distributionName}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,27 +211,16 @@ async function installVersion(
|
|||||||
|
|
||||||
await toolchains.configureToolchains(
|
await toolchains.configureToolchains(
|
||||||
toolchainVersion,
|
toolchainVersion,
|
||||||
distributionName,
|
options.distributionName,
|
||||||
result.path,
|
result.path,
|
||||||
toolchainIds[toolchainId]
|
options.overwriteSettings || options.addToolchainOnly,
|
||||||
|
options.toolchainIds[toolchainId]
|
||||||
);
|
);
|
||||||
|
|
||||||
core.info('');
|
core.info('');
|
||||||
core.info('Java configuration:');
|
core.info('Java configuration:');
|
||||||
core.info(` Distribution: ${distributionName}`);
|
core.info(` Distribution: ${options.distributionName}`);
|
||||||
core.info(` Version: ${result.version}`);
|
core.info(` Version: ${result.version}`);
|
||||||
core.info(` Path: ${result.path}`);
|
core.info(` Path: ${result.path}`);
|
||||||
core.info('');
|
core.info('');
|
||||||
}
|
}
|
||||||
|
|
||||||
interface installerInputsOptions {
|
|
||||||
architecture: string;
|
|
||||||
packageType: string;
|
|
||||||
checkLatest: boolean;
|
|
||||||
setDefault: boolean;
|
|
||||||
verifySignature: boolean;
|
|
||||||
verifySignaturePublicKey: string | undefined;
|
|
||||||
distributionName: string;
|
|
||||||
jdkFile: string;
|
|
||||||
toolchainIds: Array<string>;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import * as core from '@actions/core';
|
|||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import * as constants from './constants.js';
|
import * as constants from './constants.js';
|
||||||
|
|
||||||
import {getBooleanInput} from './util.js';
|
|
||||||
import {create as xmlCreate} from 'xmlbuilder2';
|
import {create as xmlCreate} from 'xmlbuilder2';
|
||||||
|
|
||||||
interface JdkInfo {
|
interface JdkInfo {
|
||||||
@ -19,6 +18,7 @@ export async function configureToolchains(
|
|||||||
version: string,
|
version: string,
|
||||||
distributionName: string,
|
distributionName: string,
|
||||||
jdkHome: string,
|
jdkHome: string,
|
||||||
|
addToolchain: boolean,
|
||||||
toolchainId?: string
|
toolchainId?: string
|
||||||
) {
|
) {
|
||||||
const vendor =
|
const vendor =
|
||||||
@ -27,10 +27,6 @@ export async function configureToolchains(
|
|||||||
const settingsDirectory =
|
const settingsDirectory =
|
||||||
core.getInput(constants.INPUT_SETTINGS_PATH) ||
|
core.getInput(constants.INPUT_SETTINGS_PATH) ||
|
||||||
path.join(os.homedir(), constants.M2_DIR);
|
path.join(os.homedir(), constants.M2_DIR);
|
||||||
const overwriteSettings = getBooleanInput(
|
|
||||||
constants.INPUT_OVERWRITE_SETTINGS,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
await createToolchainsSettings({
|
await createToolchainsSettings({
|
||||||
jdkInfo: {
|
jdkInfo: {
|
||||||
@ -40,18 +36,18 @@ export async function configureToolchains(
|
|||||||
jdkHome
|
jdkHome
|
||||||
},
|
},
|
||||||
settingsDirectory,
|
settingsDirectory,
|
||||||
overwriteSettings
|
addToolchain
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createToolchainsSettings({
|
export async function createToolchainsSettings({
|
||||||
jdkInfo,
|
jdkInfo,
|
||||||
settingsDirectory,
|
settingsDirectory,
|
||||||
overwriteSettings
|
addToolchain
|
||||||
}: {
|
}: {
|
||||||
jdkInfo: JdkInfo;
|
jdkInfo: JdkInfo;
|
||||||
settingsDirectory: string;
|
settingsDirectory: string;
|
||||||
overwriteSettings: boolean;
|
addToolchain: boolean;
|
||||||
}) {
|
}) {
|
||||||
core.info(
|
core.info(
|
||||||
`Creating ${constants.MVN_TOOLCHAINS_FILE} for JDK version ${jdkInfo.version} from ${jdkInfo.vendor}`
|
`Creating ${constants.MVN_TOOLCHAINS_FILE} for JDK version ${jdkInfo.version} from ${jdkInfo.vendor}`
|
||||||
@ -71,7 +67,7 @@ export async function createToolchainsSettings({
|
|||||||
await writeToolchainsFileToDisk(
|
await writeToolchainsFileToDisk(
|
||||||
settingsDirectory,
|
settingsDirectory,
|
||||||
updatedToolchains,
|
updatedToolchains,
|
||||||
overwriteSettings
|
addToolchain
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,11 +171,11 @@ async function readExistingToolchainsFile(directory: string) {
|
|||||||
async function writeToolchainsFileToDisk(
|
async function writeToolchainsFileToDisk(
|
||||||
directory: string,
|
directory: string,
|
||||||
settings: string,
|
settings: string,
|
||||||
overwriteSettings: boolean
|
addToolchain: boolean
|
||||||
) {
|
) {
|
||||||
const location = path.join(directory, constants.MVN_TOOLCHAINS_FILE);
|
const location = path.join(directory, constants.MVN_TOOLCHAINS_FILE);
|
||||||
const settingsExists = fs.existsSync(location);
|
const settingsExists = fs.existsSync(location);
|
||||||
if (settingsExists && overwriteSettings) {
|
if (settingsExists && addToolchain) {
|
||||||
core.info(`Overwriting existing file ${location}`);
|
core.info(`Overwriting existing file ${location}`);
|
||||||
} else if (!settingsExists) {
|
} else if (!settingsExists) {
|
||||||
core.info(`Writing to ${location}`);
|
core.info(`Writing to ${location}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user