Put logs in the same location on Unix as on Windows

... and set default properties that are true for source-build.
This commit is contained in:
Viktor Hofer 2024-01-11 19:51:41 +01:00
parent d7f415494a
commit 806a764a0b
2 changed files with 21 additions and 10 deletions

View file

@ -3,13 +3,15 @@
### Usage: $0 [options] ### Usage: $0 [options]
### ###
### Options: ### Options:
### --ci Set when running on CI server
### --clean-while-building Cleans each repo after building (reduces disk space usage) ### --clean-while-building Cleans each repo after building (reduces disk space usage)
### --configuration Build configuration [Default: Release]
### --online Build using online sources ### --online Build using online sources
### --poison Build with poisoning checks ### --poison Build with poisoning checks
### --release-manifest <FILE> A JSON file, an alternative source of Source Link metadata
### --run-smoke-test Don't build; run smoke tests ### --run-smoke-test Don't build; run smoke tests
### --source-repository <URL> Source Link repository URL, required when building from tarball ### --source-repository <URL> Source Link repository URL, required when building from tarball
### --source-version <SHA> Source Link revision, required when building from tarball ### --source-version <SHA> Source Link revision, required when building from tarball
### --release-manifest <FILE> A JSON file, an alternative source of Source Link metadata
### --use-mono-runtime Output uses the mono runtime ### --use-mono-runtime Output uses the mono runtime
### --with-packages <DIR> Use the specified directory of previously-built packages ### --with-packages <DIR> Use the specified directory of previously-built packages
### --with-sdk <DIR> Use the SDK in the specified directory for bootstrapping ### --with-sdk <DIR> Use the SDK in the specified directory for bootstrapping
@ -27,6 +29,10 @@ function print_help () {
} }
MSBUILD_ARGUMENTS=("-flp:v=detailed") MSBUILD_ARGUMENTS=("-flp:v=detailed")
MSBUILD_ARGUMENTS=("--tl:off")
# TODO: Make it possible to invoke this script for non source build use cases
MSBUILD_ARGUMENTS+=("/p:DotNetBuildFromSource=true")
MSBUILD_ARGUMENTS+=("/p:DotNetBuildVertical=false")
CUSTOM_PACKAGES_DIR='' CUSTOM_PACKAGES_DIR=''
alternateTarget=false alternateTarget=false
runningSmokeTests=false runningSmokeTests=false
@ -39,6 +45,7 @@ CUSTOM_SDK_DIR=''
sourceRepository='' sourceRepository=''
sourceVersion='' sourceVersion=''
releaseManifest='' releaseManifest=''
configuration='Release'
while :; do while :; do
if [ $# -le 0 ]; then if [ $# -le 0 ]; then
@ -47,9 +54,15 @@ while :; do
lowerI="$(echo "$1" | awk '{print tolower($0)}')" lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case $lowerI in case $lowerI in
--ci)
MSBUILD_ARGUMENTS+=( "-p:ContinuousIntegrationBuild=true")
;;
--clean-while-building) --clean-while-building)
MSBUILD_ARGUMENTS+=( "-p:CleanWhileBuilding=true") MSBUILD_ARGUMENTS+=( "-p:CleanWhileBuilding=true")
;; ;;
--configuration)
configuration="$2"
;;
--online) --online)
MSBUILD_ARGUMENTS+=( "-p:BuildWithOnlineSources=true") MSBUILD_ARGUMENTS+=( "-p:BuildWithOnlineSources=true")
;; ;;
@ -114,6 +127,8 @@ while :; do
shift shift
done done
MSBUILD_ARGUMENTS+=("/p:Configuration=$configuration")
# For build purposes, we need to make sure we have all the SourceLink information # For build purposes, we need to make sure we have all the SourceLink information
if [ "$alternateTarget" != "true" ]; then if [ "$alternateTarget" != "true" ]; then
GIT_DIR="$SCRIPT_ROOT/.git" GIT_DIR="$SCRIPT_ROOT/.git"
@ -191,7 +206,7 @@ if [ -d "$CUSTOM_SDK_DIR" ]; then
export SDK_VERSION=$("$CUSTOM_SDK_DIR/dotnet" --version) export SDK_VERSION=$("$CUSTOM_SDK_DIR/dotnet" --version)
export CLI_ROOT="$CUSTOM_SDK_DIR" export CLI_ROOT="$CUSTOM_SDK_DIR"
export _InitializeDotNetCli="$CLI_ROOT/dotnet" export _InitializeDotNetCli="$CLI_ROOT/dotnet"
export CustomDotNetSdkDir="$CLI_ROOT" export DOTNET_INSTALL_DIR="$CLI_ROOT"
echo "Using custom bootstrap SDK from '$CLI_ROOT', version '$SDK_VERSION'" echo "Using custom bootstrap SDK from '$CLI_ROOT', version '$SDK_VERSION'"
else else
sdkLine=$(grep -m 1 'dotnet' "$SCRIPT_ROOT/global.json") sdkLine=$(grep -m 1 'dotnet' "$SCRIPT_ROOT/global.json")
@ -251,16 +266,12 @@ LogDateStamp=$(date +"%m%d%H%M%S")
if [ "$alternateTarget" == "true" ]; then if [ "$alternateTarget" == "true" ]; then
export NUGET_PACKAGES=$NUGET_PACKAGES/smoke-tests export NUGET_PACKAGES=$NUGET_PACKAGES/smoke-tests
"$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/build.proj" -bl:"$SCRIPT_ROOT/artifacts/log/Debug/BuildTests_$LogDateStamp.binlog" -flp:"LogFile=$SCRIPT_ROOT/artifacts/logs/BuildTests_$LogDateStamp.log" -clp:v=m ${MSBUILD_ARGUMENTS[@]} "$@" "$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/build.proj" -bl:"$SCRIPT_ROOT/artifacts/log/$configuration/BuildTests_$LogDateStamp.binlog" -flp:"LogFile=$SCRIPT_ROOT/artifacts/log/$configuration/BuildTests_$LogDateStamp.log" -clp:v=m ${MSBUILD_ARGUMENTS[@]} "$@"
else else
# BuildXPlatTasks uses NetCurrent but that is not set since Arcade isn't used here. "$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/eng/tools/init-build.proj" -bl:"$SCRIPT_ROOT/artifacts/log/$configuration/BuildMSBuildSdkResolver_$LogDateStamp.binlog" -flp:LogFile="$SCRIPT_ROOT/artifacts/log/$configuration/BuildMSBuildSdkResolver_$LogDateStamp.log" -t:ExtractToolPackage,BuildMSBuildSdkResolver ${MSBUILD_ARGUMENTS[@]} "$@"
# Bootstrap NetCurrent by deriving it from the installed .NET CLI version.
netCurrent="$($CLI_ROOT/dotnet --version | while IFS='.' read major minor _; do echo "net$major.$minor"; done)"
"$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/eng/tools/init-build.proj" -p:NetCurrent=$netCurrent -bl:"$SCRIPT_ROOT/artifacts/log/Debug/BuildXPlatTasks_$LogDateStamp.binlog" -flp:LogFile="$SCRIPT_ROOT/artifacts/logs/BuildXPlatTasks_$LogDateStamp.log" -t:PrepareOfflineLocalTools ${MSBUILD_ARGUMENTS[@]} "$@"
# kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver # kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver
"$CLI_ROOT/dotnet" build-server shutdown "$CLI_ROOT/dotnet" build-server shutdown
"$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/build.proj" -bl:"$SCRIPT_ROOT/artifacts/log/Debug/Build_$LogDateStamp.binlog" -flp:"LogFile=$SCRIPT_ROOT/artifacts/logs/Build_$LogDateStamp.log" ${MSBUILD_ARGUMENTS[@]} "$@" "$CLI_ROOT/dotnet" msbuild "$SCRIPT_ROOT/build.proj" -bl:"$SCRIPT_ROOT/artifacts/log/$configuration/Build_$LogDateStamp.binlog" -flp:"LogFile=$SCRIPT_ROOT/artifacts/log/$configuration/Build_$LogDateStamp.log" ${MSBUILD_ARGUMENTS[@]} "$@"
fi fi

View file

@ -165,7 +165,7 @@ function BootstrapArtifacts {
fi fi
# Run restore on project to initiate download of bootstrap packages # Run restore on project to initiate download of bootstrap packages
"$DOTNET_SDK_PATH/dotnet" restore "$workingDir/buildBootstrapPreviouslySB.csproj" /bl:artifacts/prep/bootstrap.binlog /fileLoggerParameters:LogFile=artifacts/prep/bootstrap.log /p:ArchiveDir="$packagesArchiveDir" /p:BootstrapOverrideVersionsProps="$SCRIPT_ROOT/eng/bootstrap/OverrideBootstrapVersions.props" "$DOTNET_SDK_PATH/dotnet" restore "$workingDir/buildBootstrapPreviouslySB.csproj" /bl:artifacts/log/bootstrap.binlog /fileLoggerParameters:LogFile=artifacts/log/bootstrap.log /p:ArchiveDir="$packagesArchiveDir" /p:BootstrapOverrideVersionsProps="$SCRIPT_ROOT/eng/bootstrap/OverrideBootstrapVersions.props"
# Remove working directory # Remove working directory
rm -rf "$workingDir" rm -rf "$workingDir"