blob: f209861f79b1599d3928dbfeb7a53d7e6b1503b6 (
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
|
dotnetBuildHook() {
echo "Executing dotnetBuildHook"
runHook preBuild
local -r hostRuntimeId=@runtimeId@
local -r dotnetBuildType="${dotnetBuildType-Release}"
local -r dotnetRuntimeId="${dotnetRuntimeId-$hostRuntimeId}"
if [[ -n $__structuredAttrs ]]; then
local dotnetProjectFilesArray=( "${dotnetProjectFiles[@]}" )
local dotnetTestProjectFilesArray=( "${dotnetTestProjectFiles[@]}" )
local dotnetFlagsArray=( "${dotnetFlags[@]}" )
local dotnetBuildFlagsArray=( "${dotnetBuildFlags[@]}" )
else
local dotnetProjectFilesArray=($dotnetProjectFiles)
local dotnetTestProjectFilesArray=($dotnetTestProjectFiles)
local dotnetFlagsArray=($dotnetFlags)
local dotnetBuildFlagsArray=($dotnetBuildFlags)
fi
if [[ -n "${enableParallelBuilding-}" ]]; then
local -r maxCpuFlag="$NIX_BUILD_CORES"
local -r parallelBuildFlag="true"
else
local -r maxCpuFlag="1"
local -r parallelBuildFlag="false"
fi
if [[ -n ${dotnetSelfContainedBuild-} ]]; then
dotnetBuildFlagsArray+=("-p:SelfContained=true")
else
dotnetBuildFlagsArray+=("-p:SelfContained=false")
fi
if [[ -n ${dotnetUseAppHost-} ]]; then
dotnetBuildFlagsArray+=("-p:UseAppHost=true")
fi
local versionFlagsArray=()
if [[ -n ${version-} ]]; then
versionFlagsArray+=("-p:InformationalVersion=$version")
fi
if [[ -n ${versionForDotnet-} ]]; then
versionFlagsArray+=("-p:Version=$versionForDotnet")
fi
dotnetBuild() {
local -r projectFile="${1-}"
local runtimeIdFlagsArray=()
if [[ $projectFile == *.csproj || -n ${dotnetSelfContainedBuild-} ]]; then
runtimeIdFlagsArray+=("--runtime" "$dotnetRuntimeId")
fi
dotnet build ${1+"$projectFile"} \
-maxcpucount:"$maxCpuFlag" \
-p:BuildInParallel="$parallelBuildFlag" \
-p:ContinuousIntegrationBuild=true \
-p:Deterministic=true \
--configuration "$dotnetBuildType" \
--no-restore \
"${versionFlagsArray[@]}" \
"${runtimeIdFlagsArray[@]}" \
"${dotnetBuildFlagsArray[@]}" \
"${dotnetFlagsArray[@]}"
}
if (( ${#dotnetProjectFilesArray[@]} == 0 )); then
dotnetBuild
fi
local projectFile
for projectFile in "${dotnetProjectFilesArray[@]}" "${dotnetTestProjectFilesArray[@]}"; do
dotnetBuild "$projectFile"
done
runHook postBuild
echo "Finished dotnetBuildHook"
}
if [[ -z ${dontDotnetBuild-} && -z ${buildPhase-} ]]; then
buildPhase=dotnetBuildHook
fi
|