Skip to content
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

java_import should support add_opens and add_exports #19556

Closed
timothyg-stripe opened this issue Sep 18, 2023 · 2 comments
Closed

java_import should support add_opens and add_exports #19556

timothyg-stripe opened this issue Sep 18, 2023 · 2 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: feature request

Comments

@timothyg-stripe
Copy link
Contributor

timothyg-stripe commented Sep 18, 2023

Description of the feature request:

2217b13 adds support for add_opens and add_exports attributes to java_library, java_binary, and java_import. But java_import is left out.

java_import should support these attributes too.

Which category does this issue belong to?

Java Rules

What underlying problem are you trying to solve with this feature?

We currently use java_import to import the release jars for google-java-format, which require the following flags in order to run without warnings:

--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

We could work around this issue by adding a java_library wrapper, but this is inconvenient.

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

release 6.2.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@timothyg-stripe
Copy link
Contributor Author

cc @cushon

who wrote 2217b13

@iancha1992 iancha1992 added the team-Rules-Java Issues for Java rules label Sep 18, 2023
@hvadehra hvadehra added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Oct 5, 2023
@timothyg-stripe
Copy link
Contributor Author

@iancha1992 Can we backport #20035 to 7.0?

iancha1992 pushed a commit to iancha1992/bazel that referenced this issue Nov 17, 2023
This reduces the difference between `java_import` and other Java rules, like `java_library` and `java_binary`.

* Propagate `add_exports` and `add_opens` through `java_import`
* Add tests

Fixes bazelbuild#19556.

Closes bazelbuild#20035.

PiperOrigin-RevId: 582617247
Change-Id: I513536acd4994de36190a5d79c2e92ac3f3ccc66
timothyg-stripe added a commit to timothyg-stripe/bazel that referenced this issue Nov 18, 2023
This reduces the difference between `java_import` and other Java rules, like `java_library` and `java_binary`.

* Propagate `add_exports` and `add_opens` through `java_import`
* Add tests

Fixes bazelbuild#19556.

Closes bazelbuild#20035.

PiperOrigin-RevId: 582617247
Change-Id: I513536acd4994de36190a5d79c2e92ac3f3ccc66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants