diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 985d5a5d1..f8111bb16 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -33,6 +33,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/655[#655]: CVE-2024-26308 and library updates * https://github.com/devonfw/IDEasy/issues/627[#627]: Still log messages break processable command output * https://github.com/devonfw/IDEasy/issues/663[#663]: Endless loop when installing Eclipse in force mode +* https://github.com/devonfw/IDEasy/issues/657[#657]: Cannot install Java 8 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]. diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java index 4ea01b581..79d4fad41 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java @@ -4,7 +4,6 @@ import com.devonfw.tools.ide.property.ToolProperty; import com.devonfw.tools.ide.property.VersionProperty; import com.devonfw.tools.ide.tool.ToolCommandlet; -import com.devonfw.tools.ide.validation.ValidationState; import com.devonfw.tools.ide.version.VersionIdentifier; /** @@ -30,12 +29,7 @@ public InstallCommandlet(IdeContext context) { super(context); addKeyword(getName()); this.tool = add(new ToolProperty("", true, "tool")); - this.version = add(new VersionProperty("", false, "version", - (v, state) -> { - if (!v.isValid()) { - state.addErrorMessage("Given version " + v + " is not a valid version"); - } - })); + this.version = add(new VersionProperty("", false, "version")); } @Override diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java index 0bab61c8d..9485bd027 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java @@ -494,7 +494,7 @@ protected void createStartScript(Path targetDir, String binary, boolean backgrou } Path bashFile = binFolder.resolve(getName()); String bashFileContentStart = "#!/usr/bin/env bash\n\"$(dirname \"$0\")/"; - String bashFileContentEnd = "\" $*"; + String bashFileContentEnd = "\" $@"; if (background) { bashFileContentEnd += " &"; } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioTest.java index a56f3eacc..819cff470 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioTest.java @@ -72,7 +72,8 @@ public void testAndroidStudioRun(String os, WireMockRuntimeInfo wmRuntimeInfo) t commandlet.run(); // assert - assertThat(this.context).logAtInfo().hasMessage(ANDROID_STUDIO + " " + this.context.getSystemInfo().getOs() + " " + this.context.getWorkspacePath()); + assertThat(commandlet.getToolBinPath().resolve("android-studio-test")).hasContent( + ANDROID_STUDIO + " " + this.context.getSystemInfo().getOs() + " " + this.context.getWorkspacePath()); checkInstallation(this.context); } diff --git a/cli/src/test/java/com/devonfw/tools/ide/version/VersionIdentifierTest.java b/cli/src/test/java/com/devonfw/tools/ide/version/VersionIdentifierTest.java index 1eff57e07..6ffedfada 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/version/VersionIdentifierTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/version/VersionIdentifierTest.java @@ -6,6 +6,8 @@ import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; /** * Test of {@link VersionIdentifier}. @@ -56,31 +58,35 @@ public void testOf() { /** * Test of {@link VersionIdentifier#isValid() valid} versions. */ - @Test - public void testValid() { + @ParameterizedTest + // arrange + @ValueSource(strings = { "1.0", "0.1", "2023.08.001", "2023-06-M1", "11.0.4_11.4", "5.2.23.RELEASE" }) + public void testValid(String version) { - String[] validVersions = { "1.0", "0.1", "2023.08.001", "2023-06-M1", "11.0.4_11.4", "5.2.23.RELEASE" }; - for (String version : validVersions) { - VersionIdentifier vid = VersionIdentifier.of(version); - assertThat(vid.isValid()).as(version).isTrue(); - assertThat(vid.isPattern()).isFalse(); - assertThat(vid).hasToString(version); - } + // act + VersionIdentifier vid = VersionIdentifier.of(version); + + // assert + assertThat(vid.isValid()).as(version).isTrue(); + assertThat(vid.isPattern()).isFalse(); + assertThat(vid).hasToString(version); } /** * Test of in{@link VersionIdentifier#isValid() valid} versions. */ - @Test - public void testInvalid() { + @ParameterizedTest + // arrange + @ValueSource(strings = { "0", "0.0", "1.0.pineapple-pen", "1.0-rc", ".1.0", "1.-0", "RC1", "Beta1", "donut", "8u412b08" }) + public void testInvalid(String version) { - String[] invalidVersions = { "0", "0.0", "1.0.pineapple-pen", "1.0-rc", ".1.0", "1.-0", "RC1", "Beta1", "donut" }; - for (String version : invalidVersions) { - VersionIdentifier vid = VersionIdentifier.of(version); - assertThat(vid.isValid()).as(version).isFalse(); - assertThat(vid.isPattern()).isFalse(); - assertThat(vid).hasToString(version); - } + // act + VersionIdentifier vid = VersionIdentifier.of(version); + + // assert + assertThat(vid.isValid()).as(version).isFalse(); + assertThat(vid.isPattern()).isFalse(); + assertThat(vid).hasToString(version); } /** diff --git a/cli/src/test/resources/ide-projects/android-studio/_ide/urls/android-studio/android-studio/2024.1.1.1/urls b/cli/src/test/resources/ide-projects/android-studio/_ide/urls/android-studio/android-studio/2024.1.1.1/urls new file mode 100644 index 000000000..95ea0931a --- /dev/null +++ b/cli/src/test/resources/ide-projects/android-studio/_ide/urls/android-studio/android-studio/2024.1.1.1/urls @@ -0,0 +1 @@ +https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2024.1.1.1/android-studio-2024.1.1.1.zip diff --git a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/linux/bin/studio.sh b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/linux/bin/studio.sh index b07f8b63b..48a91732b 100755 --- a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/linux/bin/studio.sh +++ b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/linux/bin/studio.sh @@ -1,2 +1,3 @@ #!/bin/bash -echo "android-studio linux $*" \ No newline at end of file +cd "$(dirname "$0")" +echo "android-studio linux $*" > android-studio-test diff --git a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/mac/Android Studio Preview.app/Contents/MacOS/studio b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/mac/Android Studio Preview.app/Contents/MacOS/studio index 6c0c7a6e1..d9f517e7b 100755 --- a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/mac/Android Studio Preview.app/Contents/MacOS/studio +++ b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/mac/Android Studio Preview.app/Contents/MacOS/studio @@ -1,2 +1,3 @@ #!/bin/bash -echo "android-studio mac $*" \ No newline at end of file +cd "$(dirname "$0")" +echo "android-studio mac $*" > android-studio-test diff --git a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/windows/bin/studio64.exe b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/windows/bin/studio64.exe index d813ccb12..fa248ca7b 100755 --- a/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/windows/bin/studio64.exe +++ b/cli/src/test/resources/ide-projects/android-studio/repository/android-studio/android-studio/default/windows/bin/studio64.exe @@ -1,2 +1,3 @@ #!/bin/bash -echo "android-studio windows $*" \ No newline at end of file +cd "$(dirname "$0")" +echo "android-studio windows $*" > android-studio-test diff --git a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh index 7eb6dea7b..145bf5eb5 100755 --- a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh +++ b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/linux/bin/idea.sh @@ -1,3 +1,3 @@ #!/bin/bash -cd "$(dirname $0)" +cd "$(dirname "$0")" echo "intellij linux $*" > intellijtest diff --git a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/windows/bin/idea64.exe b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/windows/bin/idea64.exe index b0cd87209..745143d33 100755 --- a/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/windows/bin/idea64.exe +++ b/cli/src/test/resources/ide-projects/intellij/repository/intellij/intellij/default/windows/bin/idea64.exe @@ -1,3 +1,3 @@ #!/bin/bash -cd "$(dirname $0)" +cd "$(dirname "$0")" echo "intellij windows $*" > intellijtest