Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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/788[#788]: Add support for IDE_OPTIONS variable per IDE commandlet
* https://github.com/devonfw/IDEasy/issues/2313[#2313]: Fix python installation failing with wired behaviour
* https://github.com/devonfw/IDEasy/issues/2168[#2168]: Add support for git_remote property to configure additional remotes after cloning
* https://github.com/devonfw/IDEasy/issues/1676[#1676]: Import extra sdks automatically into ide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -16,6 +17,7 @@
import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.AbstractEnvironmentVariables;
import com.devonfw.tools.ide.environment.EnvironmentVariables;
import com.devonfw.tools.ide.environment.ExtensibleEnvironmentVariables;
import com.devonfw.tools.ide.io.FileAccess;
import com.devonfw.tools.ide.log.IdeLogLevel;
Expand All @@ -42,6 +44,7 @@ public abstract class IdeToolCommandlet extends PluginBasedCommandlet {

private static final Logger LOG = LoggerFactory.getLogger(IdeToolCommandlet.class);

private static final String OPTIONS_ENV_SUFFIX = "_OPTIONS";
private final Map<String, Set<Path>> extraSdkMap;

/**
Expand Down Expand Up @@ -76,7 +79,26 @@ protected final void doRun() {
@Override
public ProcessResult runTool(List<String> args) {

return runTool(ProcessMode.BACKGROUND, null, args);
List<String> effectiveArgs = new ArrayList<>(args);
addIdeOptions(effectiveArgs);
return runTool(ProcessMode.BACKGROUND, null, effectiveArgs);
}

/**
* Appends the tokens of {@code «IDE»_OPTIONS} (e.g. {@code INTELLIJ_OPTIONS}) to the given {@code args}. This is the per-tool analogue of the global
* {@code IDE_OPTIONS} and only applies when actually starting the IDE (not for internal calls like plugin installation or repository import).
*
* @param args the command-line arguments to launch this IDE, extended in place.
*/
private void addIdeOptions(List<String> args) {

String variableName = EnvironmentVariables.getToolVariablePrefix(this.tool) + OPTIONS_ENV_SUFFIX;
String options = this.context.getVariables().get(variableName);
if ((options != null) && !options.isBlank()) {
for (String option : options.trim().split("\\s+")) {
args.add(option);
}
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void testEclipse(String os) throws IOException {
assertThat(context.getPluginsPath().resolve("eclipse")).isDirectory();
assertThat(eclipse.getToolBinPath().resolve("eclipsetest")).hasContent(
"eclipse " + os + " -data " + context.getWorkspacePath() + " -keyring " + context.getUserHome().resolve(".eclipse").resolve(".keyring")
+ " -configuration " + context.getPluginsPath().resolve("eclipse").resolve("configuration") + " gui -showlocation eclipseproject");
+ " -configuration " + context.getPluginsPath().resolve("eclipse").resolve("configuration")
+ " gui -showlocation eclipseproject -nosplash");

//if tool already installed
eclipse.install();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void testIntellijRun(String os) {
// assert
checkInstallation(this.context);
assertThat(commandlet.getToolBinPath().resolve("intellijtest")).hasContent(
"intellij " + this.context.getSystemInfo().getOs() + " " + this.context.getWorkspacePath());
"intellij " + this.context.getSystemInfo().getOs() + " nosplash " + this.context.getWorkspacePath());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.context.ProcessContextTestImpl;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
import com.devonfw.tools.ide.os.SystemInfoMock;
import com.devonfw.tools.ide.process.ProcessContext;
import com.devonfw.tools.ide.process.ProcessMode;
Expand Down Expand Up @@ -151,6 +152,23 @@ void testConfigureToolArgsDoesNotSetWslEnvVarOnNonWsl() {
assertThat(pc.getEnvVar("DONT_PROMPT_WSL_INSTALL")).isNull();
}

/**
* Tests that {@code VSCODE_OPTIONS} is honoured by appending its tokens as additional command-line arguments when starting the IDE (analogue to the
* global {@code IDE_OPTIONS} used for IDEasy itself, see issue #788).
*/
@Test
void testRunAddsVscodeOptions() {

// arrange
IdeTestContext context = newContext(PROJECT_VSCODE);
context.getVariables().getByType(EnvironmentVariablesType.CONF).set("VSCODE_OPTIONS", "--wait --new-window");
CapturingVscode commandlet = new CapturingVscode(context);
// act
commandlet.run();
// assert
assertThat(commandlet.lastArgs).contains("--wait", "--new-window");
}

@Test
void testVscodiumInstall() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
M2_REPO=~/.m2/repository
ECLIPSE_OPTIONS=-nosplash
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# here the INTELLIJ_PROPERTIES variable should be added by the test
INTELLIJ_VM_ARGS=-Xms256m -Xmx4096m -XX:ReservedCodeCacheSize=256m -Dsun.io.useCanonCaches=true -ea
INTELLIJ_OPTIONS=nosplash
1 change: 1 addition & 0 deletions documentation/variables.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ See also link:https://github.com/devonfw/IDEasy/blob/main/cli/src/main/java/com/
|`IDE_ROOT`|e.g. `~/projects/` or `C:\projects`|The installation root directory of `IDEasy` - see link:structure.adoc[structure] for details.
|`IDE_HOME`|e.g. `/projects/my-project`|The top level directory of your `IDEasy` project.
|`IDE_OPTIONS`|e.g. `-Dhttps.proxyUser=$USERNAME -Dhttps.proxyPassword=«password»`|General options that will be applied to each call of `IDEasy`. Should typically be used for JVM options like link:proxy-support.adoc[proxy-support].
|`«IDE»_OPTIONS`|e.g. `nosplash` (for `INTELLIJ_OPTIONS`)|Additional command-line arguments passed when starting the IDE `«IDE»` (e.g. `ECLIPSE_OPTIONS`, `INTELLIJ_OPTIONS`, `ANDROID_STUDIO_OPTIONS`, `PYCHARM_OPTIONS`, or `VSCODE_OPTIONS`). Analogous to the global `IDE_OPTIONS` but specific to a single IDE.
|*`PATH`*|`$IDE_HOME/software/«tool»:...:$PATH`|Your system path is adjusted by `ide` link:cli.adoc[command].
|`BASH_PATH`|e.g. `C:\Program Files\Git\usr\bin\bash.exe`|Absolute path to your bash. Only used as fallback on Windows if bash could not be found from registry.
|`IDE_TOOLS`|`(java mvn node npm)`|List of tools that should be installed by default on project creation.
Expand Down