mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 22:21:26 +00:00
buildDotnetModule: restore and build testProjectFile
This commit is contained in:
parent
0f3d546116
commit
e0b652c3cb
@ -90,7 +90,7 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila
|
||||
* `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
|
||||
* `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. By default, this is set to the `projectFile` 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.
|
||||
* `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`.
|
||||
* `dotnetBuildFlags` can be used to pass flags to `dotnet build`.
|
||||
|
@ -46,8 +46,9 @@
|
||||
# Tests to disable. This gets passed to `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all frameworks.
|
||||
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details for more details.
|
||||
, disabledTests ? []
|
||||
# The project file to run unit tests against. This is usually the regular project file, but sometimes it needs to be manually set.
|
||||
, testProjectFile ? projectFile
|
||||
# The project file to run unit tests against. This is usually referenced in the regular project file, but sometimes it needs to be manually set.
|
||||
# It gets restored and build, but not installed. You may need to regenerate your nuget lockfile after setting this.
|
||||
, testProjectFile ? ""
|
||||
|
||||
# The type of build to perform. This is passed to `dotnet` with the `--configuration` flag. Possible values are `Release`, `Debug`, etc.
|
||||
, buildType ? "Release"
|
||||
@ -136,7 +137,7 @@ let
|
||||
|
||||
mkdir -p "$HOME/nuget_pkgs"
|
||||
|
||||
for project in "${lib.concatStringsSep "\" \"" (lib.toList projectFile)}"; do
|
||||
for project in "${lib.concatStringsSep "\" \"" ((lib.toList projectFile) ++ lib.optionals (testProjectFile != "") (lib.toList testProjectFile))}"; do
|
||||
${dotnet-sdk}/bin/dotnet restore "$project" \
|
||||
${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \
|
||||
-p:ContinuousIntegrationBuild=true \
|
||||
@ -156,7 +157,7 @@ let
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
|
||||
for project in ''${projectFile[@]}; do
|
||||
for project in ''${projectFile[@]} ''${testProjectFile[@]}; do
|
||||
dotnet restore "$project" \
|
||||
${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \
|
||||
-p:ContinuousIntegrationBuild=true \
|
||||
@ -172,7 +173,7 @@ let
|
||||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
|
||||
for project in ''${projectFile[@]}; do
|
||||
for project in ''${projectFile[@]} ''${testProjectFile[@]}; do
|
||||
dotnet build "$project" \
|
||||
-maxcpucount:${if enableParallelBuilding then "$NIX_BUILD_CORES" else "1"} \
|
||||
-p:BuildInParallel=${if enableParallelBuilding then "true" else "false"} \
|
||||
|
Loading…
Reference in New Issue
Block a user