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

Upgrade error-prone to 2.3.3? #9286

Closed
dpursehouse opened this issue Aug 30, 2019 · 9 comments
Closed

Upgrade error-prone to 2.3.3? #9286

dpursehouse opened this issue Aug 30, 2019 · 9 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules

Comments

@dpursehouse
Copy link
Contributor

It looks like Bazel is still using 2.3.2 snapshot version. Any chance to upgrade to the latest 2.3.3 release?

@iirina iirina added team-Rules-Java Issues for Java rules P2 We'll consider working on this in future. (Assignee optional) labels Sep 3, 2019
@iirina iirina closed this as completed Oct 2, 2019
@iirina
Copy link
Contributor

iirina commented Oct 15, 2019

We had to revert the Error Prone upgrade. The new version includes new checks which break backwards compatibility for bazel 1.1. There are more details in #10023. The upgrade to Error Prone 2.3.3 has to be done under an incompatible change.

If someone wants to use Error Prone 2.3.3 before it becomes the default in Bazel they can do so by using the java_tools_javac11-v6.0 release:

Add the definition of http_archive for your OS to your WORKSPACE file:

http_archive(
    name = "remote_java_tools_linux",
    sha256 = "37acb8380b1dd6c31fd27a19bf3da821c9b02ee93c6163fce36f070a806516b5",
    urls = [
        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_linux-v6.0.zip",
        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_linux-v6.0.zip",
    ],
)

http_archive(
    name = "remote_java_tools_windows",
    sha256 = "384e138ca58842ea563fb7efbe0cb9c5c381bd4de1f6a31f0256823325f81ccc",
    urls = [
        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_windows-v6.0.zip",
        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_windows-v6.0.zip",
    ],
)

http_archive(
    name = "remote_java_tools_darwin",
    sha256 = "5a9f320c33424262e505151dd5c6903e36678a0f0bbdaae67bcf07f41d8c7cf3",
    urls = [
        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_darwin-v6.0.zip",
        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_darwin-v6.0.zip",
    ],
)

and set the toolchain on the command line, for example:

--java_toolchain=@remote_java_tools_linux//:toolchain

@iirina iirina reopened this Oct 15, 2019
@cushon
Copy link
Contributor

cushon commented Oct 15, 2019

Is there are a repro for #10023? It's hard to tell from the error message if that's a bug in the kt rules, or dagger, or error prone.

The RefersToDaggerCodegen check uses @Generated annotations to distinguish whether code was generated by dagger or handwritten. It's possible the annotations could be missing in code using a version of dagger that predates google/auto@0383c1c and google/dagger@5c9063f.

ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ecf942666dab041fc60b1286a219db3e/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/BUILD:34:1: Couldn't build file external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/libbuilder.jar: Building external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/libbuilder.jar (2 source files) and running annotation processors (ComponentProcessor) failed (Exit 1)
--
  | bazel-out/host/bin/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/_javac/builder/libbuilder_sourcegenfiles/io/bazel/kotlin/builder/KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory.java:23: error: [RefersToDaggerCodegen] Don't refer to Dagger's internal or generated code
  | return providePluginArgEncoder(module, toolchainProvider.get());
  | ^

@dpursehouse
Copy link
Contributor Author

It looks like #10023 was closed. Does that mean the error prone upgrade can go ahead now?

@davido
Copy link
Contributor

davido commented Oct 21, 2019

As pointed out by @iirina, the root cause for the downstream build failures tracked in #10023:

  | bazel-out/host/bin/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/_javac/builder/libbuilder_sourcegenfiles/io/bazel/kotlin/builder/KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory.java:23: error: [RefersToDaggerCodegen] Don't refer to Dagger's internal or generated code
  | return providePluginArgEncoder(module, toolchainProvider.get());
  | ^
  | (see https://errorprone.info/bugpattern/RefersToDaggerCodegen)

was java_tools upgrade of EP to 2.3.3, this issue. The new version introduced new checks, that broke existing code. Thta why the idea was to do it with --incompatible-error-prone-upgrade-to-2.3.3 option. But this is not implemented yet, that why this issue is still open.

What is unclear to me: would it mean to select different java_tools release or one and the same java-tools release would include different EP versions (2.3.2 & 2.3.3)?

@dpursehouse
Copy link
Contributor Author

error_prone is now at 2.3.4

Is there any chance to move forward?

@davido
Copy link
Contributor

davido commented Apr 30, 2020

Is there any chance to move forward?

#11271 (Update error Prone version to 2.3.4).

@dpursehouse
Copy link
Contributor Author

Superseded by #11271

@davido
Copy link
Contributor

davido commented May 1, 2020

Superseded by #11271

Well, this is a PR, that references this issue.

@davido
Copy link
Contributor

davido commented May 1, 2020

I wrote this follow-up issue: #11272.

davido added a commit to davido/bazel that referenced this issue May 14, 2020
Fixes bazelbuild#11272 (first attempt that was reverted: bazelbuild#9286).
davido added a commit to davido/bazel that referenced this issue May 17, 2020
Fixes bazelbuild#11272 (first attempt that was reverted: bazelbuild#9286).
davido added a commit to davido/bazel that referenced this issue May 27, 2020
Fixes bazelbuild#11272 (first attempt that was reverted: bazelbuild#9286).
davido added a commit to davido/bazel that referenced this issue Jun 2, 2020
Fixes bazelbuild#11272 (first attempt that was reverted: bazelbuild#9286).
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants