Skip to content

Preserve default Ninja behavior when MSBuild property is unset - #134471

Merged
jtschuster merged 1 commit into
mainfrom
copilot/fix-ninja-default-handling
Sep 23, 2026
Merged

jtschuster merged 1 commit into
mainfrom
copilot/fix-ninja-default-handling

Conversation

Copilot AI commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Unset Ninja properties were treated as explicitly disabled, overriding the native build scripts’ default generator selection. Elsewhere in the clr build, Ninja is treated as the default. Usually this is propagated from the outer ./build.sh, but when building one of these project directly (as trimmer tests do) without explicitly setting /p:Ninja=true, it defaults to Makefiles. This causes the build to fail if CMakeCache.txt is present after previous build used the default Ninja.

Changes

  • Pass -ninja false only when Ninja=false.
  • Preserve explicit Ninja=true behavior.
  • Retain the existing Windows-specific MSBuild selection.
  • Apply consistently across CoreCLR, corehost, and native libraries.

Validation

  • Built clr+libs+host.
  • Verified unset, true, and false property handling across all affected projects.

Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Copilot AI changed the title Fix Ninja default handling in native builds Preserve default Ninja behavior when MSBuild property is unset Sep 22, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Preserves Ninja as the default generator when the Ninja MSBuild property is unset.

Changes:

  • Passes -ninja false only for explicit Ninja=false.
  • Retains explicit Ninja=true and Windows-specific behavior.
  • Applies consistently across CoreCLR, corehost, and native libraries.
File Description
src/​native/​libs/​build-native.proj Preserves native library build defaults.
src/​native/​corehost/​corehost.proj Preserves corehost’s default Ninja selection.
src/​coreclr/​runtime.proj Adjusts CoreCLR generator argument handling.

@am11 am11 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX nit: we could make it --option instead of --arg <val>, e.g. settle on ninja being default and --no-ninja to turn it off.

@jtschuster

Copy link
Copy Markdown
Member

/ba-g unrelated crypto failure.

@jtschuster
jtschuster merged commit 696cea0 into main Sep 23, 2026
165 of 167 checks passed
@jtschuster
jtschuster deleted the copilot/fix-ninja-default-handling branch September 23, 2026 17:53
@github-project-automation github-project-automation Bot moved this to Done in AppModel Sep 23, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants