Repository navigation
Support multithreaded MSBuild in F# build tasks - #20506
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Deduplicate TaskEnvironment lifecycle scaffolding in the FSharp.Build task tests by reusing FSharp.Test.ReflectionHelper.getPrivateInstanceMethod and adding narrowly-scoped with* helpers, without altering any scenario or oracle. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Reduce comment bloat and duplication across the multithread-safe FSharp.Build task migration without changing behavior: - Extract the duplicated path-diagnostic helpers (replaceOrdinal, pathComparison, restoreOriginalPaths) shared verbatim by FSharpEmbedResXSource and FSharpEmbedResourceText into a single internal TaskEnvironmentPaths module. - Condense war-story / step-narration comments in Fsc, Fsi, SubstituteText, CompilerLocation and the resource generators to concise why-only notes. - Trim restated and overlong comments in the task tests while preserving every distinct regression scenario and mutation-killing assertion. Co-authored-by: Copilot <[email protected]>
Replace duplicated path and compiler task tests with named data-driven matrices while preserving every regression oracle. Generalize the existing paired TaskEnvironment lifecycle fixture for compiler-bin isolation. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Remove the private PathScenario record and replace pathScenarios callbacks with direct (name, input, expectation) tuples parameterized by directory. Fold assertConcurrentSuccess into runConcurrently by adding a scenario parameter, updating all four call sites. Drop the #nowarn trailing comment and the MockEngine doc comment. Every non-Windows/Windows scenario, xUnit row, task-specific oracle, and failure message is unchanged. Co-authored-by: Copilot <[email protected]>
Trim why-comments that restated code or duplicated across the migrated MSBuild tasks (Fsc/Fsi tool-path normalization, rootedPath helpers, try-block path recording, parameterless-ctor notes) without changing any behavior, scenario, or test coverage. Co-authored-by: Copilot <[email protected]>
Share tool-path normalization, remove test-only production hooks and one-use helpers, deduplicate compiler task factories and assertions, and matrix the Linux CI variants while preserving both commands and failure policies. Co-authored-by: Copilot <[email protected]>
Extract the duplicated IMultiThreadableTask boilerplate (backing field, parameterless fallback ctor, interface impl) and the rootedPath / restoreOriginalPaths helpers from the five Task-derived multithreadable FSharp.Build tasks into a shared MultiThreadableTask abstract base in TaskEnvironmentPaths.fs. Each task keeps its own [<MSBuildMultiThreadableTask>] attribute (asserted directly by the task-is-marked test). Net -44 LOC, no behavior change. Co-authored-by: Copilot <[email protected]>
Remove the branch-added public task base and injected compiler-task constructors, restoring the original public inheritance and constructor shape. Share deferred compiler path resolution and retain per-task environment state through internal composition. Co-authored-by: Copilot <[email protected]>
Refactor the branch-added FSharp.Build task path handling toward expression-oriented F# without changing behavior: - replaceOrdinal: replace the two mutable indices and while loop with a tail-recursive local scanning function that pattern matches on String.IndexOf, keeping the StringBuilder as the only local mutation. - Resource tasks: accumulate the diagnostic originalPaths as an immutable list rebind (mutable let, still recorded inside the try) instead of a ResizeArray with Add/AddRange plus List.ofSeq at the failure handler. - FSharpEmbedResourceText / FSharpEmbedResXSource: root each path once via local bindings and reuse them across the up-to-date checks, reads and writes rather than re-calling RootedPath at every use site. Preserves evaluation order, exception boundaries, diagnostics, path comparison semantics and the numbered up-to-date condition ladder. Fantomas clean; 64 FSharp.Build unit tests pass (20/20 repeats); two deliberate mutations in the touched code are caught by the suite. Net -3 LOC. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Member
Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Restore the existing target ordering without undoing resource registration or task environment changes. Retain all four real SDK publishes and assert their baseline metadata behavior rather than activating an unrelated linker change. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
Invoke the HostObject compiler delegate with relative executable paths and task-specific environments. Check child I/O, process-path normalization and both successful and nonzero exits. Removing ExecuteTool normalization fails all four cases. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074
T-Gro
marked this pull request as ready for review
September 18, 2026 17:34
Contributor
|
🔍 Tooling Safety Check — Affects-Bootstrap, Affects-Build-Infra, Affects-Compiler-Output, Affects-Design-Time, Affects-Test-Tooling
|
Contributor
|
@T-Gro would this still have a shot of making it in dotnet 11 SDK or will it be post that? |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
Author
abonie
approved these changes
Sep 21, 2026
This was referenced Sep 21, 2026
nojaf
added a commit
to fsprojects/fantomas
that referenced
this pull request
Sep 25, 2026
…Repr', commit 349d6aaf1e4685a72e43b7f4a0708205e4104b4c Also takes in 'Remove trailing whitespace from src and vsintegration/src' (dotnet/fsharp#20393) and 'Enable runtime async via compiler intrinsics' (dotnet/fsharp#20235), neither of which needed a change here. The syntax tree now records the range of the `exception` keyword (dotnet/fsharp#20612). mkExceptionKeyword, which looked the keyword up in the source text, is gone, and so is the CodeComments field of CreationAide that only it used. The vendored FSharpEmbedResourceText task became a multithreaded MSBuild task in dotnet/fsharp#20506. Microsoft.Build.Framework and Microsoft.Build.Utilities.Core move to 18.10.1, which has IMultiThreadableTask and TaskEnvironment, and TaskEnvironmentPaths.fs is vendored alongside the task. FSharpEnvironment.fs stands in for the two members of the upstream module that file uses, because the real one needs generated sources this project does not have.
bartelink
pushed a commit
to bartelink/fsharp
that referenced
this pull request
Oct 7, 2026
* Add FSharp.Build task environment test helpers * Fix shared FSharp.Build test logger Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Mark pure FSharp.Build tasks multithreadable Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Make FSharp.Build output tasks multithread-safe Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Harden multithreaded task tests Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Make FSharp resource generators multithread-safe Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Preserve relative resource task diagnostics Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Avoid duplicate resource task errors Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Make SubstituteText multithread-safe Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Make FSharp compiler tasks multithread-safe Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Compact multithreaded task tests Deduplicate TaskEnvironment lifecycle scaffolding in the FSharp.Build task tests by reusing FSharp.Test.ReflectionHelper.getPrivateInstanceMethod and adding narrowly-scoped with* helpers, without altering any scenario or oracle. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Fix remaining multithreaded task path handling Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Handle multithreaded task path edge cases Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Exercise multithreaded MSBuild in Linux PR builds Co-authored-by: Copilot <[email protected]> * Keep multithreaded MSBuild canary informational Co-authored-by: Copilot <[email protected]> * Preserve partially qualified diagnostic paths Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Compact multithreaded task migration Reduce comment bloat and duplication across the multithread-safe FSharp.Build task migration without changing behavior: - Extract the duplicated path-diagnostic helpers (replaceOrdinal, pathComparison, restoreOriginalPaths) shared verbatim by FSharpEmbedResXSource and FSharpEmbedResourceText into a single internal TaskEnvironmentPaths module. - Condense war-story / step-narration comments in Fsc, Fsi, SubstituteText, CompilerLocation and the resource generators to concise why-only notes. - Trim restated and overlong comments in the task tests while preserving every distinct regression scenario and mutation-killing assertion. Co-authored-by: Copilot <[email protected]> * Compact multithreaded task test matrix Replace duplicated path and compiler task tests with named data-driven matrices while preserving every regression oracle. Generalize the existing paired TaskEnvironment lifecycle fixture for compiler-bin isolation. Co-authored-by: Copilot <[email protected]> * Deduplicate concurrent task assertions Co-authored-by: Copilot <[email protected]> * Simplify multithreaded path scenarios Remove the private PathScenario record and replace pathScenarios callbacks with direct (name, input, expectation) tuples parameterized by directory. Fold assertConcurrentSuccess into runConcurrently by adding a scenario parameter, updating all four call sites. Drop the #nowarn trailing comment and the MockEngine doc comment. Every non-Windows/Windows scenario, xUnit row, task-specific oracle, and failure message is unchanged. Co-authored-by: Copilot <[email protected]> * NoBloat multithreaded task migration pass 1 Trim why-comments that restated code or duplicated across the migrated MSBuild tasks (Fsc/Fsi tool-path normalization, rootedPath helpers, try-block path recording, parameterless-ctor notes) without changing any behavior, scenario, or test coverage. Co-authored-by: Copilot <[email protected]> * NoBloat multithreaded task migration pass 2 Share tool-path normalization, remove test-only production hooks and one-use helpers, deduplicate compiler task factories and assertions, and matrix the Linux CI variants while preserving both commands and failure policies. Co-authored-by: Copilot <[email protected]> * CodeCompaction MT tasks pass 1 Extract the duplicated IMultiThreadableTask boilerplate (backing field, parameterless fallback ctor, interface impl) and the rootedPath / restoreOriginalPaths helpers from the five Task-derived multithreadable FSharp.Build tasks into a shared MultiThreadableTask abstract base in TaskEnvironmentPaths.fs. Each task keeps its own [<MSBuildMultiThreadableTask>] attribute (asserted directly by the task-is-marked test). Net -44 LOC, no behavior change. Co-authored-by: Copilot <[email protected]> * CodeCompaction MT tasks pass 2 Remove the branch-added public task base and injected compiler-task constructors, restoring the original public inheritance and constructor shape. Share deferred compiler path resolution and retain per-task environment state through internal composition. Co-authored-by: Copilot <[email protected]> * Make multithreaded task paths more idiomatic Refactor the branch-added FSharp.Build task path handling toward expression-oriented F# without changing behavior: - replaceOrdinal: replace the two mutable indices and while loop with a tail-recursive local scanning function that pattern matches on String.IndexOf, keeping the StringBuilder as the only local mutation. - Resource tasks: accumulate the diagnostic originalPaths as an immutable list rebind (mutable let, still recorded inside the try) instead of a ResizeArray with Add/AddRange plus List.ofSeq at the failure handler. - FSharpEmbedResourceText / FSharpEmbedResXSource: root each path once via local bindings and reuse them across the up-to-date checks, reads and writes rather than re-calling RootedPath at every use site. Preserves evaluation order, exception boundaries, diagnostics, path comparison semantics and the numbered up-to-date condition ladder. Fantomas clean; 64 FSharp.Build unit tests pass (20/20 repeats); two deliberate mutations in the touched code are caught by the suite. Net -3 LOC. Co-authored-by: Copilot <[email protected]> * Refine multithreaded task functional style * Refine multithreaded task test style * Preserve ILLink task diagnostic paths Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Preserve MSBuild exception logging semantics Co-authored-by: Copilot App <[email protected]> Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec * Apply rebased multithreaded task compaction Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Refine rebased multithreaded task helpers Co-authored-by: Copilot App <[email protected]> Copilot-Session: 50c9b6ff-7645-415f-85e5-e59e3b4d0120 * Harden multithreaded task diagnostics and regression coverage Use single resource errors, bounded barriers and independent regression rows. Preserve quoted filenames while restoring diagnostic paths, and cover incremental no-ops, generated-output failures and both substitution stages. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Embed linker substitutions before resource compilation Run generation before AssignTargetPaths, retaining the CoreCompile hook for direct invocations. Avoid touching identical XML so the added embedded resource does not force no-op recompilation. The real SDK PublishTrimmed control now removes metadata only when substitutions are enabled. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Exercise concurrent SDK builds on Linux and Windows Retain real SDK task-loading and routing probes, MP/MT parity and concurrency checks, incremental no-ops, isolated failures, and enabled/disabled trimmed-publish controls. Add explicit informational canaries without weakening the required Linux job. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Enable multithreaded MSBuild in existing SDK CI jobs Use the existing Arcade opt-in and native SDK switch instead of extra jobs or a new global setting. Require SDK MP/MT integration in Linux and Windows EndToEndBuildTests. Keep MP controls explicit even when CI centrally enables MT. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Link multithreaded task release notes to the draft PR Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Keep metadata embedding activation out of the MT migration Restore the existing target ordering without undoing resource registration or task environment changes. Retain all four real SDK publishes and assert their baseline metadata behavior rather than activating an unrelated linker change. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 * Exercise Fsc and Fsi compiler callbacks in isolated environments Invoke the HostObject compiler delegate with relative executable paths and task-specific environments. Check child I/O, process-path normalization and both successful and nonzero exits. Removing ExecuteTool normalization fails all four cases. Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 --------- Co-authored-by: perf-bundle <perf@local> Co-authored-by: Copilot App <[email protected]> Copilot-Session: af4e3e43-3404-456d-bbe6-dad204950074 Copilot-Session: 378abfca-7dca-4612-9f0e-932807f85dec Copilot-Session: 50c9b6ff-7645-415f-85e5-e59e3b4d0120
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use MSBuild's per-task environment so concurrent SDK builds do not share working-directory or environment state. Enable MT in existing SDK CI jobs, with required MP/MT end-to-end coverage.