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

#588: reload context after clone settings #642

Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/440[#440]: Generalize intellij OS startup command for all OS's
* https://github.com/devonfw/IDEasy/issues/612[#612]: Automatically generated issue URL is still pointing to ide instead of IDEasy
* https://github.com/devonfw/IDEasy/issues/52[#52]: Adjusting Intellij settings in ide-settings
* https://github.com/devonfw/IDEasy/issues/588[#588]: ide create installs wrong Java version

The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/13?closed=1[milestone 2024.09.002].

== 2024.09.001
Expand Down
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();
}
}
Loading