Skip to content

Commit

Permalink
Add missing javax.annotation dependency
Browse files Browse the repository at this point in the history
Fixes bazelbuild#321.

Bazel/Dagger integration requires javax.annotation to be on the
classpath to generate @generated annotation.

Recent ErrorProne releases (started from 2.3.3) added new bug pattern:
RefersToDaggerCodegen that is flagging the code as invalid, as it
doesn't realize that the code is generated.

Due to this problem, a previous attemt to bump EP version in Bazel was
reverted. Fixing it would allow us to make another attempt to update
EP version in Bazel.

Test Plan:

A. Involved approach:

1. Bump EP version to 2.3.4
2. Conduct custom java tools release with new EP version
3. Consume custom java tools release in WORKSPACE
4. Try to bulid rule_kotlin would fail with RefersToDaggerCodegen error

B. Simple approach

1. Apply this patch
2. Build rules_kotlin
3. Confirm that this class:
   KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory
   is annotated with @generated annotation:

@generated(
    value = "dagger.internal.codegen.ComponentProcessor",
    comments = "https://dagger.dev"
)
@SuppressWarnings({
    "unchecked",
    "rawtypes"
})
public final class KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory
[...]
  • Loading branch information
davido committed May 1, 2020
1 parent dbf68b5 commit 3fb3973
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions kotlin/internal/repositories/setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def kt_configure():
"com.google.dagger:dagger:2.26",
"com.google.dagger:dagger-compiler:2.26",
"com.google.dagger:dagger-producers:2.26",
"javax.annotation:javax.annotation-api:1.3.2",
"javax.inject:javax.inject:1",
"org.pantsbuild:jarjar:1.7.2",
],
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/io/bazel/kotlin/builder/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ java_library(
"//third_party:dagger",
"@com_github_jetbrains_kotlin//:annotations",
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"@kotlin_rules_maven//:javax_annotation_javax_annotation_api",
"@kotlin_rules_maven//:javax_inject_javax_inject",
],
)

0 comments on commit 3fb3973

Please sign in to comment.