Skip to content

Parallel build#3133

Open
xen2 wants to merge 7 commits intomasterfrom
feature/parallel-build
Open

Parallel build#3133
xen2 wants to merge 7 commits intomasterfrom
feature/parallel-build

Conversation

@xen2
Copy link
Copy Markdown
Member

@xen2 xen2 commented Apr 14, 2026

PR Details

WIP (not marked as draft to test CI)

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@xen2 xen2 marked this pull request as ready for review April 14, 2026 08:43
@xen2 xen2 force-pushed the master branch 2 times, most recently from ab329f3 to 482bd28 Compare April 16, 2026 07:56
@xen2 xen2 force-pushed the feature/parallel-build branch 5 times, most recently from 0e90097 to 47d25bd Compare April 23, 2026 05:55
xen2 added 3 commits April 23, 2026 14:59
…ojects

Drop Pack from _StrideProjectReferenceGraphicsApiDependent's MSBuild dispatch. Pack re-entry was a source of 'same project built twice with different globals' under parallel MSBuild; the normal ProjectReference walk handles Build, and Pack runs separately on consuming projects. With Pack gone, the explicit Targets attribute is redundant (Build is the default).

Set StrideSkipAutoPack=true on test projects — they don't produce their own .nupkg. Add StrideSkipAutoPack to GlobalPropertiesToRemove on the Stride.Core.Assets.CompilerApp ProjectReference so the property stays local: CompilerApp still needs its own .nupkg in bin\packages\ for the test's AssetCompiler run.
Non-API-dependent middle projects (e.g. Stride.Engine, built with default API) re-export the wrong-variant ssdeps through the reference graph; under parallel MSBuild the direct API-dependent reference races with the transitive one on the same output filename.
@xen2 xen2 force-pushed the feature/parallel-build branch from 47d25bd to 26b8af0 Compare April 23, 2026 06:00
Collapses the MSBuild project-instance cache key so parallel consumers share one build of non-API-dependent projects (Stride.Core, Stride.Core.CompilerServices, etc.). Without this, each consumer with a different Platform/TFM/GraphicsApi/TestRID passes distinct globals, MSBuild creates distinct build contexts, and they race on the referenced project's single obj/ output — the canonical 'file locked by VBCSCompiler' error.

Runs before _GetProjectReferenceTargetFrameworkProperties (not just PrepareProjectReferences) because the TFM-query MSBuild dispatch happens first — the GlobalPropertiesToRemove metadata has to be in place by then, otherwise StrideGraphicsApi leaks through and a second cache entry is created.
@xen2 xen2 force-pushed the feature/parallel-build branch from 0259b20 to 5103019 Compare April 23, 2026 06:26
xen2 added 3 commits April 23, 2026 15:29
…nGroup

The previous approach added GlobalPropertiesToRemove in _StrideProjectReferenceGraphicsApiDependent (target time). That target runs before PrepareProjectReferences, but _GetProjectReferenceTargetFrameworkProperties runs earlier still — so the metadata wasn't in place for the TFM-query dispatch, and StrideGraphicsApi leaked through, creating duplicate cache entries for Stride.Core.

Moving the strip to PrepareProjectReferences only caught the Build dispatch (not the TFM query). Moving it earlier (before _GetProjectReferenceTargetFrameworkProperties) broke SetTargetFramework population — the target's Include pattern rebuilt items with an incomplete SetTargetFramework, sending 'net10.0-windows' to net10.0-only projects.

ItemDefinitionGroup applies at evaluation time, so both dispatches honour it. API-dependent references still get StrideGraphicsApi via SetTargetFramework (set at target time and applied as Properties by the dispatcher), which wins over the Remove.
Parallel MSBuild was racing on obj/ outputs because Stride.Games (and other API-dep projects) ended up with two cache entries per TF: one from the slnf's direct Build (AdditionalProperties included StrideGraphicsApi) and one from transitive dispatches (where the singular never made it through). Two cache entries → two real compiles → same obj path → race.

In single-API builds the singular StrideGraphicsApi is redundant information — the plural already pins the API. Strip it at ProjectReference evaluation time via ItemDefinitionGroup, and drop it from the inner-build AdditionalProperties too. Both paths now converge on one cache key per (project, TF); the inner reads the singular locally from StrideGraphicsApis when it needs it.

Multi-API mode (StrideGraphicsApiDependentBuildAll=true) keeps the singular as a cache-key differentiator, with the strip disabled and the SetTargetFramework augmentation preserved for transitive dispatches. The target uses Update (not Remove+Include) so existing metadata — SetTargetFramework from _GetProjectReferenceTargetFrameworkProperties, GlobalPropertiesToRemove from the ItemDefinitionGroup — survives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant