From 2ce3397562aaa6b3551f05794d48bf75c34c1c10 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Tue, 20 Jun 2023 23:32:41 -0300 Subject: [PATCH] buildDotnetModule: add dontPublish flag --- .../dotnet/build-dotnet-module/default.nix | 1 + .../build-dotnet-module/hook/dotnet-hook.sh | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index 393aa155eec5..e7bc9e80cbfd 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -38,6 +38,7 @@ let # Unfortunately, dotnet has no method for doing this automatically. # If unset, all executables in the projects root will get installed. This may cause bloat! executables ? null, + dontPublish ? false, # Packs a project as a `nupkg`, and installs it to `$out/share`. If set to `true`, the derivation can be used as a dependency for another dotnet project by adding it to `projectReferences`. packNupkg ? false, # The packages project file, which contains instructions on how to compile it. This can be an array of multiple project files as well. diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hook/dotnet-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hook/dotnet-hook.sh index 5491d5d54e7e..4747e2aa040c 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hook/dotnet-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hook/dotnet-hook.sh @@ -420,13 +420,15 @@ dotnetInstallPhase() { done } - if (( ${#projectFiles[@]} == 0 )); then - dotnetPublish - else - local projectFile - for projectFile in "${projectFiles[@]}"; do - dotnetPublish "$projectFile" - done + if [[ -z "${dontPublish-}" ]]; then + if (( ${#projectFiles[@]} == 0 )); then + dotnetPublish + else + local projectFile + for projectFile in "${projectFiles[@]}"; do + dotnetPublish "$projectFile" + done + fi fi if [[ -n ${packNupkg-} ]]; then