Skip to content
Open
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 @@ -52,6 +52,7 @@ The full list of changes for this release can be found in https://github.com/dev

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/694[#694]: Improved dotnet installation
* https://github.com/devonfw/IDEasy/issues/2102[#2102]: IDE_ROOT environment variable is not available to ideasy.exe during MSI installation
* https://github.com/devonfw/IDEasy/issues/1594[#1594]: Add release commandlet
* https://github.com/devonfw/IDEasy/issues/1982[#1982]: Modified fallback link creation on Windows
Expand Down
12 changes: 12 additions & 0 deletions cli/src/main/java/com/devonfw/tools/ide/tool/dotnet/DotNet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import com.devonfw.tools.ide.common.Tag;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.process.EnvironmentContext;
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
import com.devonfw.tools.ide.tool.ToolInstallation;

/**
* {@link LocalToolCommandlet} for <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/">dotnet</a>. The .NET CLI (Command Line Interface)
Expand All @@ -27,4 +29,14 @@ public String getToolHelpArguments() {

return "help";
}

@Override
public void setEnvironment(
EnvironmentContext environmentContext,
ToolInstallation toolInstallation,
boolean additionalInstallation) {

super.setEnvironment(environmentContext, toolInstallation, additionalInstallation);
environmentContext.withEnvVar("DOTNET_ROOT", toolInstallation.linkDir().toString());
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package com.devonfw.tools.ide.tool.dotnet;

import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
import com.devonfw.tools.ide.environment.VariableLine;
import com.devonfw.tools.ide.environment.VariableSource;
import com.devonfw.tools.ide.os.SystemInfo;
import com.devonfw.tools.ide.os.SystemInfoMock;
import com.devonfw.tools.ide.os.WindowsPathSyntax;
import com.devonfw.tools.ide.process.EnvironmentVariableCollectorContext;
import com.devonfw.tools.ide.tool.ToolInstallation;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
* Test of {@link DotNet}.
Expand Down Expand Up @@ -85,4 +95,31 @@ private static void assignDummyUserHome(IdeTestContext context, String pathStrin
Path dummyUserHomePath = PROJECTS_TARGET_PATH.resolve(PROJECT_DOTNET).resolve(pathString);
context.setUserHome(dummyUserHomePath);
}

@Test
void testSetEnvironment() {

// arrange
Path dotnetPath = this.context.getSoftwarePath().resolve("dotnet");
ToolInstallation installation = new ToolInstallation(
dotnetPath,
dotnetPath,
dotnetPath,
VersionIdentifier.of("6.0.419"),
true);

Map<String, VariableLine> variables = new HashMap<>();
EnvironmentVariableCollectorContext environmentContext =
new EnvironmentVariableCollectorContext(
variables,
new VariableSource(EnvironmentVariablesType.WORKSPACE, null),
WindowsPathSyntax.MSYS);

this.commandlet.setEnvironment(environmentContext, installation, false);

assertThat(variables.get("DOTNET_HOME").getValue())
.isEqualTo(dotnetPath.toString());
assertThat(variables.get("DOTNET_ROOT").getValue())
.isEqualTo(dotnetPath.toString());
}
}