[8.0.0] Allow implicit creation of input files within a macro's namespace #24077
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.
Recent experience with symbolic macro migration showed that we need to relax the restrictions on the implicit creation of input files.
Previously it was an error to refer to a non-existent target
"foo_input"
if there happened to be a symbolic macro named"foo"
in the package. The rationale was that we don't want to have to evaluatefoo
just to decide whether or notfoo_input
is in fact anInputFile
.But this restriction means that the common idiom:
blocks
bzl_library
from being a symbolic macro (e.g. wrapping the underlying rule). We believe this will be a common blocker well beyond this one example.Therefore, we will now only block the implicit creation of input files when they collide exactly with a target or macro, and not when they merely fall within a macro's namespace.
A consequence of this design change is that it complicates how input files are handled when we have lazy macro evaluation. But we'll deal with that when the time comes.
Package.java
createAssumedInputFiles()
andmaybeCreateAssumedInput()
. Update check in the latter to only care about exact matches of macro names.TargetRecorder.java
PackageFactoryTest.java
Fixes #24064.
PiperOrigin-RevId: 689374256
Change-Id: I218338af9f9638e1ec03c34e57e7c9f6e10beaaa
Commit 2d4c8eb