fix(tfm_filegroup): always create _default target referenced by select() - #552
Open
brainoreally wants to merge 2 commits into
Open
fix(tfm_filegroup): always create _default target referenced by select()#552brainoreally wants to merge 2 commits into
brainoreally wants to merge 2 commits into
Conversation
tfm_filegroup() unconditionally references :<name>_default in select() defaults, but only created it when default_to_empty=True. This causes "missing input file" errors when analyzing targets with //... or in multi-platform configurations where no TFM condition matches and the default case is evaluated. Making _default unconditional fixes the bug with no semantic change — it's an empty filegroup that serves as a safe fallback. Related: bazel-contrib#448
After making _default unconditional, default_to_empty was no longer used in tfm_filegroup(). Also removes it from _create_framework_select since it was only ever used to pass it along to tfm_filegroup().
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.
Problem
tfm_filegroup() unconditionally references :_default as the //conditions:default fallback in multiple select() calls, but only created that target when default_to_empty=True. This causes "missing input file" errors when:
Root Cause
In nuget_archive.bzl, the _default empty filegroup was wrapped in:
However, default_to_empty=False is passed for libs and refs groups, yet their aliases still reference :_default unconditionally. The guard makes the fallback conditional while the references are not.
Fix
Remove the guard — always create _default regardless of default_to_empty.
This is safe because _default is always an empty filegroup (srcs=[]), serving only as a no-op fallback. Making it unconditional:
Related
Verification
Verified locally via downstream project (bazel build //...) and will be exercised by repo CI.
Cc: @purkhusid for review — primary maintainer of the nuget code.