-
Notifications
You must be signed in to change notification settings - Fork 4k
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
native.existing_rules in BUILD files #7496
Comments
I think 2 is better. The rules for which names appear in which environments are too complex. |
I agree with alan. I'm for (2). |
Filed #7513 to track the removal of |
This is blocking #7513. |
BTW, it's not really documented anywhere but it seems more than a coincidence that all the functions in the native module access or update the abstract state of the package associated with the current Starlark thread, which must be a BUILD-loading thread. This serves as a good criterion for what belongs in the native module, if you're ever tempted to add more things to it. (The package_name and repository_name functions could in principle be generalized to work for .bzl-loading threads too, since those two functions need access only to the label associated with the current thread, not an actual package, and all loading-phase threads have an associated label, used among other things to resolve load(":relative.bzl").) |
In general, when there's a global symbol in BUILD files (e.g.
cc_library
), we can use it from the bzl file with the native module (e.g.native.cc_library
).However:
native.cc_library
also works in BUILD files. I think we shouldn't expose the native module anymore in BUILD files.native.existing_rules
andnative.existing_rule
are the only two functions that are not exposed as global symbols in BUILD files.I see two possibilities:
existing_rules
will not be usable from BUILD files directly. This can be fine, as we don't want to encourage the use of this function. It was added as a workaround in macros.existing_rule
(s) as a global function in BUILD files. This is a bit more consistent.Note that the
existing_rule
(s) functions are poorly defined, have design issues, can lead to performance and maintenance issues. So we don't really want to encourage their use.(cc @c-parsons, @brandjon, @alandonovan)
The text was updated successfully, but these errors were encountered: