Hey there,
How to go about requiring mandatory load() statements for built-in rules in BUILD files?
We eventually want to have all our rules in Starlark and loading all rules that are now built into Bazel (cc_*, java_*, sh_*, etc.) is a precondition to that. Unfortunately, it's also a pretty intrusive change, requiring changes to every BUILD file.
We already have --incompatible_* flags for Java and C++ (--incompatible_load_{java,cc}_rules_from_bzl}, flipping which would be very destructive at the moment. What next?
We could provide a tool that updates all BUILD files in a repository (and maybe integrate it into Buildifier), announce a release to flip the flags, then flip them as planned and do it for every built-in rule at the same time to minimize the pain. Alternatively, we could do a test run with a moderately used rule first (e.g. proto_library) to see where the rough spots are, although that would require *two* incompatible releases instead of one.
If this absolutely does not work, we could in theory "pretend" that these .bzl files are loaded for every BUILD file just like we "pretend" that some repositories are declared in WORKSPACE files, although that would be somewhat sad because then these rules would need to be special forever.
--
Lukács T. Berki | Software Engineer | lbe...@google.com | Google Germany GmbH | Erika-Mann-Str. 33 | 80636 München | Germany | Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891