From f0af1ef49c2810b9fb634bec8933ca82e4fdab4c Mon Sep 17 00:00:00 2001 From: = Date: Mon, 25 Apr 2022 18:58:19 +0200 Subject: [PATCH] buildDotnetModule: properly inherit arguments from drv Previously buildDotnetModule did not properly inherit some arguments from derivations, take for example this expression: dotnetFlags = [ "--runtime linux-x64" ]; It would error out as follows: "MSBUILD : error MSB1001: Unknown switch.". Setting the same flag from bash would work fine. This fixes that, all arguments should now be properly interpreted :) --- .../build-dotnet-module/hooks/dotnet-build-hook.sh | 3 ++- .../build-dotnet-module/hooks/dotnet-check-hook.sh | 3 ++- .../build-dotnet-module/hooks/dotnet-configure-hook.sh | 6 +++++- .../build-dotnet-module/hooks/dotnet-fixup-hook.sh | 9 +++++---- .../build-dotnet-module/hooks/dotnet-install-hook.sh | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) 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 a1dc80a77fd7..0e2650da51ca 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 @@ -1,4 +1,5 @@ -declare -a projectFile testProjectFile dotnetBuildFlags dotnetFlags +# inherit arguments from derivation +dotnetBuildFlags=( ${dotnetBuildFlags[@]-} ) dotnetBuildHook() { echo "Executing dotnetBuildHook" 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 e3098908fe27..6b3deaa52f96 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 @@ -1,4 +1,5 @@ -declare -a testProjectFile dotnetTestFlags dotnetFlags +# inherit arguments from derivation +dotnetTestFlags=( ${dotnetTestFlags[@]-} ) dotnetCheckHook() { echo "Executing dotnetCheckHook" 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 59daacbac0ed..f8ba8b8df2e9 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 @@ -1,4 +1,8 @@ -declare -a projectFile testProjectFile dotnetRestoreFlags dotnetFlags +declare -a projectFile testProjectFile + +# inherit arguments from derivation +dotnetFlags=( ${dotnetFlags[@]-} ) +dotnetRestoreFlags=( ${dotnetRestoreFlags[@]-} ) dotnetConfigureHook() { echo "Executing dotnetConfigureHook" diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh index f8bbb7b1805b..675006508f6c 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh @@ -1,4 +1,5 @@ -declare -a makeWrapperArgs gappsWrapperArgs +# Inherit arguments from the derivation +makeWrapperArgs=( ${makeWrapperArgs-} ) # First argument is the executable you want to wrap, # the second is the destination for the wrapper. @@ -15,9 +16,9 @@ wrapDotnetProgram() { dotnetFixupHook() { echo "Executing dotnetFixupPhase" - if [ "${executables-}" ]; then + if [ "${executables}" ]; then for executable in ${executables[@]}; do - execPath="$out/lib/${pname-}/$executable" + execPath="$out/lib/${pname}/$executable" if [[ -f "$execPath" && -x "$execPath" ]]; then wrapDotnetProgram "$execPath" "$out/bin/$(basename "$executable")" @@ -27,7 +28,7 @@ dotnetFixupHook() { fi done else - for executable in $out/lib/${pname-}/*; do + for executable in $out/lib/${pname}/*; do if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then wrapDotnetProgram "$executable" "$out/bin/$(basename "$executable")" fi 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 ed2c9160cd2c..ac9bc873ee95 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 @@ -1,4 +1,5 @@ -declare -a projectFile dotnetInstallFlags dotnetFlags +# inherit arguments from derivation +dotnetInstallFlags=( ${dotnetInstallFlags[@]-} ) dotnetInstallHook() { echo "Executing dotnetInstallHook"