Skip to content

Commit

Permalink
devonfw#751: Moved postInstall() and changed tool installation message (
Browse files Browse the repository at this point in the history
  • Loading branch information
leonrohne27 authored Nov 19, 2024
1 parent 2966a61 commit d2a3760
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
21 changes: 0 additions & 21 deletions cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit d2a3760

Please sign in to comment.