Skip to content

Prepare workload marker and root shim layouts for incremental builds - #56566

Merged
mthalman merged 3 commits into
dotnet:mainfrom
mthalman:mthalman-workload-metadata-root-shim-ownership
Oct 15, 2026
Merged

mthalman merged 3 commits into
dotnet:mainfrom
mthalman:mthalman-workload-metadata-root-shim-ownership

Conversation

@mthalman

@mthalman mthalman commented Oct 9, 2026

Copy link
Copy Markdown
Member

Problem

Full installer builds currently delete and recreate the staging directory. Before we can remove that deletion, each layout target needs to clean up the old files it owns.

The workload marker and root shim targets don't do that today. Reusing a layout can leave old feature-band markers, markers after source-only mode is disabled, or launchers that no longer belong in that layout.

Changes

  • Remove obsolete userlocal markers without deleting workload records or other metadata.
  • Remove obsolete root dnx and dnx.cmd files from base and intermediate installer staging, keeping the existing platform rules.
  • Use the same preparation and completion pattern as the template and manifest layouts to skip unchanged work and recover from missing outputs or interrupted builds.
  • Validate checked owned paths before cleanup, and restore shim contents if archive extraction has replaced the SDK's script.

This establishes the cleanup rules needed by #55871, which will replace the broad staging-directory deletion. That deletion remains in this PR, so this is groundwork for incremental builds, not a significant full-build speedup.

Fixes: #55870

Give marker and root shim layouts narrow stale-output ownership. Reuse incremental preparation and completion, preserve platform policy, and repair replaced shim contents before skipping.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4098ff8d-0d8e-4416-8404-27b792b4d1d0
@mthalman
mthalman requested a review from lbussell as a code owner October 9, 2026 14:43
Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:43
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 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.

🟡 Changes recommended

Dangling links and a file occupying the expected feature-band directory can bypass pre-cleanup validation.

3 open findings
What changed in this PR

Prepares workload-marker and root-shim layouts for future incremental installer builds while retaining the existing full-layout deletion.

Changes:

  • Adds owned-output discovery, validation, cleanup, repair, and completion tracking.
  • Integrates incremental targets for redist and intermediate layouts.
  • Adds cross-platform regression tests and ownership documentation.
File Description
test/​UnitTests.proj Deploys layout targets and shim inputs for tests.
test/​sdk-tasks.Tests/​WorkloadMetadataLayoutTests.cs Tests cleanup, recovery, validation, and incrementality.
src/​Tasks/​sdk-tasks/​WorkloadMetadataLayout.cs Discovers expected and stale workload markers.
src/​Tasks/​sdk-tasks/​WorkloadManifestLayout.cs Shares feature-band validation.
src/​Tasks/​sdk-tasks/​sdk-tasks.InTree.targets Registers the new tasks.
src/​Tasks/​sdk-tasks/​LayoutPathValidation.cs Adds owned-path safety checks.
src/​Tasks/​sdk-tasks/​GetDnxShimLayout.cs Discovers and validates root shims.
src/​Layout/​redist/​targets/​GenerateInstallerLayout.targets Wires incremental marker and shim layouts.
src/​Layout/​AGENTS.md Documents layout ownership rules.

🧠 Review effort: Balanced

Comment thread src/Layout/AGENTS.md Resolved
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4098ff8d-0d8e-4416-8404-27b792b4d1d0

@nagilson nagilson 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.

I'm quite unfamiliar with this area, but did some look on the implementation. Let me know what you think.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4098ff8d-0d8e-4416-8404-27b792b4d1d0
@mthalman
mthalman requested a review from nagilson October 15, 2026 14:52
@mthalman
mthalman merged commit 17868ad into dotnet:main Oct 15, 2026
33 of 34 checks passed
@mthalman
mthalman deleted the mthalman-workload-metadata-root-shim-ownership branch October 15, 2026 18:39
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 29, 2026
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.

Make workload metadata and root shims own stale outputs

3 participants