Skip to content

Commit e64bdff

Browse files
committed
Add inputs 'update-toolchains-only', 'update-env-javahome', 'add-to-env-path'
Changes in detail: ------------------ - action.yml: - add inputs: - update-toolchains-only - update-env-javahome - add-to-env-path - update description for input "overwrite-settings" - remove default value of input "overwrite-settings", since the default is now propagated from input 'update-toolchains-only' - base-models.ts: - extend interface JavaInstallerOptions: - add fields: - updateEnvJavaHome: boolean; - addToEnvPath: boolean; - constants.ts: - add constant INPUT_UPDATE_TOOLCHAINS_ONLY = 'update-toolchains-only' - auth.ts: - function configureAuthentication(): - add parameter: - overwriteSettings: boolean - remove the now obsolete const overwriteSettings - toolchains.ts: - function configureToolchains(...): - add parameter updateToolchains: boolean - remove the now obsolete const overwriteSettings - improve variable naming: - rename any occurrence of 'overwriteSettings' by 'updateToolchains' - add field updateToolchains: boolean to the parameter object - function writeToolchainsFileToDisk(...): - improve variable naming: - rename variable 'settingsExists' by 'toolchainsExists' - update wording of info logs to be more applicable - setup-java.ts: - interface installerInputsOptions: - rename to IInstallerInputsOption to meet common coding convention - add fields: - updateToolchainsOnly: boolean; - overwriteSettings: boolean; - updateEnvJavaHome: boolean; - addToEnvPath: boolean; - function run(): - add const: - const updateToolchainsOnly: - get as boolean from input 'update-toolchains-only', default: false - const overwriteSettings: - get as boolean from input 'overwrite-settings', default: !updateToolchainsOnly - const updateEnvJavaHome: - get as boolean input 'update-env-javahome', default: !updateToolchainsOnly - const addToEnvPath: - get as boolean input 'add-to-env-path', default: !updateToolchainsOnly - extend const installerInputsOptions to match with IInstallerInputsOption: - add field updateToolchainsOnly - add field overwriteSettings - add field updateEnvJavaHome - add field addToEnvPath - update call of auth.configureAuthentication() to auth.configureAuthentication(overwriteSettings) - function installVersion(...): - add const and init from parameter options: - updateToolchainsOnly, overwriteSettings, updateEnvJavaHome, addToEnvPath - init the additional fields of installerInputsOptions accordingly - call toolchains.configureToolchains(...): - with parameter updateToolchains= overwriteSettings || updateToolchainsOnly - base-installer.ts: - add constants to import from constants: - INPUT_UPDATE_JAVA_HOME - INPUT_ADD_TO_PATH - add fields: - protected updateEnvJavaHome: boolean; - protected addToEnvPath: boolean; - ctor: - init these fields from JavaInstallerOptions accoprdingly - function setJavaDefault(...): - if updateEnvJavaHome is false: - SKIP updating env.JAVA_HOME - log info: `Skip updating env.JAVA_HOME according to ${INPUT_UPDATE_JAVA_HOME}` - if addToEnvPath is false: - SKIP adding toolchain path to env.PATH - log info: `Skip adding to env.PATH according to ${INPUT_ADD_TO_PATH}`
1 parent 78078da commit e64bdff

File tree

9 files changed

+9720
-9648
lines changed

9 files changed

+9720
-9648
lines changed

action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,21 @@ inputs:
4343
description: 'Path to where the settings.xml file will be written. Default is ~/.m2.'
4444
required: false
4545
overwrite-settings:
46-
description: 'Overwrite the settings.xml file if it exists. Default is "true".'
46+
description: 'Overwrite the settings.xml file if it exists. Default is "!update-toolchains-only". If explcitly set "true", it will update settings.xml regardless of "update-toolchains-only"'
4747
required: false
48-
default: true
48+
# DO NOT set a default here! The default will be propagated from input 'update-toolchains-only'!
49+
update-toolchains-only:
50+
description: 'Update toolchains.xml only. Default is "false". No update of settings.xml, no update of JAVA_HOME, no adding to PATH by default - unless "overwrite-settings", "update-env-javahome" or "add-to-env-path" are not explicitly set "true"'
51+
required: false
52+
default: false
53+
update-env-javahome:
54+
description: 'Update the JAVA_HOME environment variable. Default is "!update-toolchains-only"'
55+
required: false
56+
# DO NOT set a default here! The default will be propagated from input 'update-toolchains-only'!
57+
add-to-env-path:
58+
description: 'Add "<JDK home>/bin" to the PATH environment variable. Default is "!update-toolchains-only"'
59+
required: false
60+
# DO NOT set a default here! The default will be propagated from input 'update-toolchains-only'!
4961
gpg-private-key:
5062
description: 'GPG private key to import. Default is empty string.'
5163
required: false

