diff --git a/.mvn/maven.config b/.mvn/maven.config index 5bb4c98c8..ea9b5e163 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=2024.12.001-beta-SNAPSHOT +-Drevision=2024.12.002-beta-SNAPSHOT diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1f30046bc..04d00547d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -2,6 +2,15 @@ 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/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]. + == 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`. @@ -26,7 +35,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. 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 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/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/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java b/cli/src/main/java/com/devonfw/tools/ide/process/ProcessContextImpl.java index 03ca7bcb1..b3c201c10 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 @@ -339,18 +339,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; + } } 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); } } 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); - } - } 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" // 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: "); + } +} 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