Handle spaces in properties passed to VMR's build.sh (#19686)

Co-authored-by: Ella Hathaway <67609881+ellahathaway@users.noreply.github.com>
This commit is contained in:
Omair Majid 2024-05-07 02:30:55 -04:00 committed by GitHub
parent 4dab71a9ef
commit 3ee35016dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -88,7 +88,7 @@ exclude_ci_binary_log=false
prepare_machine=false prepare_machine=false
use_dev_versioning=false use_dev_versioning=false
properties='' properties=()
while [[ $# > 0 ]]; do while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
case "$opt" in case "$opt" in
@ -120,13 +120,13 @@ while [[ $# > 0 ]]; do
# Source-only settings # Source-only settings
-source-only|-source-build|-so|-sb) -source-only|-source-build|-so|-sb)
sourceOnly=true sourceOnly=true
properties="$properties /p:DotNetBuildSourceOnly=true" properties+=( "/p:DotNetBuildSourceOnly=true" )
;; ;;
-online) -online)
properties="$properties /p:DotNetBuildWithOnlineFeeds=true" properties+=( "/p:DotNetBuildWithOnlineFeeds=true" )
;; ;;
-poison) -poison)
properties="$properties /p:EnablePoison=true" properties+=( "/p:EnablePoison=true" )
;; ;;
-release-manifest) -release-manifest)
releaseManifest="$2" releaseManifest="$2"
@ -163,13 +163,13 @@ while [[ $# > 0 ]]; do
# Advanced settings # Advanced settings
-build-repo-tests) -build-repo-tests)
properties="$properties /p:DotNetBuildTests=true" properties+=( "/p:DotNetBuildTests=true" )
;; ;;
-ci) -ci)
ci=true ci=true
;; ;;
-clean-while-building|-cwb) -clean-while-building|-cwb)
properties="$properties /p:CleanWhileBuilding=true" properties+=( "/p:CleanWhileBuilding=true" )
;; ;;
-excludecibinarylog|-nobl) -excludecibinarylog|-nobl)
exclude_ci_binary_log=true exclude_ci_binary_log=true
@ -178,13 +178,13 @@ while [[ $# > 0 ]]; do
prepare_machine=true prepare_machine=true
;; ;;
-use-mono-runtime) -use-mono-runtime)
properties="$properties /p:SourceBuildUseMonoRuntime=true" properties+=( "/p:SourceBuildUseMonoRuntime=true" )
;; ;;
-dev) -dev)
use_dev_versioning=true use_dev_versioning=true
;; ;;
*) *)
properties="$properties $1" properties+=( "$1" )
;; ;;
esac esac
@ -198,7 +198,7 @@ if [[ "$ci" == true ]]; then
fi fi
if [[ "$use_dev_versioning" == true && "$sourceOnly" != true ]]; then if [[ "$use_dev_versioning" == true && "$sourceOnly" != true ]]; then
properties="$properties /p:UseOfficialBuildVersioning=false" properties+=( "/p:UseOfficialBuildVersioning=false" )
fi fi
# Never use the global nuget cache folder # Never use the global nuget cache folder
@ -234,14 +234,14 @@ function Build {
$targets \ $targets \
$bl \ $bl \
/p:Configuration=$configuration \ /p:Configuration=$configuration \
$properties "${properties[@]}"
ExitWithExitCode 0 ExitWithExitCode 0
else else
if [ "$ci" == "true" ]; then if [ "$ci" == "true" ]; then
properties="$properties /p:ContinuousIntegrationBuild=true" properties+=( "/p:ContinuousIntegrationBuild=true" )
fi fi
if [ "$test" != "true" ]; then if [ "$test" != "true" ]; then
@ -251,7 +251,7 @@ function Build {
fi fi
"$CLI_ROOT/dotnet" build-server shutdown "$CLI_ROOT/dotnet" build-server shutdown
"$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/init-source-only.proj" $initSourceOnlyBinaryLog $properties "$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/init-source-only.proj" $initSourceOnlyBinaryLog "${properties[@]}"
# 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
fi fi
@ -264,7 +264,7 @@ function Build {
bl="/bl:\"$log_dir/Build.binlog\"" bl="/bl:\"$log_dir/Build.binlog\""
fi fi
"$CLI_ROOT/dotnet" msbuild --restore "$project" $bl $targets $properties "$CLI_ROOT/dotnet" msbuild --restore "$project" $bl $targets "${properties[@]}"
fi fi
} }
@ -331,9 +331,9 @@ if [[ "$sourceOnly" == "true" ]]; then
# Support custom source built package locations # Support custom source built package locations
if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then
if [ "$test" == "true" ]; then if [ "$test" == "true" ]; then
properties="$properties /p:CustomSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" properties+=( "/p:CustomSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
else else
properties="$properties /p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" properties+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PACKAGES_DIR" )
fi fi
fi fi