Skip to content

Commit

Permalink
Clarify why RunfilesLibraryUsersProvider is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 10, 2022
1 parent b9da915 commit 97bd4b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions designs/2022-07-21-locating-runfiles-with-bzlmod.md
Expand Up @@ -154,9 +154,8 @@ If a module `other_module` depends on `my_module` and contains a target that dep

### Implementation details

- Add a new field to `RunfilesProvider` to track the `RepositoryName` and `RepositoryMapping` of transitive dependencies of a given target that directly depend on a runfiles library.
Alternatively, this information could be tracked by a new provider that is only added if needed.
The latter may perform better with respect to memory consumption as most targets in a build will not transitively depend on a runfiles library.
- Add a new internal `RunfilesLibraryUsersProvider` to track the `RepositoryName` and `RepositoryMapping` of transitive dependencies of a given target that directly depend on a runfiles library.
Adding a new provider is preferred over adding fields on e.g. the existing `RunfilesProvider` since the latter is controlled by rule implementations, but even non-cooperating rules need to forward and augment the repository mapping information.
- In [`RuleConfiguredTargetBuilder#build()`], collect the `RunfilesLibraryUsersProvider` of all non-implicit, non-tool dependencies and add the `RepositoryName` and `RepositoryMapping` of the current target if any such dependency advertises `RunfilesLibraryInfo`.
This is very similar to the logic in [`InstrumentedFilesCollector#forwardAll`], which forwards information about source files instrumented for coverage without requiring every rule implementation to cooperate.
- Pass the `RepositoryMapping`s to `RunfilesSupport` and let it register a new action that writes the repository mapping manifest for only those repositories that are actually contributing runfiles.
Expand Down

0 comments on commit 97bd4b1

Please sign in to comment.