From d2a37608db9c70740d2e32332bdf3a8690180c0c Mon Sep 17 00:00:00 2001 From: leonrohne27 Date: Tue, 19 Nov 2024 10:50:04 +0100 Subject: [PATCH] #751: Moved postInstall() and changed tool installation message (#763) --- .../tools/ide/tool/GlobalToolCommandlet.java | 3 +-- .../tools/ide/tool/LocalToolCommandlet.java | 21 +++++++++++++++++++ .../tools/ide/tool/ToolCommandlet.java | 21 ------------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java index 8bcd676e5..bd5716a55 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java @@ -147,12 +147,11 @@ public boolean install(boolean silent, EnvironmentContext environmentContext) { fileAccess.delete(tmpDir); } if (exitCode == 0) { - this.context.success("Successfully installed {} in version {}", this.tool, resolvedVersion); + this.context.success("Installation process for {} in version {} has started", this.tool, resolvedVersion); } else { this.context.warning("{} in version {} was not successfully installed", this.tool, resolvedVersion); return false; } - postInstall(); return true; } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java index 009ef5187..08614fc7b 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java @@ -116,6 +116,27 @@ public final boolean install(boolean silent, EnvironmentContext environmentConte } + /** + * This method is called after a tool was requested to be installed or updated. + * + * @param newlyInstalled {@code true} if the tool was installed or updated (at least link to software folder was created/updated), {@code false} otherwise + * (configured version was already installed and nothing changed). + */ + protected void postInstall(boolean newlyInstalled) { + + if (newlyInstalled) { + postInstall(); + } + } + + /** + * This method is called after the tool has been newly installed or updated to a new version. + */ + protected void postInstall() { + + // nothing to do by default + } + private boolean toolAlreadyInstalled(boolean silent, VersionIdentifier installedVersion, Step step) { if (!silent) { this.context.info("Version {} of tool {} is already installed", installedVersion, getToolWithEdition()); diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java index 9485bd027..a20bc0eb9 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java @@ -233,27 +233,6 @@ public boolean install(boolean silent) { */ public abstract boolean install(boolean silent, EnvironmentContext environmentContext); - /** - * This method is called after a tool was requested to be installed or updated. - * - * @param newlyInstalled {@code true} if the tool was installed or updated (at least link to software folder was created/updated), {@code false} otherwise - * (configured version was already installed and nothing changed). - */ - protected void postInstall(boolean newlyInstalled) { - - if (newlyInstalled) { - postInstall(); - } - } - - /** - * This method is called after the tool has been newly installed or updated to a new version. - */ - protected void postInstall() { - - // nothing to do by default - } - /** * @return {@code true} to extract (unpack) the downloaded binary file, {@code false} otherwise. */