[native_toolchain_c] Inject FileSystem for file system access - #3555
Open
Varadraj75 wants to merge 2 commits into
Open
[native_toolchain_c] Inject FileSystem for file system access#3555Varadraj75 wants to merge 2 commits into
Varadraj75 wants to merge 2 commits into
Conversation
Adds an optional fileSystem parameter alongside processManager on CBuilder, CLinker, CLibrary and ToolResolvingContext, defaulting to LocalFileSystem, and routes all file system access through it. Glob resolution switches to listFileSystem. Public APIs keep taking Uri, so nothing user-facing changes. Adds a unit test running CBuilder.run against a MemoryFileSystem and a FakeProcessManager, asserting the full command sequence and the outputs written to the fake file system, plus MemoryFileSystem tests for the path and install-location resolvers. Together with the ProcessManager work this completes the seam. Fixes: dart-lang#3072
Varadraj75
marked this pull request as draft
August 14, 2026 18:59
Varadraj75
marked this pull request as ready for review
August 14, 2026 19:01
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.
Description
Second half of the seam from #3072, following the merged ProcessManager work (#3531). Adds an optional
fileSystemparameter next toprocessManageronCBuilder.run,CLinker.run,CLibrary.build,CLibrary.link, andToolResolvingContext, defaulting toLocalFileSystem. All file system access in the package now goes throughpackage:file, with glob resolution switched tolistFileSystem. Public APIs keep takingUri, so nothing user-facing changes.As discussed on the issue, this is the combined PR with the end-to-end verification: a unit test runs
CBuilder.runwith aMemoryFileSystemand aFakeProcessManager, asserting the exact compiler invocations and the outputs written to the fake file system, with no real compiler and no real files. Also addsMemoryFileSystemtests forPathToolResolverandInstallLocationResolver. One caveat noted in the test:BuildInput.outputDirectory(package:hooks) hardcodesdart:io, so the shared output directory uses a real temp dir like the integration tests do; everything native_toolchain_c itself touches goes through the memory file system.Splitting the test suite into unit and integration directories is the follow-up.
Related Issues
Fixes #3072
PR Checklist
dart tool/ci.dart --alllocally and resolved all issues identified. This ensures the PR is formatted, has no lint errors, and ran all code generators. This applies to the packages part of the toplevelpubspec.yamlworkspace.CHANGELOG.mdfor the relevant packages. (Not needed for small changes such as doc typos).