dist/cleanup/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89922,7 +89922,7 @@ else {
8992289922
"use strict";
8992389923

8992489924
Object.defineProperty(exports, "__esModule", ({ value: true }));
89925-
exports.DISTRIBUTIONS_ONLY_MAJOR_VERSION = exports.INPUT_MVN_TOOLCHAIN_VENDOR = exports.INPUT_MVN_TOOLCHAIN_ID = exports.MVN_TOOLCHAINS_FILE = exports.MVN_SETTINGS_FILE = exports.M2_DIR = exports.STATE_GPG_PRIVATE_KEY_FINGERPRINT = exports.INPUT_JOB_STATUS = exports.INPUT_CACHE = exports.INPUT_DEFAULT_GPG_PASSPHRASE = exports.INPUT_DEFAULT_GPG_PRIVATE_KEY = exports.INPUT_GPG_PASSPHRASE = exports.INPUT_GPG_PRIVATE_KEY = exports.INPUT_OVERWRITE_SETTINGS = exports.INPUT_SETTINGS_PATH = exports.INPUT_SERVER_PASSWORD = exports.INPUT_SERVER_USERNAME = exports.INPUT_SERVER_ID = exports.INPUT_CHECK_LATEST = exports.INPUT_JDK_FILE = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_ARCHITECTURE = exports.INPUT_JAVA_VERSION_FILE = exports.INPUT_JAVA_VERSION = exports.MACOS_JAVA_CONTENT_POSTFIX = void 0;
89925+
exports.DISTRIBUTIONS_ONLY_MAJOR_VERSION = exports.INPUT_MVN_TOOLCHAIN_VENDOR = exports.INPUT_MVN_TOOLCHAIN_ID = exports.MVN_TOOLCHAINS_FILE = exports.MVN_SETTINGS_FILE = exports.M2_DIR = exports.STATE_GPG_PRIVATE_KEY_FINGERPRINT = exports.INPUT_JOB_STATUS = exports.INPUT_CACHE = exports.INPUT_DEFAULT_GPG_PASSPHRASE = exports.INPUT_DEFAULT_GPG_PRIVATE_KEY = exports.INPUT_GPG_PASSPHRASE = exports.INPUT_GPG_PRIVATE_KEY = exports.INPUT_ADD_TO_PATH = exports.INPUT_UPDATE_JAVA_HOME = exports.INPUT_UPDATE_TOOLCHAINS_ONLY = exports.INPUT_OVERWRITE_SETTINGS = exports.INPUT_SETTINGS_PATH = exports.INPUT_SERVER_PASSWORD = exports.INPUT_SERVER_USERNAME = exports.INPUT_SERVER_ID = exports.INPUT_CHECK_LATEST = exports.INPUT_JDK_FILE = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_ARCHITECTURE = exports.INPUT_JAVA_VERSION_FILE = exports.INPUT_JAVA_VERSION = exports.MACOS_JAVA_CONTENT_POSTFIX = void 0;
8992689926
exports.MACOS_JAVA_CONTENT_POSTFIX = 'Contents/Home';
8992789927
exports.INPUT_JAVA_VERSION = 'java-version';
8992889928
exports.INPUT_JAVA_VERSION_FILE = 'java-version-file';
@@ -89936,6 +89936,9 @@ exports.INPUT_SERVER_USERNAME = 'server-username';
8993689936
exports.INPUT_SERVER_PASSWORD = 'server-password';
8993789937
exports.INPUT_SETTINGS_PATH = 'settings-path';
8993889938
exports.INPUT_OVERWRITE_SETTINGS = 'overwrite-settings';
89939+
exports.INPUT_UPDATE_TOOLCHAINS_ONLY = 'update-toolchains-only';
89940+
exports.INPUT_UPDATE_JAVA_HOME = 'update-env-javahome';
89941+
exports.INPUT_ADD_TO_PATH = 'add-to-env-path';
8993989942
exports.INPUT_GPG_PRIVATE_KEY = 'gpg-private-key';
8994089943
exports.INPUT_GPG_PASSPHRASE = 'gpg-passphrase';
8994189944
exports.INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined;

0 commit comments

Comments
 (0)