Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#751: Moved postInstall() and changed tool installation message #763

Merged
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
Loading