-
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
Restricting package_group in java_package_configuration doesn't have the desired effect #6010
Comments
|
So, the relevant rule in
And
So, I think you are right, the fact that grammar file was built under different Bazel package ( So I guess we cannot do anything here. |
OK, I figured out how to fix that: |
In I75d6bc4d7a antlr3 grammar sources were moved from gerrit-antlr package, but the java_library rule query_parser were missed to also be moved to antlr3 package. This is very unusual in Bazel toolchain to keep the sources in one package and build them in another. This leads to a problem: restricting package_group in java_package_configuration doesn't lead to the desired effect, as discussed in this issue: [1]. Moving the query_parser rule to the antlr3 package harmonize the location of the java_library rule to the same package where the sources are located and it also fixes the problem, that error prone warnings are not reported any more for the antlr3 grammar source in new toolchain, that doesn't list antlr3 in the package_group. ntlr3 grammar code is generated code and we would rather avoid reporting any issues in that code. [1] bazelbuild/bazel#6010 Change-Id: Iff32b6133ff7bf3f045a20fcb635d690d76e3b89
@cushon Has something changed on Bazel@HEAD (8f0d73a)? Trying to replicate the EP warnings, with my custom toolchain from https://gerrit-review.googlesource.com/c/gerrit/+/194045 that was merged in gerrit, i'm first getting this error:
And after fixing it as suggested: diff --git a/tools/BUILD b/tools/BUILD
index 53f441a37b..cd5e77d43f 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -44,7 +44,7 @@ default_java_toolchain(
default_java_toolchain(
name = "error_prone_warnings_toolchain",
- bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
+ bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath8.jar"],
package_configuration = [
":error_prone",
], And running build with custom toolchain, I only see a couple of EP warning, with all warnings activated, while previously I've seen dozen or even hundreds of warnings. |
I can confirm, that when building gerrit master with Bazel 0.16.1 release, I'm getting dozen of EP warnings: [1]:
And when building from Bazel@HEAD: I only getting very few EP warnings on exactly the same gerrit code (with the amended bootclasspath to
Any clue what is going on here? |
I think it's related to revert of JDK10 javac in 12dcd35. If I revert this change on bazel@HEAD, I see all warnings as in 0.16.1. |
I'll respond in #6077, thanks for raising this issue. |
@cushon Somehow our custom error prone Even with Bazel 0.17.1 with this diff on gerrit master: diff --git a/tools/BUILD b/tools/BUILD
index 73ecfb92b5..19b950758d 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -44,7 +44,7 @@ default_java_toolchain(
default_java_toolchain(
name = "error_prone_warnings_toolchain",
- bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
+ bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath9.jar"],
package_configuration = [
":error_prone",
], I'm getting this:
And when trying the same on Bazel@HEAD (fdfe0f1):
Any clue? |
I think I figured it out: jvm_opts were missing:
But why are we getting such a scare error message? |
The JDK 8 JVM flags include |
Thanks for clarifying. I think what is not really obvious is that |
I agree: 808ec9f#diff-a430a0f3acbf77bcbe5488892ad884c7R74 This will get cleaned up once 7eb9ea1 is rolled forward. |
On most recent Bazel@HEAD (2894b30) trying to restrict custom toolchain declaration on specific packages, doesn't actually work. Even though we provide:
Error prone warnings are still reported from
antlr3/com/google/gerrit/index/query/QueryLexer.java
as well. These are generated sources and we don't want to see anything reported for them. Is there any other means to silence EP reports from generated sources?Reproducer: https://gerrit-review.googlesource.com/c/gerrit/+/194045
//CC @cushon
The text was updated successfully, but these errors were encountered: