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

#915: fix custom tools #918

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/915[#915]: custom-tools not working
* https://github.com/devonfw/IDEasy/issues/916[#916]: download is missing status code error handling
* https://github.com/devonfw/IDEasy/issues/757[#757]: Support to allow settings in code repository
* https://github.com/devonfw/IDEasy/issues/826[#826]: Fix git settings check when settings folder is empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public void setCwd(Path userDir, String workspace, Path ideHome) {
this.downloadPath = this.userHome.resolve("Downloads/ide");

this.path = computeSystemPath();
this.customToolRepository = CustomToolRepositoryImpl.of(this);
}

private String getMessageIdeHomeFound() {
Expand Down Expand Up @@ -352,6 +351,9 @@ public ToolRepository getDefaultToolRepository() {
@Override
public CustomToolRepository getCustomToolRepository() {

if (this.customToolRepository == null) {
this.customToolRepository = CustomToolRepositoryImpl.of(this);
}
return this.customToolRepository;
}

Expand Down Expand Up @@ -1130,5 +1132,6 @@ public IdeStartContextImpl getStartContext() {
*/
public void reload() {
this.variables = null;
this.customToolRepository = null;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.devonfw.tools.ide.tool;

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.process.EnvironmentContext;
import com.devonfw.tools.ide.repo.CustomToolMetadata;
import com.devonfw.tools.ide.version.GenericVersionRange;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
Expand All @@ -11,6 +13,12 @@ public class CustomToolCommandlet extends LocalToolCommandlet {

private CustomToolMetadata customTool;

/**
* The constructor.
*
* @param context the {@link IdeContext}.
* @param customTool the {@link CustomToolMetadata} to handle (e.g. install or uninstall).
*/
public CustomToolCommandlet(IdeContext context, CustomToolMetadata customTool) {

super(context, customTool.getTool(), null);
Expand All @@ -29,4 +37,9 @@ public String getConfiguredEdition() {
return this.customTool.getEdition();
}

@Override
public ToolInstallation installTool(GenericVersionRange version, EnvironmentContext environmentContext, String edition) {

return installTool(version, environmentContext, edition, this.context.getCustomToolRepository());
}
}
Loading