Update dist scripts
This commit is contained in:
parent
deb6c2277d
commit
31f766242e
1
dist/cleanup/index.js
vendored
1
dist/cleanup/index.js
vendored
@ -95845,6 +95845,7 @@ const INPUT_SERVER_USERNAME = 'server-username';
|
|||||||
const INPUT_SERVER_PASSWORD = 'server-password';
|
const INPUT_SERVER_PASSWORD = 'server-password';
|
||||||
const INPUT_SETTINGS_PATH = 'settings-path';
|
const INPUT_SETTINGS_PATH = 'settings-path';
|
||||||
const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
||||||
|
const INPUT_ADD_TOOLCHAIN_ONLY = 'add-toolchain-only';
|
||||||
const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
||||||
const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
||||||
const INPUT_DEFAULT_GPG_PRIVATE_KEY = (/* unused pure expression or super */ null && (undefined));
|
const INPUT_DEFAULT_GPG_PRIVATE_KEY = (/* unused pure expression or super */ null && (undefined));
|
||||||
|
|||||||
86
dist/setup/index.js
vendored
86
dist/setup/index.js
vendored
@ -73290,6 +73290,7 @@ const INPUT_SERVER_USERNAME = 'server-username';
|
|||||||
const INPUT_SERVER_PASSWORD = 'server-password';
|
const INPUT_SERVER_PASSWORD = 'server-password';
|
||||||
const INPUT_SETTINGS_PATH = 'settings-path';
|
const INPUT_SETTINGS_PATH = 'settings-path';
|
||||||
const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
const INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
|
||||||
|
const INPUT_ADD_TOOLCHAIN_ONLY = 'add-toolchain-only';
|
||||||
const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
const INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
|
||||||
const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
const INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
|
||||||
const INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined;
|
const INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined;
|
||||||
@ -127263,14 +127264,12 @@ async function verifyPackageSignature(archivePath, signatureUrl, publicKeyConten
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function configureAuthentication(overwriteSettings) {
|
||||||
async function configureAuthentication() {
|
|
||||||
const id = getInput(INPUT_SERVER_ID);
|
const id = getInput(INPUT_SERVER_ID);
|
||||||
const username = getInput(INPUT_SERVER_USERNAME);
|
const username = getInput(INPUT_SERVER_USERNAME);
|
||||||
const password = getInput(INPUT_SERVER_PASSWORD);
|
const password = getInput(INPUT_SERVER_PASSWORD);
|
||||||
const settingsDirectory = getInput(INPUT_SETTINGS_PATH) ||
|
const settingsDirectory = getInput(INPUT_SETTINGS_PATH) ||
|
||||||
external_path_.join(external_os_.homedir(), M2_DIR);
|
external_path_.join(external_os_.homedir(), M2_DIR);
|
||||||
const overwriteSettings = util_getBooleanInput(INPUT_OVERWRITE_SETTINGS, true);
|
|
||||||
const gpgPrivateKey = getInput(INPUT_GPG_PRIVATE_KEY) ||
|
const gpgPrivateKey = getInput(INPUT_GPG_PRIVATE_KEY) ||
|
||||||
INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
INPUT_DEFAULT_GPG_PRIVATE_KEY;
|
||||||
const gpgPassphrase = getInput(INPUT_GPG_PASSPHRASE) ||
|
const gpgPassphrase = getInput(INPUT_GPG_PASSPHRASE) ||
|
||||||
@ -127351,13 +127350,11 @@ async function write(directory, settings, overwriteSettings) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function configureToolchains(version, distributionName, jdkHome, addToolchain, toolchainId) {
|
||||||
async function configureToolchains(version, distributionName, jdkHome, toolchainId) {
|
|
||||||
const vendor = getInput(INPUT_MVN_TOOLCHAIN_VENDOR) || distributionName;
|
const vendor = getInput(INPUT_MVN_TOOLCHAIN_VENDOR) || distributionName;
|
||||||
const id = toolchainId || `${vendor}_${version}`;
|
const id = toolchainId || `${vendor}_${version}`;
|
||||||
const settingsDirectory = getInput(INPUT_SETTINGS_PATH) ||
|
const settingsDirectory = getInput(INPUT_SETTINGS_PATH) ||
|
||||||
external_path_.join(external_os_.homedir(), M2_DIR);
|
external_path_.join(external_os_.homedir(), M2_DIR);
|
||||||
const overwriteSettings = util_getBooleanInput(INPUT_OVERWRITE_SETTINGS, true);
|
|
||||||
await createToolchainsSettings({
|
await createToolchainsSettings({
|
||||||
jdkInfo: {
|
jdkInfo: {
|
||||||
version,
|
version,
|
||||||
@ -127366,17 +127363,17 @@ async function configureToolchains(version, distributionName, jdkHome, toolchain
|
|||||||
jdkHome
|
jdkHome
|
||||||
},
|
},
|
||||||
settingsDirectory,
|
settingsDirectory,
|
||||||
overwriteSettings
|
addToolchain
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function createToolchainsSettings({ jdkInfo, settingsDirectory, overwriteSettings }) {
|
async function createToolchainsSettings({ jdkInfo, settingsDirectory, addToolchain }) {
|
||||||
info(`Creating ${MVN_TOOLCHAINS_FILE} for JDK version ${jdkInfo.version} from ${jdkInfo.vendor}`);
|
info(`Creating ${MVN_TOOLCHAINS_FILE} for JDK version ${jdkInfo.version} from ${jdkInfo.vendor}`);
|
||||||
// when an alternate m2 location is specified use only that location (no .m2 directory)
|
// when an alternate m2 location is specified use only that location (no .m2 directory)
|
||||||
// otherwise use the home/.m2/ path
|
// otherwise use the home/.m2/ path
|
||||||
await mkdirP(settingsDirectory);
|
await mkdirP(settingsDirectory);
|
||||||
const originalToolchains = await readExistingToolchainsFile(settingsDirectory);
|
const originalToolchains = await readExistingToolchainsFile(settingsDirectory);
|
||||||
const updatedToolchains = generateToolchainDefinition(originalToolchains, jdkInfo.version, jdkInfo.vendor, jdkInfo.id, jdkInfo.jdkHome);
|
const updatedToolchains = generateToolchainDefinition(originalToolchains, jdkInfo.version, jdkInfo.vendor, jdkInfo.id, jdkInfo.jdkHome);
|
||||||
await writeToolchainsFileToDisk(settingsDirectory, updatedToolchains, overwriteSettings);
|
await writeToolchainsFileToDisk(settingsDirectory, updatedToolchains, addToolchain);
|
||||||
}
|
}
|
||||||
// only exported for testing purposes
|
// only exported for testing purposes
|
||||||
function generateToolchainDefinition(original, version, vendor, id, jdkHome) {
|
function generateToolchainDefinition(original, version, vendor, id, jdkHome) {
|
||||||
@ -127458,10 +127455,10 @@ async function readExistingToolchainsFile(directory) {
|
|||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
async function writeToolchainsFileToDisk(directory, settings, overwriteSettings) {
|
async function writeToolchainsFileToDisk(directory, settings, addToolchain) {
|
||||||
const location = external_path_.join(directory, MVN_TOOLCHAINS_FILE);
|
const location = external_path_.join(directory, MVN_TOOLCHAINS_FILE);
|
||||||
const settingsExists = external_fs_namespaceObject.existsSync(location);
|
const settingsExists = external_fs_namespaceObject.existsSync(location);
|
||||||
if (settingsExists && overwriteSettings) {
|
if (settingsExists && addToolchain) {
|
||||||
info(`Overwriting existing file ${location}`);
|
info(`Overwriting existing file ${location}`);
|
||||||
}
|
}
|
||||||
else if (!settingsExists) {
|
else if (!settingsExists) {
|
||||||
@ -133669,7 +133666,9 @@ async function run() {
|
|||||||
const cache = getInput(INPUT_CACHE);
|
const cache = getInput(INPUT_CACHE);
|
||||||
const cacheDependencyPath = getInput(INPUT_CACHE_DEPENDENCY_PATH);
|
const cacheDependencyPath = getInput(INPUT_CACHE_DEPENDENCY_PATH);
|
||||||
const checkLatest = util_getBooleanInput(INPUT_CHECK_LATEST, false);
|
const checkLatest = util_getBooleanInput(INPUT_CHECK_LATEST, false);
|
||||||
const setDefault = util_getBooleanInput(INPUT_SET_DEFAULT, true);
|
const addToolchainOnly = util_getBooleanInput(INPUT_ADD_TOOLCHAIN_ONLY, false);
|
||||||
|
const setDefault = util_getBooleanInput(INPUT_SET_DEFAULT, !addToolchainOnly);
|
||||||
|
const overwriteSettings = util_getBooleanInput(INPUT_OVERWRITE_SETTINGS, !addToolchainOnly);
|
||||||
const verifySignature = util_getBooleanInput(INPUT_VERIFY_SIGNATURE, false);
|
const verifySignature = util_getBooleanInput(INPUT_VERIFY_SIGNATURE, false);
|
||||||
const verifySignaturePublicKey = getInput(INPUT_VERIFY_SIGNATURE_PUBLIC_KEY) || undefined;
|
const verifySignaturePublicKey = getInput(INPUT_VERIFY_SIGNATURE_PUBLIC_KEY) || undefined;
|
||||||
let toolchainIds = getMultilineInput(INPUT_MVN_TOOLCHAIN_ID);
|
let toolchainIds = getMultilineInput(INPUT_MVN_TOOLCHAIN_ID);
|
||||||
@ -133697,15 +133696,17 @@ async function run() {
|
|||||||
throw new Error('distribution input is required when not specified in the version file');
|
throw new Error('distribution input is required when not specified in the version file');
|
||||||
}
|
}
|
||||||
const installerInputsOptions = {
|
const installerInputsOptions = {
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -133715,15 +133716,17 @@ async function run() {
|
|||||||
throw new Error('distribution input is required');
|
throw new Error('distribution input is required');
|
||||||
}
|
}
|
||||||
const installerInputsOptions = {
|
const installerInputsOptions = {
|
||||||
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()) {
|
||||||
await installVersion(version, installerInputsOptions, index);
|
await installVersion(version, installerInputsOptions, index);
|
||||||
@ -133732,7 +133735,7 @@ async function run() {
|
|||||||
endGroup();
|
endGroup();
|
||||||
const matchersPath = external_path_.join(external_path_.dirname((0,external_url_.fileURLToPath)(import.meta.url)), '..', '..', '.github');
|
const matchersPath = external_path_.join(external_path_.dirname((0,external_url_.fileURLToPath)(import.meta.url)), '..', '..', '.github');
|
||||||
info(`##[add-matcher]${external_path_.join(matchersPath, 'java.json')}`);
|
info(`##[add-matcher]${external_path_.join(matchersPath, 'java.json')}`);
|
||||||
await configureAuthentication();
|
await configureAuthentication(overwriteSettings);
|
||||||
configureMavenArgs();
|
configureMavenArgs();
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
await restore(cache, cacheDependencyPath);
|
await restore(cache, cacheDependencyPath);
|
||||||
@ -133752,29 +133755,28 @@ function getJdkFileInput() {
|
|||||||
return jdkFile || deprecatedJdkFile;
|
return jdkFile || deprecatedJdkFile;
|
||||||
}
|
}
|
||||||
async function installVersion(version, options, toolchainId = 0) {
|
async function installVersion(version, options, toolchainId = 0) {
|
||||||
const { distributionName, jdkFile, architecture, packageType, checkLatest, setDefault, verifySignature, verifySignaturePublicKey, toolchainIds } = options;
|
|
||||||
const installerOptions = {
|
const installerOptions = {
|
||||||
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(distributionName, installerOptions, jdkFile);
|
const distribution = getJavaDistribution(options.distributionName, installerOptions, options.jdkFile);
|
||||||
if (!distribution) {
|
if (!distribution) {
|
||||||
throw new Error(`No supported distribution was found for input ${distributionName}`);
|
throw new Error(`No supported distribution was found for input ${options.distributionName}`);
|
||||||
}
|
}
|
||||||
const result = await distribution.setupJava();
|
const result = await distribution.setupJava();
|
||||||
// When the `latest` alias is used, the literal input isn't a real version, so
|
// When the `latest` alias is used, the literal input isn't a real version, so
|
||||||
// pass the resolved version to the toolchains configuration instead.
|
// pass the resolved version to the toolchains configuration instead.
|
||||||
const isLatest = version.trim().toLowerCase() === 'latest';
|
const isLatest = version.trim().toLowerCase() === 'latest';
|
||||||
const toolchainVersion = isLatest ? result.version : version;
|
const toolchainVersion = isLatest ? result.version : version;
|
||||||
await configureToolchains(toolchainVersion, distributionName, result.path, toolchainIds[toolchainId]);
|
await configureToolchains(toolchainVersion, options.distributionName, result.path, options.overwriteSettings || options.addToolchainOnly, options.toolchainIds[toolchainId]);
|
||||||
info('');
|
info('');
|
||||||
info('Java configuration:');
|
info('Java configuration:');
|
||||||
info(` Distribution: ${distributionName}`);
|
info(` Distribution: ${options.distributionName}`);
|
||||||
info(` Version: ${result.version}`);
|
info(` Version: ${result.version}`);
|
||||||
info(` Path: ${result.path}`);
|
info(` Path: ${result.path}`);
|
||||||
info('');
|
info('');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user