Skip to content

Commit

Permalink
devonfw#588: reload context after cloning settings to fix ide create
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille committed Sep 20, 2024
1 parent b782cc6 commit f4fd49b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;
import java.util.Set;

import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.GitContext;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.FlagProperty;
Expand Down Expand Up @@ -45,6 +46,7 @@ public void run() {

updateSettings();
updateConf();
reloadContext();

if (this.skipTools.isTrue()) {
this.context.info("Skipping installation/update of tools as specified by the user.");
Expand All @@ -53,6 +55,11 @@ public void run() {
}
}

private void reloadContext() {

((AbstractIdeContext) this.context).reload();
}

private void updateConf() {

Path templatesFolder = this.context.getSettingsPath().resolve(IdeContext.FOLDER_TEMPLATES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public abstract class AbstractIdeContext implements IdeContext {

private Path downloadPath;

private Path toolRepository;
private Path toolRepositoryPath;

private Path userHome;

Expand Down Expand Up @@ -169,14 +169,14 @@ public AbstractIdeContext(IdeStartContextImpl startContext, Path userDir, ToolRe
setCwd(userDir, workspace, currentDir);

if (this.ideRoot == null) {
this.toolRepository = null;
this.toolRepositoryPath = null;
this.urlsPath = null;
this.tempPath = null;
this.tempDownloadPath = null;
this.softwareRepositoryPath = null;
} else {
Path ideBase = this.ideRoot.resolve(FOLDER_IDE);
this.toolRepository = ideBase.resolve("software");
this.toolRepositoryPath = ideBase.resolve("software");
this.urlsPath = ideBase.resolve("urls");
this.tempPath = ideBase.resolve("tmp");
this.tempDownloadPath = this.tempPath.resolve(FOLDER_DOWNLOADS);
Expand Down Expand Up @@ -490,7 +490,7 @@ public Path getUrlsPath() {
@Override
public Path getToolRepositoryPath() {

return this.toolRepository;
return this.toolRepositoryPath;
}

@Override
Expand Down Expand Up @@ -1051,4 +1051,11 @@ public IdeStartContextImpl getStartContext() {

return startContext;
}

/**
* Reloads this context and re-initializes the {@link #getVariables() variables}.
*/
public void reload() {
this.variables = createVariables();
}
}

0 comments on commit f4fd49b

Please sign in to comment.