From 2137a236ec4854978f8b0ccf755ec67a54d60127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 29 Oct 2024 17:54:47 +0100 Subject: [PATCH 1/7] #673: fixed tomcat and improved logging (#725) --- .../tools/ide/commandlet/Commandlet.java | 2 ++ .../tools/ide/repo/DefaultToolRepository.java | 2 +- .../tools/ide/tool/LocalToolCommandlet.java | 6 ++++- .../tools/ide/tool/graalvm/GraalVm.java | 1 - .../url/model/file/json/ToolDependencies.java | 26 ++++++++++++------- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/Commandlet.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/Commandlet.java index 4ef895f42..3001da170 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/Commandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/Commandlet.java @@ -231,6 +231,8 @@ public ValidationResult validate() { /** * Provide additional usage help of this {@link Commandlet} to the user. + * + * @param bundle the {@link NlsBundle} to get I18N messages from. */ public void printHelp(NlsBundle bundle) { diff --git a/cli/src/main/java/com/devonfw/tools/ide/repo/DefaultToolRepository.java b/cli/src/main/java/com/devonfw/tools/ide/repo/DefaultToolRepository.java index fc6f6de98..c26c1fdef 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/repo/DefaultToolRepository.java +++ b/cli/src/main/java/com/devonfw/tools/ide/repo/DefaultToolRepository.java @@ -56,6 +56,6 @@ protected UrlDownloadFileMetadata getMetadata(String tool, String edition, Versi public Collection findDependencies(String tool, String edition, VersionIdentifier version) { UrlDependencyFile dependencyFile = this.context.getUrls().getEdition(tool, edition).getDependencyFile(); - return dependencyFile.getDependencies().findDependencies(version); + return dependencyFile.getDependencies().findDependencies(version, this.context); } } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java index 2cd43ed3c..99f0b842d 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java @@ -234,7 +234,7 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi VersionIdentifier configuredVersion = getConfiguredVersion(); if (version.contains(configuredVersion)) { // prefer configured version if contained in version range - return install(); + return install(false, environmentContext); } else { if (isIgnoreSoftwareRepo()) { throw new IllegalStateException( @@ -251,7 +251,11 @@ public boolean installAsDependency(VersionRange version, EnvironmentContext envi private void installToolDependencies(VersionIdentifier version, String edition, EnvironmentContext environmentContext, ToolRepository toolRepository) { Collection dependencies = toolRepository.findDependencies(this.tool, edition, version); + String toolWithEdition = getToolWithEdition(this.tool, edition); + int size = dependencies.size(); + this.context.debug("Tool {} has {} other tool(s) as dependency", toolWithEdition, size); for (ToolDependency dependency : dependencies) { + this.context.trace("Ensuring dependency {} for tool {}", dependency.tool(), toolWithEdition); LocalToolCommandlet dependencyTool = this.context.getCommandletManager().getRequiredLocalToolCommandlet(dependency.tool()); dependencyTool.installAsDependency(dependency.versionRange(), environmentContext); } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/graalvm/GraalVm.java b/cli/src/main/java/com/devonfw/tools/ide/tool/graalvm/GraalVm.java index 5a77fbcae..6a79593c4 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/graalvm/GraalVm.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/graalvm/GraalVm.java @@ -7,7 +7,6 @@ import com.devonfw.tools.ide.context.IdeContext; import com.devonfw.tools.ide.environment.EnvironmentVariables; import com.devonfw.tools.ide.environment.EnvironmentVariablesType; -import com.devonfw.tools.ide.process.ProcessContext; import com.devonfw.tools.ide.process.ProcessErrorHandling; import com.devonfw.tools.ide.process.ProcessMode; import com.devonfw.tools.ide.step.Step; diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java index 31937835d..0b22ae6d1 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java +++ b/cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolDependencies.java @@ -4,11 +4,12 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; import com.devonfw.tools.ide.json.JsonMapping; +import com.devonfw.tools.ide.log.IdeLogger; import com.devonfw.tools.ide.version.VersionIdentifier; import com.devonfw.tools.ide.version.VersionRange; import com.fasterxml.jackson.core.type.TypeReference; @@ -23,27 +24,34 @@ public class ToolDependencies { private static final ObjectMapper MAPPER = JsonMapping.create(); - private static final ToolDependencies EMPTY = new ToolDependencies(Collections.emptyMap()); + private static final ToolDependencies EMPTY = new ToolDependencies(Collections.emptyMap(), Path.of("empty")); private final Map> dependencies; - private ToolDependencies(Map> dependencies) { + private final Path path; + + private ToolDependencies(Map> dependencies, Path path) { super(); this.dependencies = dependencies; + this.path = path; } /** * @param version the {@link VersionIdentifier} of the tool to install. * @return The {@link List} of {@link ToolDependency}s for the given tool version. */ - public List findDependencies(VersionIdentifier version) { + public List findDependencies(VersionIdentifier version, IdeLogger logger) { - for (Map.Entry> map : this.dependencies.entrySet()) { - VersionRange versionRange = map.getKey(); + for (Map.Entry> entry : this.dependencies.entrySet()) { + VersionRange versionRange = entry.getKey(); if (versionRange.contains(version)) { - return map.getValue(); + return entry.getValue(); } } + int size = dependencies.size(); + if (size > 0) { + logger.warning("No match for version {} while {} version ranges are configured in {} - configuration error?!", version, size, this.path); + } return Collections.emptyList(); } @@ -55,10 +63,10 @@ public static ToolDependencies of(Path file) { if (Files.exists(file)) { try (BufferedReader reader = Files.newBufferedReader(file)) { - TypeReference>> typeRef = new TypeReference<>() { + TypeReference>> typeRef = new TypeReference<>() { }; Map> dependencies = MAPPER.readValue(reader, typeRef); - return new ToolDependencies(dependencies); + return new ToolDependencies(dependencies, file); } catch (Exception e) { throw new IllegalStateException("Failed to load " + file, e); } From ee3d6f5fc93735fa3ab1f99b1cd33892c2b3ff79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 29 Oct 2024 17:55:37 +0100 Subject: [PATCH 2/7] Update CHANGELOG.adoc --- CHANGELOG.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 75bc1a018..12bd6c47b 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -11,6 +11,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/704[#704]: settings-security.xml not found * https://github.com/devonfw/IDEasy/issues/302[#302]: Add plugin support for GraalVM * https://github.com/devonfw/IDEasy/issues/710[#710]: Make IDE workspace configuration robust +* https://github.com/devonfw/IDEasy/issues/673[#673]: Tomcat still not working (JAVA_HOME not set) The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/14?closed=1[milestone 2024.10.001]. From 3ac2edf4c821bf90e0b31f83cf599b454766a47f Mon Sep 17 00:00:00 2001 From: devonfw-core Date: Tue, 29 Oct 2024 17:05:11 +0000 Subject: [PATCH 3/7] set release version to 2024.10.001-beta --- .mvn/maven.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/maven.config b/.mvn/maven.config index 6f2770ffa..b61276607 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.10.001-beta-SNAPSHOT +-Drevision=2024.10.001-beta From 4f2e37bf602a341666d12b62b09b633cbda05487 Mon Sep 17 00:00:00 2001 From: devonfw-core Date: Tue, 29 Oct 2024 17:09:03 +0000 Subject: [PATCH 4/7] set next version to 2024.10.002-beta-SNAPSHOT --- .mvn/maven.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/maven.config b/.mvn/maven.config index b61276607..d8a8fbf5f 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.10.001-beta +-Drevision=2024.10.002-beta-SNAPSHOT From a1e0ccfa94f829c39ca7db3bd324452bc77d082a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 29 Oct 2024 20:02:11 +0100 Subject: [PATCH 5/7] prepared 2024.11.001 --- .mvn/maven.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/maven.config b/.mvn/maven.config index d8a8fbf5f..9245cbb8e 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.10.002-beta-SNAPSHOT +-Drevision=2024.11.001-beta-SNAPSHOT From 6579538a69e134e886cc20170c7c026857e92a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 29 Oct 2024 20:02:58 +0100 Subject: [PATCH 6/7] Update CHANGELOG.adoc --- CHANGELOG.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 12bd6c47b..214b24775 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -2,6 +2,13 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDEasy]. +== 2024.11.001 + +Release with new features and bugfixes: + + +The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/15?closed=1[milestone 2024.11.001]. + == 2024.10.001 Release with new features and bugfixes: From 071e732e6c74aed7b12ccc1d522faf1c4a015dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 29 Oct 2024 20:16:11 +0100 Subject: [PATCH 7/7] improve setup script (avoid redundancies for bash/zsh) (#718) --- cli/src/main/package/setup | 71 +++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/cli/src/main/package/setup b/cli/src/main/package/setup index f22c797c4..d7fa8828c 100755 --- a/cli/src/main/package/setup +++ b/cli/src/main/package/setup @@ -1,46 +1,39 @@ #!/bin/bash -cd "$(dirname "${BASH_SOURCE:-$0}")" || exit 255 -echo "Setting up your IDEasy in ${PWD}" - -AUTOCOMPLETION="source ${PWD}/completion" - -if ! grep -q "${AUTOCOMPLETION}" ~/.bashrc; then - echo -e "${AUTOCOMPLETION}" >> ~/.bashrc -fi -if ! grep -q "alias ide=" ~/.bashrc; then - echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> ~/.bashrc - echo -e "ide" >> ~/.bashrc -fi - -if [ "${OSTYPE}" != "cygwin" ] && [ "${OSTYPE}" != "msys" ]; then - if ! grep -q "IDE_ROOT" ~/.bashrc - then - echo -e 'export IDE_ROOT="$(pwd)"' >> ~/.bashrc - fi - - if ! grep -q "IDE_ROOT" ~/.zshrc - then - echo -e 'export IDE_ROOT="$(pwd)"' >> ~/.zshrc +function doSetupInConfigFile() { + local cfg=$1 + if [ ! -f "${cfg}" ]; then + echo "${cfg} not found - skipping." + return fi -fi - - -if [ -f ~/.zshrc ]; then - if ! grep -q "compinit" ~/.zshrc - then - echo -e 'autoload -Uz compinit\ncompinit' >> ~/.zshrc + if [ "${cfg}" = "~/.zshrc" ]; then + if ! grep -q "compinit" "${cfg}"; then + echo -e 'autoload -Uz compinit\ncompinit' >> "${cfg}" + fi + if ! grep -q "bashcompinit" "${cfg}"; then + echo -e 'autoload bashcompinit\nbashcompinit' >> "${cfg}" + fi fi - if ! grep -q "bashcompinit" ~/.zshrc - then - echo -e 'autoload bashcompinit\nbashcompinit' >> ~/.zshrc + echo "Configuring IDEasy in ${cfg}." + if ! grep -q "${AUTOCOMPLETION}" "${cfg}"; then + echo -e "${AUTOCOMPLETION}" >> "${cfg}" fi - if ! grep -q "${AUTOCOMPLETION}" ~/.zshrc - then - echo -e "${AUTOCOMPLETION}" >> ~/.zshrc + if ! grep -q "alias ide=" "${cfg}"; then + echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> "${cfg}" + echo -e "ide" >> "${cfg}" fi - if ! grep -q "alias ide=" ~/.zshrc; then - echo -e "alias ide=\"source ${PWD}/bin/ide\"" >> ~/.zshrc - echo -e "ide" >> ~/.zshrc + if [ "${OSTYPE}" != "cygwin" ] && [ "${OSTYPE}" != "msys" ]; then + if ! grep -q "IDE_ROOT" "${cfg}" + then + echo -e 'export IDE_ROOT="${PWD}"' >> "${cfg}" + fi fi -fi +} + +cd "$(dirname "${BASH_SOURCE:-$0}")" || exit 255 +echo "Setting up your IDEasy in ${PWD}" + +AUTOCOMPLETION="source ${PWD}/completion" + +doSetupInConfigFile ~/.bashrc +doSetupInConfigFile ~/.zshrc