From 18698295f08a811b011200c630370c93e9a52680 Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 14:50:27 +0200 Subject: [PATCH 1/7] feat: delete final of ideRoot --- .../tools/ide/context/AbstractIdeContext.java | 8 ++++- .../devonfw/tools/ide/context/IdeContext.java | 9 +++++- .../tools/ide/tool/IdeasyCommandlet.java | 3 ++ .../ide/context/AbstractIdeTestContext.java | 22 -------------- .../tools/ide/tool/IdeasyCommandletTest.java | 29 +++++++++++++++++++ 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java b/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java index 605db39da3..5bc8e1ccda 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java +++ b/cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java @@ -110,7 +110,7 @@ public abstract class AbstractIdeContext implements IdeContext, IdeLogArgFormatt private Path ideHome; - private final Path ideRoot; + private Path ideRoot; private Path confPath; @@ -569,6 +569,12 @@ public Path getIdeRoot() { return this.ideRoot; } + @Override + public void setIdeRoot(Path ideRoot) { + + this.ideRoot = ideRoot; + } + @Override public Path getIdePath() { diff --git a/cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java b/cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java index 204a930fb8..89e7878729 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java +++ b/cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java @@ -50,7 +50,7 @@ *
  • {@link #getGitContext() git context} (for git operations like clone, fetch, pull, etc.)
  • *
  • {@link #getSystemInfo() system info} (for information about OS and CPU architecture)
  • *
  • {@link #getVariables() environment variables} (to access and modify IDEasy variables according to our configuration layout)
  • - * + * *
  • {@link #question(Object[], String, Object...) question} (for interaction to let the end-user decide)
  • *
  • {@link #getUrls() url metadata} (access ide-urls to find versions, download URLs, dependency and security metadata)
  • *
  • {@link #getDefaultToolRepository() tool repository} (for abstraction of version resolution and download of tools)
  • @@ -403,6 +403,13 @@ default void requireOnline(String purpose, boolean explicitOnlineCheck) { */ Path getIdeRoot(); + /** + * @param ideRoot the new value of {@link #getIdeRoot() IDE_ROOT}. Typically detected automatically from the environment and working directory, but may need + * to be set explicitly (e.g. during the initial installation where the {@code IDE_ROOT} environment variable is not yet available but the install target + * is already known). + */ + void setIdeRoot(Path ideRoot); + /** * @return the {@link Path} to the {@link #FOLDER_UNDERSCORE_IDE}. * @see #getIdeRoot() diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java index a762cd2c2b..7f0683425a 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java @@ -266,6 +266,9 @@ private boolean isSameSnapshotVersion(String installed, String latest) { */ public void installIdeasy(Path cwd) { Path ideRoot = determineIdeRoot(cwd); + // During a fresh (MSI) installation the IDE_ROOT environment variable is not yet available, so context.getIdeRoot() would return null for the whole run. + // The install target is already known here, so we make the context consistent for any downstream code reading context.getIdeRoot() (see #1517). + this.context.setIdeRoot(ideRoot); Path idePath = ideRoot.resolve(IdeContext.FOLDER_UNDERSCORE_IDE); Path installationPath = idePath.resolve(IdeContext.FOLDER_INSTALLATION); Path ideasySoftwarePath = idePath.resolve(IdeContext.FOLDER_SOFTWARE).resolve(MvnRepository.ID).resolve(IdeasyCommandlet.TOOL_NAME) diff --git a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java index 84022d2a05..5928b3b55c 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java +++ b/cli/src/test/java/com/devonfw/tools/ide/context/AbstractIdeTestContext.java @@ -55,10 +55,6 @@ public class AbstractIdeTestContext extends AbstractIdeContext { private TestCommandletManager testCommandletManager; - private Path ideRoot; - - private boolean ideRootSet; - private Path urlsPath; protected final WireMockRuntimeInfo wireMockRuntimeInfo; @@ -299,24 +295,6 @@ public void setUserHome(Path dummyUserHome) { super.setUserHome(dummyUserHome); } - @Override - public Path getIdeRoot() { - - if (this.ideRootSet) { - return this.ideRoot; - } - return super.getIdeRoot(); - } - - /** - * @param ideRoot the new value of {@link #getIdeRoot()}. - */ - public void setIdeRoot(Path ideRoot) { - - this.ideRoot = ideRoot; - this.ideRootSet = true; - } - @Override public Path getUrlsPath() { diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/IdeasyCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/IdeasyCommandletTest.java index 945e7fc192..487dcefab6 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/IdeasyCommandletTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/IdeasyCommandletTest.java @@ -114,6 +114,35 @@ void testInstallIdeasy(String os) { + addedRcLines); } + /** + * Test that {@link IdeasyCommandlet#installIdeasy(Path)} updates {@link IdeContext#getIdeRoot()} to the derived install target when {@code IDE_ROOT} is not + * set in the environment (as is the case during a fresh MSI installation). This ensures downstream code reading {@link IdeContext#getIdeRoot()} during the + * same install run gets a consistent value. See #1517 for reference. + * + * @param os to use + */ + @ParameterizedTest + @ValueSource(strings = { "windows", "mac", "linux" }) + void testInstallIdeasyUpdatesIdeRoot(String os) { + + // arrange + SystemInfo systemInfo = SystemInfoMock.of(os); + IdeTestContext context = newContext("install"); + context.setIdeRoot(null); + context.setSystemInfo(systemInfo); + context.getStartContext().setForceMode(true); + Path gitconfigPath = context.getUserHome().resolve(".gitconfig"); + FileAccess fileAccess = new FileAccessImpl(context); + fileAccess.writeFileContent("", gitconfigPath); + Path ideRoot = context.getUserHome().resolve("projects"); + IdeasyCommandlet ideasy = new IdeasyCommandlet(context); + assertThat(context.getIdeRoot()).as("IDE_ROOT is not set before install").isNull(); + // act + ideasy.installIdeasy(context.getUserHome().resolve("Downloads/ide-cli")); + // assert + assertThat(context.getIdeRoot()).isEqualTo(ideRoot); + } + /** * Test of {@link IdeasyCommandlet#configureWindowsTerminalGitBash()}, also when {@code IDE_ROOT} is not yet set, as is the case during MSI installation. * From 54e86ea79a3f9b4d3e05d5c022c9bce1e8a339d5 Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:03:29 +0200 Subject: [PATCH 2/7] docs: add changelog entry --- CHANGELOG.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 3450719c05..c4f45579e4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -2,6 +2,10 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDEasy]. +== 2026.07.002 + +* https://github.com/devonfw/IDEasy/issues/2102[#2102]: Make context.getIdeRoot() consistent during initial install + == 2026.07.001 Release with new features and bugfixes: From de9c5a9d92e22e5bd8b47c9ac159811036902809 Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:09:35 +0200 Subject: [PATCH 3/7] fix: delete claude.md --- CLAUDE.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 2364b02241..0000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,6 +0,0 @@ -# CLAUDE.md - -The shared agent instructions live in `AGENTS.md` (the single source of truth, also read natively -by GitHub Copilot). They are imported below so Claude Code picks them up automatically. - -@AGENTS.md From cab6001a34cdcaa465574c91ce6966b65b229f2b Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:11:13 +0200 Subject: [PATCH 4/7] fix: claude.md --- CLAUDE.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..2364b02241 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,6 @@ +# CLAUDE.md + +The shared agent instructions live in `AGENTS.md` (the single source of truth, also read natively +by GitHub Copilot). They are imported below so Claude Code picks them up automatically. + +@AGENTS.md From 399a6082bfb13b7407e80b9e37bd232f7bb624d2 Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:22:05 +0200 Subject: [PATCH 5/7] docs: changelog merge issues --- CHANGELOG.adoc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c5a07e3e21..d92296305e 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -4,14 +4,12 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE == 2026.07.002 -<<<<<<< HEAD * https://github.com/devonfw/IDEasy/issues/2102[#2102]: Make context.getIdeRoot() consistent during initial install -======= + Release with new features and bugfixes: The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/47?closed=1[milestone 2026.07.002]. ->>>>>>> 102699c67158752fec2a75cc05aa4b563f0f47af == 2026.07.001 @@ -30,7 +28,6 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1227[#1227]: Added Setup instrcutions to the Windows installer * https://github.com/devonfw/IDEasy/issues/2114[#2114]: Fix false "Cygwin is not supported" warning in Git Bash * https://github.com/devonfw/IDEasy/issues/865[#865]: az not working on Mac -* https://github.com/devonfw/IDEasy/issues/2026[#2026]: Create UvRepository and UvBasedCommandlet The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/46?closed=1[milestone 2026.07.001]. From c13f1b88cba4aa2851bf8a59e3eb4776d3786e25 Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:23:38 +0200 Subject: [PATCH 6/7] docs: revert wrong deleted entry in changelog --- CHANGELOG.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index d92296305e..8a9522e920 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -28,7 +28,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1227[#1227]: Added Setup instrcutions to the Windows installer * https://github.com/devonfw/IDEasy/issues/2114[#2114]: Fix false "Cygwin is not supported" warning in Git Bash * https://github.com/devonfw/IDEasy/issues/865[#865]: az not working on Mac - +* https://github.com/devonfw/IDEasy/issues/2026[#2026]: Create UvRepository and UvBasedCommandlet The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/46?closed=1[milestone 2026.07.001]. == 2026.06.001 From bc42935547aa6baef3169fdc59d618364465035d Mon Sep 17 00:00:00 2001 From: Hieu Do Date: Fri, 10 Jul 2026 16:24:19 +0200 Subject: [PATCH 7/7] docs: add space --- CHANGELOG.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 8a9522e920..5a01c9642a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -29,6 +29,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/2114[#2114]: Fix false "Cygwin is not supported" warning in Git Bash * https://github.com/devonfw/IDEasy/issues/865[#865]: az not working on Mac * https://github.com/devonfw/IDEasy/issues/2026[#2026]: Create UvRepository and UvBasedCommandlet + The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/46?closed=1[milestone 2026.07.001]. == 2026.06.001