-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow write_source_file(s) to write source files to bazel packages outside of the target's package #717
feat: allow write_source_file(s) to write source files to bazel packages outside of the target's package #717
Conversation
c473cbd
to
305ed64
Compare
3362a9c
to
b1ef858
Compare
Will this not potentially add confusion to usage of this rule? |
The default behaviour is to not allow it and have the existence check so by default nothing changes. This allows some users to turn that check off and break the glass. The docstring updates to |
b1ef858
to
2c07db6
Compare
df0d490
to
ddf5807
Compare
It's minor enough I'm fine with this. But imo docs explaining the restriction is better then expanding the api, adding docs explaining the restriction and docs explaining the api to workaround the restriction 🤷♂️ Can't users just move the write-source rule to the directory it's writing to? |
I'm also curious about this. Does this ever solve a problem that can't be solved by just moving the rule invocation to another package? What is the experience like when the rule is invoked but the file doesn't exist yet? |
You can always add another write_source_file(s) target in the Bazel package you're writing to. With |
fdf8698
to
4f9fa14
Compare
…ges outside of the target's package
4f9fa14
to
c6205a8
Compare
…ges outside of the target's package (#717)
We've received requests for this feature a few times now with the latest one being here https://bazelbuild.slack.com/archives/C04281DTLH0/p1704883631739649.
The glob trick to check that the out file exists must be disabled by setting
check_that_out_file(s)_exists
toFalse
when writing to a different Bazel package. The trick doesn't work unless the out file is in the same Bazel package (glob's don't traverse into sub packages and can't look into sibling or parent packages).Type of change
For changes visible to end-users
write_source_files(s) can now write source files to Bazel packages outside of the target's package when you set
check_that_out_file(s)_exists
to False.Test plan