-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Bazel team would like to rewrite all rules that are part of Java to Starlark. We're making good progress, but this could be even faster with contributions from the community.
java_import
rule is a good "medium" difficulty rule to rewrite to Starlark by the community. Some previous experience in Starlark, previous PRs are probably needed. This is not a good starter project. Bazel team can provide support on ambiguous problems and solutions, however our time is limited and we can't help with everything.
There are other "medium" difficulty rules to rewrite: java_runtime
, java_package_configuration
or java_toolchain
. Each of them contains something tricky - the code is shorted, but probably also not a good starter project without previously agreeing on how to solve tricky part.
Instructions:
- rewrite to Starlark
JavaImport
,JavaImportBaseRule
,BazelJavaImportBaseRule
classes (and their dependencies) - use builtin
bzl
files, see examples of already Starlarkfied rules, follow the style ofjava_library.bzl
implementation - test the rule by enabling it temporarily in
exports.bzl
- make the final PR without the rule exported (additional tests and benchmark will be done by Bazel team)
- make the first rewrite as close to the native rule as possible (to have the tests pass)
- ensure your place in Starlarkification hall of fame!
Details:
semantics.checkRule
can be removed, Bazel's implementation is noop- JavaConfiguration.getUseIjar, JavaToolchainProvider.getIJar can be exposed to builtins only (not Starlark) - see checkPrivateAccess
- Starlarkify
ijar_action
- Starlarkify
import_deps_check_action
- Reuse collectProguardSpecs
- return
JavaInfo
created withJavaInfo
constructor (it might needs extensions - be conservative)