Skip to content

Commit 5a5c2ab

Browse files
devonfw#464: added export of IDEA_PROPERTIES (devonfw#478)
1 parent d560541 commit 5a5c2ab

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import com.devonfw.tools.ide.cli.CliArgument;
99
import com.devonfw.tools.ide.common.Tag;
1010
import com.devonfw.tools.ide.context.IdeContext;
11+
import com.devonfw.tools.ide.environment.EnvironmentVariables;
12+
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
1113
import com.devonfw.tools.ide.io.FileAccess;
1214
import com.devonfw.tools.ide.process.ProcessMode;
1315
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
@@ -68,6 +70,9 @@ public boolean install(boolean silent) {
6870
protected void postInstall() {
6971

7072
super.postInstall();
73+
EnvironmentVariables envVars = this.context.getVariables().getByType(EnvironmentVariablesType.CONF);
74+
envVars.set("IDEA_PROPERTIES", this.context.getWorkspacePath().resolve("idea.properties").toString(), true);
75+
envVars.save();
7176
if (this.context.getSystemInfo().isMac()) {
7277
setMacOsFilePermissions(getToolPath().resolve("IntelliJ IDEA" + generateMacEditionString() + ".app").resolve("Contents").resolve("MacOS").resolve(IDEA));
7378
}

cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,10 @@ public interface IdeVariables {
8080
VariableDefinitionBoolean IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED = new VariableDefinitionBoolean("IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED", null,
8181
c -> Boolean.TRUE);
8282

83-
/**
84-
* {@link VariableDefinition} for IDEA_PROPERTIES (used to overwrite idea.properties location).
85-
*/
86-
VariableDefinitionPath IDEA_PROPERTIES = new VariableDefinitionPath("IDEA_PROPERTIES", null, c -> c.getWorkspacePath().resolve("idea.properties"), true);
87-
8883
/** A {@link Collection} with all pre-defined {@link VariableDefinition}s. */
8984
Collection<VariableDefinition<?>> VARIABLES = List.of(PATH, HOME, WORKSPACE_PATH, IDE_HOME, IDE_ROOT, WORKSPACE, IDE_TOOLS, CREATE_START_SCRIPTS,
9085
IDE_MIN_VERSION, MVN_VERSION, M2_REPO, DOCKER_EDITION, MVN_BUILD_OPTS, NPM_BUILD_OPTS, GRADLE_BUILD_OPTS, YARN_BUILD_OPTS, JASYPT_OPTS, MAVEN_ARGS,
91-
PROJECT_NAME, IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED, IDEA_PROPERTIES);
86+
PROJECT_NAME, IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED);
9287

9388
/**
9489
* @param name the name of the requested {@link VariableDefinition}.

cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void testIntellijRun(String os) {
7878
private void checkInstallation(IdeTestContext context) {
7979

8080
assertThat(context.getSoftwarePath().resolve("intellij/.ide.software.version")).exists().hasContent("2023.3.3");
81+
assertThat(context.getVariables().get("IDEA_PROPERTIES")).isEqualTo(context.getWorkspacePath().resolve("idea.properties").toString());
8182
assertLogMessage(context, IdeLogLevel.SUCCESS, "Successfully installed java in version 17.0.10_7");
8283
assertLogMessage(context, IdeLogLevel.SUCCESS, "Successfully installed intellij in version 2023.3.3");
8384
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# here the INTELLIJ_PROPERTIES variable should be added by the test

0 commit comments

Comments
 (0)