992b656c9e
This is a much more flexible way of doing things, as we can adopt and reuse these hooks for various tasks. Syntax highlighting now also works way better for me, which is a nice bonus :)
41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
declare -a projectFile testProjectFile dotnetBuildFlags dotnetFlags
|
|
|
|
dotnetBuildHook() {
|
|
echo "Executing dotnetBuildHook"
|
|
|
|
runHook preBuild
|
|
|
|
if [ "${enableParallelBuilding-}" ]; then
|
|
maxCpuFlag="$NIX_BUILD_CORES"
|
|
parallelBuildFlag="true"
|
|
else
|
|
maxCpuFlag="1"
|
|
parallelBuildFlag="false"
|
|
fi
|
|
|
|
if [ "${version-}" ]; then
|
|
versionFlag="-p:Version=${version-}"
|
|
fi
|
|
|
|
for project in ${projectFile[@]} ${testProjectFile[@]}; do
|
|
env \
|
|
dotnet build "$project" \
|
|
-maxcpucount:$maxCpuFlag \
|
|
-p:BuildInParallel=$parallelBuildFlag \
|
|
-p:ContinuousIntegrationBuild=true \
|
|
-p:Deterministic=true \
|
|
--configuration "@buildType@" \
|
|
--no-restore \
|
|
${versionFlag-} \
|
|
"${dotnetBuildFlags[@]}" \
|
|
"${dotnetFlags[@]}"
|
|
done
|
|
|
|
runHook postBuild
|
|
|
|
echo "Finished dotnetBuildHook"
|
|
}
|
|
|
|
if [[ -z "${dontDotnetBuild-}" && -z "${buildPhase-}" ]]; then
|
|
buildPhase=dotnetBuildHook
|
|
fi
|