From 68713f139d14ae20b12cbcd1651374a8c8e113b3 Mon Sep 17 00:00:00 2001 From: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:09:32 +0100 Subject: [PATCH 01/10] #877: improved process error message (#895) --- .../tools/ide/process/ProcessContextImpl.java | 11 +---------- .../tools/ide/process/ProcessErrorHandling.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java b/cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java index bdd0199c4..3290b8cf0 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java +++ b/cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java @@ -332,18 +332,9 @@ private String addExecutable(String exec, List args) { private void performLogging(ProcessResult result, int exitCode, String interpreter) { if (!result.isSuccessful() && (this.errorHandling != ProcessErrorHandling.NONE)) { - IdeLogLevel ideLogLevel; + IdeLogLevel ideLogLevel = this.errorHandling.getLogLevel(); String message = createCommandMessage(interpreter, "\nfailed with exit code " + exitCode + "!"); - if (this.errorHandling == ProcessErrorHandling.LOG_ERROR) { - ideLogLevel = IdeLogLevel.ERROR; - } else if (this.errorHandling == ProcessErrorHandling.LOG_WARNING) { - ideLogLevel = IdeLogLevel.WARNING; - } else { - ideLogLevel = IdeLogLevel.ERROR; - this.context.error("Internal error: Undefined error handling {}", this.errorHandling); - } - context.level(ideLogLevel).log(message); result.log(ideLogLevel, context); diff --git a/cli/src/main/java/com/devonfw/tools/ide/process/ProcessErrorHandling.java b/cli/src/main/java/com/devonfw/tools/ide/process/ProcessErrorHandling.java index 640082b82..a46e7f6c0 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/process/ProcessErrorHandling.java +++ b/cli/src/main/java/com/devonfw/tools/ide/process/ProcessErrorHandling.java @@ -1,5 +1,7 @@ package com.devonfw.tools.ide.process; +import com.devonfw.tools.ide.log.IdeLogLevel; + /** * {@link Enum} with the available handling if a {@link Process#exitValue() status code} was not {@link ProcessResult#SUCCESS successful}. */ @@ -26,6 +28,15 @@ public enum ProcessErrorHandling { * Throw an exception if the status code was not successful. In this case the {@link ProcessContext#run() run} method will never return an exit code other * than {@link ProcessResult#SUCCESS} as otherwise an exception is thrown preventing the method to return. */ - THROW_ERR + THROW_ERR; + /** + * @return the matching {@link IdeLogLevel}. + */ + public IdeLogLevel getLogLevel() { + if (this.equals(LOG_WARNING)) { + return IdeLogLevel.WARNING; + } + return IdeLogLevel.ERROR; + } } From 47f7b2394e93ffe8e14586e104f9d32eb9806d59 Mon Sep 17 00:00:00 2001 From: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:00:26 +0100 Subject: [PATCH 02/10] #875: added docker error message (#893) --- .../tools/ide/tool/lazydocker/LazyDocker.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java b/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java index 8c958415b..b6a87ef07 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/lazydocker/LazyDocker.java @@ -5,6 +5,7 @@ import com.devonfw.tools.ide.cli.CliException; import com.devonfw.tools.ide.common.Tag; import com.devonfw.tools.ide.context.IdeContext; +import com.devonfw.tools.ide.log.IdeLogLevel; import com.devonfw.tools.ide.process.ProcessContext; import com.devonfw.tools.ide.process.ProcessErrorHandling; import com.devonfw.tools.ide.process.ProcessMode; @@ -19,8 +20,8 @@ */ public class LazyDocker extends LocalToolCommandlet { - public static final VersionIdentifier MIN_API_VERSION = VersionIdentifier.of("1.25"); - public static final VersionIdentifier MIN_COMPOSE_VERSION = VersionIdentifier.of("1.23.2"); + private static final VersionIdentifier MIN_API_VERSION = VersionIdentifier.of("1.25"); + private static final VersionIdentifier MIN_COMPOSE_VERSION = VersionIdentifier.of("1.23.2"); /** * The constructor. @@ -38,21 +39,23 @@ protected void installDependencies() { // TODO create lazydocker/lazydocker/dependencies.json file in ide-urls and delete this method getCommandlet(Docker.class).install(); // verify docker API version requirements - ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker") - .addArg("version").addArg("--format").addArg("'{{.Client.APIVersion}}'"); + ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker").addArg("version").addArg("--format") + .addArg("'{{.Client.APIVersion}}'"); ProcessResult result = pc.run(ProcessMode.DEFAULT_CAPTURE); verifyDockerVersion(result, MIN_API_VERSION, "docker API"); // verify docker compose version requirements - pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker-compose").addArg("version") - .addArg("--short"); + pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE).executable("docker-compose").addArg("version").addArg("--short"); result = pc.run(ProcessMode.DEFAULT_CAPTURE); verifyDockerVersion(result, MIN_COMPOSE_VERSION, "docker-compose"); } - private static void verifyDockerVersion(ProcessResult result, VersionIdentifier minimumVersion, String kind) { + private void verifyDockerVersion(ProcessResult result, VersionIdentifier minimumVersion, String kind) { // we have this pattern a lot that we want to get a single line output of a successful ProcessResult. // we should create a generic method in ProcessResult for this use-case. + if (!result.isSuccessful()) { + result.log(IdeLogLevel.WARNING, this.context); + } if (result.getOut().isEmpty()) { throw new CliException("Docker is not installed, but required for lazydocker.\n" // + "To install docker, call the following command:\n" // From 4c47f1f9e256e360ec9b1ad0aca440b48f431b72 Mon Sep 17 00:00:00 2001 From: JanAmeis <162981643+WorkingAmeise@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:24:42 +0100 Subject: [PATCH 03/10] #827: Made status commandlet available outside of IDE_HOME (#885) --- .../ide/commandlet/StatusCommandlet.java | 6 ++++ .../ide/commandlet/StatusCommandletTest.java | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java index ea47bac6c..b706d944a 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java @@ -80,4 +80,10 @@ private void logOnlineStatus() { this.context.warning("You are offline. Check your internet connection and potential proxy settings."); } } + + @Override + public boolean isIdeRootRequired() { + + return false; + } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java new file mode 100644 index 000000000..f9ba353a1 --- /dev/null +++ b/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java @@ -0,0 +1,29 @@ +package com.devonfw.tools.ide.commandlet; + +import org.junit.jupiter.api.Test; + +import com.devonfw.tools.ide.cli.CliArguments; +import com.devonfw.tools.ide.context.AbstractIdeContextTest; +import com.devonfw.tools.ide.context.IdeTestContext; + +/** + * Test of {@link StatusCommandlet}. + */ +public class StatusCommandletTest extends AbstractIdeContextTest { + + private static final String PROJECT_BASIC = "basic"; + + @Test + public void testStatusOutsideOfHome() { + //arrange + IdeTestContext context = new IdeTestContext(); + CliArguments args = new CliArguments("status"); + args.next(); + + //act + context.run(args); + + //assert + assertThat(context).logAtWarning().hasMessageContaining("You are not inside an IDE installation: "); + } +} From 91a9971457cce15bc4c96ce36d48a68cc53fd94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Thu, 12 Dec 2024 19:13:02 +0100 Subject: [PATCH 04/10] Update CHANGELOG.adoc: fixed strange asciidoc error with hash sign --- CHANGELOG.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index b2f12018e..39f326de2 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -25,7 +25,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/737[#737]: Adds cd command to ide shell * https://github.com/devonfw/IDEasy/issues/879[#879]: cannot omit default settings URL in ide create * https://github.com/devonfw/IDEasy/issues/758[#758]: Create status commandlet -* https://github.com/devonfw/IDEasy/issues/824[#824]: ide create «settings-url»#«branch» not working +* https://github.com/devonfw/IDEasy/issues/824[#824]: ide create «settings-url»#«branch» not working * https://github.com/devonfw/IDEasy/issues/875[#875]: lazydocker is not working * https://github.com/devonfw/IDEasy/issues/754[#754]: Again messages break processable command output * https://github.com/devonfw/IDEasy/issues/737[#739]: Improved error handling to show 'You are not inside an IDE installation' only when relevant. From 768f24b65b35b7f6acb8edb0c8e92e0eac6ea5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Thu, 12 Dec 2024 19:15:01 +0100 Subject: [PATCH 05/10] Update pom.xml: fix pointless OSSRH verification rule --- gui/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/pom.xml b/gui/pom.xml index 25808d681..2e802f13c 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -12,6 +12,7 @@ com.devonfw.tools.IDEasy ide-gui ${revision} + ${project.artifactId} com.devonfw.ide.gui.AppLauncher From aacc335109ee3ecc9a9a252bbb10b0b1264c75ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Thu, 12 Dec 2024 19:24:41 +0100 Subject: [PATCH 06/10] Update pom.xml: fix release build --- cli/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/pom.xml b/cli/pom.xml index 9ca1d101d..161b430b9 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -196,7 +196,7 @@ create-distribution - install + package single From f4b35809a8f9c04957ea587568e724e129a8cfca Mon Sep 17 00:00:00 2001 From: devonfw-core Date: Thu, 12 Dec 2024 18:35:51 +0000 Subject: [PATCH 07/10] set release version to 2024.12.001-beta --- .mvn/maven.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/maven.config b/.mvn/maven.config index 5bb4c98c8..c2a1ac906 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.12.001-beta-SNAPSHOT +-Drevision=2024.12.001-beta From 11de3ca8cc9b4956b3900ac9b3a7d1d0ab8c078b Mon Sep 17 00:00:00 2001 From: devonfw-core Date: Thu, 12 Dec 2024 18:40:12 +0000 Subject: [PATCH 08/10] set next version to 2024.12.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 c2a1ac906..ea9b5e163 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.12.001-beta +-Drevision=2024.12.002-beta-SNAPSHOT From 83acd3a35eed6d0bf8fc347c62b4cce3fb2b78e1 Mon Sep 17 00:00:00 2001 From: JanAmeis <162981643+WorkingAmeise@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:24:03 +0100 Subject: [PATCH 09/10] #856: Made gcviewer start in background (#896) --- CHANGELOG.adoc | 8 ++++++++ .../com/devonfw/tools/ide/tool/gcviewer/GcViewer.java | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 39f326de2..452eb9dcc 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -2,6 +2,14 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDEasy]. +== 2024.12.002 + +Release with new features and bugfixes: + +* https://github.com/devonfw/IDEasy/issues/885[#885]: Gcviewer starts in foreground fixed + +The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/17?closed=1[milestone 2024.12.002]. + == 2024.12.001 NOTE: ATTENTION: When installing this release as an update, you need to manually remove IDEasy entries from `.bashrc` and if present also `.zshrc`. diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java b/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java index 745166682..6c5583315 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/gcviewer/GcViewer.java @@ -5,6 +5,7 @@ import com.devonfw.tools.ide.common.Tag; import com.devonfw.tools.ide.context.IdeContext; import com.devonfw.tools.ide.process.ProcessContext; +import com.devonfw.tools.ide.process.ProcessMode; import com.devonfw.tools.ide.tool.LocalToolCommandlet; import com.devonfw.tools.ide.tool.ToolCommandlet; import com.devonfw.tools.ide.tool.java.Java; @@ -40,6 +41,6 @@ public void run() { pc.executable("java"); pc.addArg("-jar"); pc.addArg("gcviewer-" + getInstalledVersion() + ".jar"); - pc.run(); + pc.run(ProcessMode.BACKGROUND_SILENT); } } From 52afdd7c782cc1cc45f4278e6c4cafba1daaca47 Mon Sep 17 00:00:00 2001 From: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:30:58 +0100 Subject: [PATCH 10/10] #888: fixed graalvm gu (#890) --- CHANGELOG.adoc | 1 + .../tools/ide/cli/CliProcessException.java | 1 + .../tools/ide/tool/graalvm/GraalVm.java | 21 ++----------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 452eb9dcc..46d912799 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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/888[#888]: Removed gu update functionality (needs to be run manually for old versions now). * https://github.com/devonfw/IDEasy/issues/885[#885]: Gcviewer starts in foreground fixed The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/17?closed=1[milestone 2024.12.002]. diff --git a/cli/src/main/java/com/devonfw/tools/ide/cli/CliProcessException.java b/cli/src/main/java/com/devonfw/tools/ide/cli/CliProcessException.java index 782fbf919..e7791d8b6 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/cli/CliProcessException.java +++ b/cli/src/main/java/com/devonfw/tools/ide/cli/CliProcessException.java @@ -25,6 +25,7 @@ public CliProcessException(ProcessResult processResult) { /** * The constructor. * + * @param message the message to display. * @param processResult the {@link #getProcessResult() process result}. */ public CliProcessException(String message, ProcessResult processResult) { 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 6a79593c4..79161677f 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,18 +7,15 @@ 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.ProcessErrorHandling; -import com.devonfw.tools.ide.process.ProcessMode; -import com.devonfw.tools.ide.step.Step; import com.devonfw.tools.ide.tool.LocalToolCommandlet; +import com.devonfw.tools.ide.tool.ToolCommandlet; import com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet; -import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor; import com.devonfw.tools.ide.version.VersionIdentifier; /** * {@link LocalToolCommandlet} for GraalVM, an advanced JDK with ahead-of-time Native Image compilation. */ -public class GraalVm extends PluginBasedCommandlet { +public class GraalVm extends LocalToolCommandlet { /** * The constructor. @@ -57,18 +54,4 @@ public void postInstall() { super.postInstall(); } - @Override - public void installPlugin(ToolPluginDescriptor plugin, Step step) { - doGuPluginCommand(plugin, "install"); - } - - @Override - public void uninstallPlugin(ToolPluginDescriptor plugin) { - doGuPluginCommand(plugin, "remove"); - } - - private void doGuPluginCommand(ToolPluginDescriptor plugin, String command) { - this.context.newProcess().errorHandling(ProcessErrorHandling.THROW_CLI).executable(getToolPath().resolve("bin").resolve("gu")).addArgs(command, plugin.name()).run(ProcessMode.DEFAULT); - } - }