Add support for add_exports/add_opens#1551
Add support for add_exports/add_opens#1551timothyg-stripe wants to merge 1 commit intobazel-contrib:masterfrom
Conversation
5fa31f2 to
98f2e00
Compare
98f2e00 to
7b1d93d
Compare
|
I managed to get a passing build with this PR, but it's a bit unfortunate since it would force users to add some additional lines to their WORKSPACE file.
The sum effect of this is that users must have http_archive(
name = "bazel_features",
sha256 = "d7787da289a7fb497352211ad200ec9f698822a9e0757a4976fd9f713ff372b3",
strip_prefix = "bazel_features-1.9.1",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.1/bazel_features-v1.9.1.tar.gz",
)
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()in the WORKSPACE file before loading anything from I think there are three options:
I think option 2 seems most straightforward, though I'll leave it up to the maintainers to decide. |
|
Hi, @timothyg-stripe, so this feature can be enabled only for bazel 7 and up. Could this be done with skylib versions? |
|
@simuons unfortunately, skylib versions isn't sufficient since |
I'm happy to write some tests for this, but existing tests appear to be broken in CI, and much of the functionality requires Bazel 7.0.0 to work anyway (while CI is still on Bazel 6.3).
Description
scala_binary,scala_test, and friends, readjava_info.module_flags_infoand include those--add-exportsand--add-opensJVM flags in the launcher script.add_exportsandadd_opensattributes to all rules (includingscala_import) and propagate the flags throughJavaInfo.JavaInfoconstructor only added this functionality in 7.0.0; see User-accessible JavaInfo constructor doesn't allow changing module_flags_info bazelbuild/bazel#20033.Motivation
JDK 17 strongly encapsulates JDK internals, so many libraries need
--add-exports=and--add-opens=JVM flags to run. Bazel's Java rules already support adding those flags throughjava_library(add_opens = [...], add_exports = [...]), and these fields are read in Bazel'sjava_binaryrule. This PR adds the same functionality to Scala rules.Fixes #1523