summary refs log tree commit diff
path: root/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh')
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh42
1 files changed, 42 insertions, 0 deletions
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
new file mode 100644
index 00000000000..ed2c9160cd2
--- /dev/null
+++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
@@ -0,0 +1,42 @@
+declare -a projectFile dotnetInstallFlags dotnetFlags
+
+dotnetInstallHook() {
+    echo "Executing dotnetInstallHook"
+
+    runHook preInstall
+
+    for project in ${projectFile[@]}; do
+        env \
+            dotnet publish "$project" \
+                -p:ContinuousIntegrationBuild=true \
+                -p:Deterministic=true \
+                --output "$out/lib/${pname}" \
+                --configuration "@buildType@" \
+                --no-build \
+                --no-self-contained \
+                "${dotnetInstallFlags[@]}"  \
+                "${dotnetFlags[@]}"
+    done
+
+    if [[ "${packNupkg-}" ]]; then
+        for project in ${projectFile[@]}; do
+            env \
+                dotnet pack "$project" \
+                    -p:ContinuousIntegrationBuild=true \
+                    -p:Deterministic=true \
+                    --output "$out/share" \
+                    --configuration "@buildType@" \
+                    --no-build \
+                    "${dotnetPackFlags[@]}"  \
+                    "${dotnetFlags[@]}"
+        done
+    fi
+
+    runHook postInstall
+
+    echo "Finished dotnetInstallHook"
+}
+
+if [[ -z "${dontDotnetInstall-}" && -z "${installPhase-}" ]]; then
+    installPhase=dotnetInstallHook
+fi