diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md index a4e9d6cf9a6c..36c20a9e9c50 100644 --- a/doc/languages-frameworks/dotnet.section.md +++ b/doc/languages-frameworks/dotnet.section.md @@ -117,7 +117,6 @@ For more detail about managing the `deps.nix` file, see [Generating and updating * `useDotnetFromEnv` will change the binary wrapper so that it uses the .NET from the environment. The runtime specified by `dotnet-runtime` is given as a fallback in case no .NET is installed in the user's environment. This is most useful for .NET global tools and LSP servers, which often extend the .NET CLI and their runtime should match the users' .NET runtime. * `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used. You can also set this to the result of `dotnetSdkPackages.combinePackages`, if the project uses multiple SDKs to build. * `dotnet-runtime` is useful in cases where you need to change what dotnet runtime is being used. This can be either a regular dotnet runtime, or an aspnetcore. -* `dotnet-test-sdk` is useful in cases where unit tests expect a different dotnet SDK. By default, this is set to the `dotnet-sdk` attribute. * `testProjectFile` is useful in cases where the regular project file does not contain the unit tests. It gets restored and build, but not installed. You may need to regenerate your nuget lockfile after setting this. Note that if set, only tests from this project are executed. * `disabledTests` is used to disable running specific unit tests. This gets passed as: `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all unit test frameworks. * `dotnetRestoreFlags` can be used to pass flags to `dotnet restore`. diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index 4548616c7d80..e2ddee48cc00 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -84,8 +84,6 @@ , dotnet-sdk ? dotnetCorePackages.sdk_6_0 # The dotnet runtime to use. , dotnet-runtime ? dotnetCorePackages.runtime_6_0 - # The dotnet SDK to run tests against. This can differentiate from the SDK compiled against. -, dotnet-test-sdk ? dotnet-sdk , ... } @ args: @@ -96,7 +94,7 @@ let else dotnet-sdk.meta.platforms; inherit (callPackage ./hooks { - inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType; + inherit dotnet-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType; runtimeId = if runtimeId != null then runtimeId diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix index 7012ff36a4a5..44091604f5c2 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix @@ -8,7 +8,6 @@ , makeSetupHook , makeWrapper , dotnet-sdk -, dotnet-test-sdk , disabledTests , nuget-source , dotnet-runtime @@ -22,10 +21,9 @@ let libraryPath = lib.makeLibraryPath runtimeDeps; in { - dotnetConfigureHook = callPackage ({ }: - makeSetupHook { + dotnetConfigureHook = makeSetupHook + { name = "dotnet-configure-hook"; - propagatedBuildInputs = [ dotnet-sdk nuget-source ]; substitutions = { nugetSource = nuget-source; dynamicLinker = "${stdenv.cc}/nix-support/dynamic-linker"; @@ -38,45 +36,47 @@ in ]; inherit runtimeId; }; - } ./dotnet-configure-hook.sh) { }; + } + ./dotnet-configure-hook.sh; - dotnetBuildHook = callPackage ({ }: - makeSetupHook { + dotnetBuildHook = makeSetupHook + { name = "dotnet-build-hook"; - propagatedBuildInputs = [ dotnet-sdk ]; substitutions = { inherit buildType runtimeId; }; - } ./dotnet-build-hook.sh) { }; + } + ./dotnet-build-hook.sh; - dotnetCheckHook = callPackage ({ }: - makeSetupHook { + dotnetCheckHook = makeSetupHook + { name = "dotnet-check-hook"; - propagatedBuildInputs = [ dotnet-test-sdk ]; substitutions = { inherit buildType runtimeId libraryPath; - disabledTests = lib.optionalString (disabledTests != []) - (let - escapedNames = lib.lists.map (n: lib.replaceStrings [","] ["%2C"] n) disabledTests; - filters = lib.lists.map (n: "FullyQualifiedName!=${n}") escapedNames; - in - "${lib.concatStringsSep "&" filters}"); + disabledTests = lib.optionalString (disabledTests != [ ]) + ( + let + escapedNames = lib.lists.map (n: lib.replaceStrings [ "," ] [ "%2C" ] n) disabledTests; + filters = lib.lists.map (n: "FullyQualifiedName!=${n}") escapedNames; + in + "${lib.concatStringsSep "&" filters}" + ); }; - } ./dotnet-check-hook.sh) { }; + } + ./dotnet-check-hook.sh; - dotnetInstallHook = callPackage ({ }: - makeSetupHook { + dotnetInstallHook = makeSetupHook + { name = "dotnet-install-hook"; - propagatedBuildInputs = [ dotnet-sdk ]; substitutions = { inherit buildType runtimeId; }; - } ./dotnet-install-hook.sh) { }; + } + ./dotnet-install-hook.sh; - dotnetFixupHook = callPackage ({ }: - makeSetupHook { + dotnetFixupHook = makeSetupHook + { name = "dotnet-fixup-hook"; - propagatedBuildInputs = [ dotnet-runtime ]; substitutions = { dotnetRuntime = dotnet-runtime; runtimeDeps = libraryPath; @@ -85,5 +85,6 @@ in dirname = "${coreutils}/bin/dirname"; realpath = "${coreutils}/bin/realpath"; }; - } ./dotnet-fixup-hook.sh) { }; + } + ./dotnet-fixup-hook.sh; } diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh index 0acfeced9b16..798109291f92 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh @@ -41,7 +41,7 @@ dotnetBuildHook() { runtimeIdFlags+=("--runtime @runtimeId@") fi - env dotnet build ${project-} \ + dotnet build ${project-} \ -maxcpucount:$maxCpuFlag \ -p:BuildInParallel=$parallelBuildFlag \ -p:ContinuousIntegrationBuild=true \ diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh index 507721ef9818..f19bf9f620fe 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh @@ -22,7 +22,7 @@ dotnetCheckHook() { runtimeIdFlags=("--runtime @runtimeId@") fi - env "LD_LIBRARY_PATH=@libraryPath@" \ + LD_LIBRARY_PATH="@libraryPath@" \ dotnet test "$project" \ -maxcpucount:$maxCpuFlag \ -p:ContinuousIntegrationBuild=true \ diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh index c046fc3c306b..3eb0d4e1f230 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh @@ -15,7 +15,7 @@ dotnetConfigureHook() { dotnetRestore() { local -r project="${1-}" - env dotnet restore ${project-} \ + dotnet restore ${project-} \ -p:ContinuousIntegrationBuild=true \ -p:Deterministic=true \ --runtime "@runtimeId@" \ @@ -43,7 +43,7 @@ EOF find -name paket.dependencies -exec sed -i 's+source .*+source @nugetSource@/lib+g' {} \; find -name paket.lock -exec sed -i 's+remote:.*+remote: @nugetSource@/lib+g' {} \; - env dotnet tool restore --add-source "@nugetSource@/lib" + dotnet tool restore --add-source "@nugetSource@/lib" (( "${#projectFile[@]}" == 0 )) && dotnetRestore diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh index d832eac28809..ed754d8ffcad 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh @@ -27,7 +27,7 @@ dotnetInstallHook() { runtimeIdFlags+=("--runtime @runtimeId@") fi - env dotnet publish ${project-} \ + dotnet publish ${project-} \ -p:ContinuousIntegrationBuild=true \ -p:Deterministic=true \ --output "${installPath-$out/lib/$pname}" \ @@ -40,7 +40,7 @@ dotnetInstallHook() { dotnetPack() { local -r project="${1-}" - env dotnet pack ${project-} \ + dotnet pack ${project-} \ -p:ContinuousIntegrationBuild=true \ -p:Deterministic=true \ --output "$out/share" \