blob: 4d9b3c502c354c573bd49be97b9c43201fd7b553 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
dotnetInstallHook() {
echo "Executing dotnetInstallHook"
runHook preInstall
local -r hostRuntimeId=@runtimeId@
local -r dotnetInstallPath="${dotnetInstallPath-$out/lib/$pname}"
local -r dotnetBuildType="${dotnetBuildType-Release}"
local -r dotnetRuntimeId="${dotnetRuntimeId-$hostRuntimeId}"
if [[ -n $__structuredAttrs ]]; then
local dotnetProjectFilesArray=( "${dotnetProjectFiles[@]}" )
local dotnetFlagsArray=( "${dotnetFlags[@]}" )
local dotnetInstallFlagsArray=( "${dotnetInstallFlags[@]}" )
local dotnetPackFlagsArray=( "${dotnetPackFlags[@]}" )
else
local dotnetProjectFilesArray=($dotnetProjectFiles)
local dotnetFlagsArray=($dotnetFlags)
local dotnetInstallFlagsArray=($dotnetInstallFlags)
local dotnetPackFlagsArray=($dotnetPackFlags)
fi
if [[ -n ${dotnetSelfContainedBuild-} ]]; then
dotnetInstallFlagsArray+=("--self-contained")
else
dotnetInstallFlagsArray+=("--no-self-contained")
# https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained
# Trimming is only available for self-contained build, so force disable it here
dotnetInstallFlagsArray+=("-p:PublishTrimmed=false")
fi
if [[ -n ${dotnetUseAppHost-} ]]; then
dotnetInstallFlagsArray+=("-p:UseAppHost=true")
fi
dotnetPublish() {
local -r projectFile="${1-}"
runtimeIdFlagsArray=()
if [[ $projectFile == *.csproj || -n ${dotnetSelfContainedBuild-} ]]; then
runtimeIdFlagsArray+=("--runtime" "$dotnetRuntimeId")
fi
dotnet publish ${1+"$projectFile"} \
-p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \
--output "$dotnetInstallPath" \
--configuration "$dotnetBuildType" \
--no-build \
"${runtimeIdFlagsArray[@]}" \
"${dotnetInstallFlagsArray[@]}" \
"${dotnetFlagsArray[@]}"
}
dotnetPack() {
local -r projectFile="${1-}"
dotnet pack ${1+"$projectFile"} \
-p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \
--output "$out/share" \
--configuration "$dotnetBuildType" \
--no-build \
--runtime "$dotnetRuntimeId" \
"${dotnetPackFlagsArray[@]}" \
"${dotnetFlagsArray[@]}"
}
if (( ${#dotnetProjectFilesArray[@]} == 0 )); then
dotnetPublish
else
local projectFile
for projectFile in "${dotnetProjectFilesArray[@]}"; do
dotnetPublish "$projectFile"
done
fi
if [[ -n ${packNupkg-} ]]; then
if (( ${#dotnetProjectFilesArray[@]} == 0 )); then
dotnetPack
else
local projectFile
for projectFile in "${dotnetProjectFilesArray[@]}"; do
dotnetPack "$projectFile"
done
fi
fi
runHook postInstall
echo "Finished dotnetInstallHook"
}
if [[ -z "${dontDotnetInstall-}" && -z "${installPhase-}" ]]; then
installPhase=dotnetInstallHook
fi
|