Repository navigation
Propagate transitive Swift and Clang module inputs as depsets - #1977
Open
brentleyjones wants to merge 2 commits into
Open
brentleyjones wants to merge 2 commits into
brentleyjones wants to merge 2 commits into
Conversation
brentleyjones
marked this pull request as ready for review
October 23, 2026 13:44
brentleyjones
requested review from
aaronsky,
adincebic,
keith and
luispadron
as code owners
October 23, 2026 13:44
adincebic
reviewed
Oct 23, 2026
| for module_context in plugin_module_contexts: | ||
| if module_context.swift and module_context.swift.plugins: | ||
| used_plugins.extend(module_context.swift.plugins) | ||
| compiler_plugins = depset( |
Contributor
There was a problem hiding this comment.
Hmm seems that ordering changes here? Should we preserve the order? I'm not sure how much it matters in practice though.
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.
Swift compilation repeatedly walks transitive module contexts to collect dependency artifacts for each action. Large dependency graphs pay for those traversals at every consuming target.
Propagate Swift artifacts, Clang module maps, headers, precompiled modules, and compiler plugins through depsets on
SwiftInfo. Compilation, interface synthesis, and symbol graph extraction reuse those inputs, while command-line mappings stay lazy until Bazel expands them. This preserves explicit-module metadata inputs, header pruning, mixed-language inputs, and the option to load plugins only from direct dependencies.Performance measurements (August 18, 2026):
On macOS with Bazel 9.1.1rc1, analyzing 1,491 lint-test targets in a large iOS workspace with
bazel build --nobuild, runningbazel cleanbetween samples while retaining the Bazel server:The individual baseline wall times were 20.84s and 19.47s; sampled Starlark CPU was 118.19s and 127.04s. CPU samples come from
--starlark_cpu_profileand aggregate work across analysis threads. These results measure reanalysis, with no compilation actions executed.The measurements compare the original implementation against
391e7a170c9c1b8d2065e0de4ec4fc6b954057f1. This PR adapts that implementation to newer upstream code; these performance measurements have not been rerun on the current PR revision.Validation:
test/fixtures/layering_check/layering_check_failure_test.shpassed with Bazel 9.3.1 and Xcode 27.0, covering undeclared imports and unused dependencies. Lazy module mappings preserve the existing//package:targetspelling for main-repository labels in diagnostics.bazel run //doc:update.buildifier -mode=check -lint=warnpassed for the changed Starlark files.Two build tests could not complete under Xcode 27.0 (
27A266a)://test:precompiled_modules_build_testand//test:layering_check_apple_build_test. The Swift frontend crashes with signal 11 while compilinglower_version_binandfoundation_consumer. Both crashes reproduce on unmodifiedmainat48869a9da892c44f9e62c754c7235ea4c6a2cede.