From 93eb0656069d95c67717e041b869f4e9734fd86c Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Wed, 18 Feb 2026 18:07:53 +0000
Subject: [PATCH] Preserve ninja=false via msbuild
---
eng/native/gen-buildsys.sh | 6 +++---
src/coreclr/runtime.proj | 3 ++-
src/native/corehost/corehost.proj | 1 +
src/native/libs/build-native.proj | 1 +
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh
index 186a179f78c0f2..c7d06b70ee3b71 100755
--- a/eng/native/gen-buildsys.sh
+++ b/eng/native/gen-buildsys.sh
@@ -39,7 +39,7 @@ code_coverage=OFF
build_tests=OFF
scan_build=OFF
generator="Unix Makefiles"
-__UnprocessedCMakeArgs=""
+__UnprocessedCMakeArgs=()
for i in "${@:6}"; do
upperI="$(echo "$i" | tr "[:lower:]" "[:upper:]")"
@@ -56,7 +56,7 @@ for i in "${@:6}"; do
scan_build=ON
;;
*)
- __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
+ __UnprocessedCMakeArgs+=("$i")
esac
done
@@ -132,7 +132,7 @@ $cmake_command \
"-DCMAKE_BUILD_TYPE=$buildtype" \
"-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \
$cmake_extra_defines \
- $__UnprocessedCMakeArgs \
+ "${__UnprocessedCMakeArgs[@]}" \
"${cmake_extra_defines_wasm[@]}" \
-S "$1" \
-B "$2"
diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj
index 1d3ec82608a69e..5d085be67b1061 100644
--- a/src/coreclr/runtime.proj
+++ b/src/coreclr/runtime.proj
@@ -41,6 +41,7 @@
'$(PgoInstrument)' != 'true'"
Include="-enforcepgo" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'true' and !$([MSBuild]::IsOsPlatform(Windows))" Include="-ninja" />
+ <_CoreClrBuildArg Condition="'$(Ninja)' != 'true' and !$([MSBuild]::IsOsPlatform(Windows))" Include="-ninja false" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform(Windows))" Include="-msbuild" />
<_CoreClrBuildArg Condition="'$(PgoInstrument)' == 'true'" Include="-pgoinstrument" />
<_CoreClrBuildArg Condition="'$(NativeOptimizationDataSupported)' == 'true' and '$(NoPgoOptimize)' != 'true' and '$(PgoInstrument)' != 'true'" Include="-pgodatapath "$(PgoPackagePath)"" />
@@ -50,7 +51,7 @@
<_CoreClrBuildArg Include="-targetrid $(TargetRid)" />
<_CoreClrBuildArg Include="-cmakeargs "-DCLR_DOTNET_RID=$(PortableTargetRid)"" />
<_CoreClrBuildArg Condition="'$(BuildSubdirectory)' != ''" Include="-subdir $(BuildSubdirectory)" />
- <_CoreClrBuildArg Include="-cmakeargs "-DCLR_DOTNET_HOST_PATH=$(DOTNET_HOST_PATH)"" />
+ <_CoreClrBuildArg Include="-cmakeargs "-DCLR_DOTNET_HOST_PATH='$(DOTNET_HOST_PATH)'"" />
<_CoreClrBuildArg Condition="'$(HasCdacBuildTool)' == 'true'" Include="-cmakeargs "-DCDAC_BUILD_TOOL_BINARY_PATH=$(RuntimeBinDir)cdac-build-tool\cdac-build-tool.dll"" />
<_CoreClrBuildArg Condition="'$(FeatureXplatEventSource)' == 'false'" Include="-cmakeargs "-DFEATURE_EVENTSOURCE_XPLAT=0"" />
<_CoreClrBuildArg Condition="'$(FeatureInterpreter)' == 'true'" Include="-cmakeargs "-DFEATURE_INTERPRETER=1"" />
diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj
index d91a4a5414573e..4b94f29ea7a267 100644
--- a/src/native/corehost/corehost.proj
+++ b/src/native/corehost/corehost.proj
@@ -81,6 +81,7 @@
$(BuildArgs) $(Compiler)
$(BuildArgs) -cmakeargs "$(CMakeArgs)"
$(BuildArgs) -ninja
+ $(BuildArgs) -ninja false
$(BuildArgs) -runtimeflavor $(RuntimeFlavor)
$(BuildArgs) -fsanitize=$(EnableNativeSanitizers)
$(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)"
diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj
index 1362b53af23027..2e9588da2dc019 100644
--- a/src/native/libs/build-native.proj
+++ b/src/native/libs/build-native.proj
@@ -42,6 +42,7 @@
Condition="!$([MSBuild]::IsOsPlatform(Windows))">
<_BuildNativeArgs Condition="'$(Ninja)' == 'true'">$(_BuildNativeArgs) ninja
+ <_BuildNativeArgs Condition="'$(Ninja)' != 'true'">$(_BuildNativeArgs) ninja false