Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
if [ ${#actInt[@]} -eq 0 ]; then
    arguments=("-restore" "-build" ${arguments[@]+"${arguments[@]}"})
fi

if [[ "$os" == "browser" ]]; then
    # override default arch for Browser, we only support wasm
    arch=wasm
    # because on docker instance without swap file, MSBuild nodes need to make some room for LLVM
    # https://github.com/dotnet/runtime/issues/113724
    # this is hexa percentage: 46-> 70%
    export DOTNET_GCHeapHardLimitPercent="46"
fi
if [[ "$os" == "wasi" ]]; then
    # override default arch for wasi, we only support wasm
    arch=wasm
fi

if [[ "${TreatWarningsAsErrors:-}" == "false" ]]; then
    arguments+=("-warnAsError" "false")
fi

# disable terminal logger for now: https://github.com/dotnet/runtime/issues/97211
arguments+=("-tl:false")
# disable line wrapping so that C&P from the console works well
arguments+=("-clp:ForceNoAlign")

# Apply ninja setting
if [[ "$useNinja" == true ]]; then
  arguments+=("/p:Ninja=true")
fi

initDistroRid "$os" "$arch" "$crossBuild"

# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later.
# The later changes are ignored when using the cache.
export DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0

# URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh.
# In *proj files (XML docs), URL-encoded string are rendered in their decoded form.
cmakeargs="${cmakeargs// /%20}"
arguments+=("/p:TargetArchitecture=$arch" "/p:BuildArchitecture=$hostArch")
arguments+=("/p:CMakeArgs=\"$cmakeargs\"" ${extraargs[@]+"${extraargs[@]}"})

if [[ "$bootstrap" == "1" ]]; then
  # Strip build actions other than -restore and -build from the arguments for the bootstrap build.
  bootstrapArguments=()
  for argument in "${arguments[@]}"; do
    add=1
    for flag in --sign --publish --pack --test -sign -publish -pack -test; do
      if [[ "$argument" == "$flag" ]]; then
        add=0

Review comment (suggestion):
The ninja setting application is incomplete. When useNinja is false, the code should add "/p:Ninja=false" to the arguments array, but currently it adds nothing. This breaks the opt-out mechanism since the MSBuild property Ninja won't be explicitly set to false. The condition should be changed to an if-else that handles both true and false cases.
```suggestion
  arguments+=("/p:Ninja=true")
else
  arguments+=("/p:Ninja=false")
```

Code after:

if [[ "$os" == "browser" ]]; then
    # override default arch for Browser, we only support wasm
    arch=wasm
    # because on docker instance without swap file, MSBuild nodes need to make some room for LLVM
    # https://github.com/dotnet/runtime/issues/113724
    # this is hexa percentage: 46-> 70%
    export DOTNET_GCHeapHardLimitPercent="46"
fi
if [[ "$os" == "wasi" ]]; then
    # override default arch for wasi, we only support wasm
    arch=wasm
fi

if [[ "${TreatWarningsAsErrors:-}" == "false" ]]; then
    arguments+=("-warnAsError" "false")
fi

# disable terminal logger for now: https://github.com/dotnet/runtime/issues/97211
arguments+=("-tl:false")
# disable line wrapping so that C&P from the console works well
arguments+=("-clp:ForceNoAlign")

# Apply ninja setting
if [[ "$useNinja" == true ]]; then
  arguments+=("/p:Ninja=true")
fi

initDistroRid "$os" "$arch" "$crossBuild"

# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later.
# The later changes are ignored when using the cache.
export DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0

# URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh.
# In *proj files (XML docs), URL-encoded string are rendered in their decoded form.
cmakeargs="${cmakeargs// /%20}"
arguments+=("/p:TargetArchitecture=$arch" "/p:BuildArchitecture=$hostArch")
arguments+=("/p:CMakeArgs=\"$cmakeargs\"" ${extraargs[@]+"${extraargs[@]}"})

if [[ "$bootstrap" == "1" ]]; then
  # Strip build actions other than -restore and -build from the arguments for the bootstrap build.
  bootstrapArguments=()
  for argument in "${arguments[@]}"; do
    add=1
    for flag in --sign --publish --pack --test -sign -publish -pack -test; do
      if [[ "$argument" == "$flag" ]]; then
        add=0
      fi
    done
    if [[ $add == 1 ]]; then