Skip to content

Commit 79b1b2f

Browse files
danysantiagoDagger Team
authored andcommitted
Bump androidx.annotation:annotation for Dagger/Hilt androidx deps and remove explicit dep of the -jvm variant.
Fixes #4917 RELNOTES=Removes the explicit dependency to androidx.annotation:annotation-jvm and to a beta version of it. PiperOrigin-RevId: 795514434
1 parent 57a439b commit 79b1b2f

File tree

8 files changed

+21
-13
lines changed

8 files changed

+21
-13
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
9797

9898
maven.install(
9999
artifacts = [
100-
"androidx.annotation:annotation:1.1.0",
100+
"androidx.annotation:annotation:1.7.0",
101101
"androidx.annotation:annotation-experimental:1.3.1",
102102
"androidx.appcompat:appcompat:1.3.1",
103103
"androidx.activity:activity:1.5.1",

dagger-android-support/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ gen_maven_artifact(
3434
artifact_target_maven_deps = [
3535
"androidx.activity:activity:aar",
3636
"androidx.annotation:annotation",
37-
"androidx.annotation:annotation-jvm",
3837
"androidx.appcompat:appcompat:aar",
3938
"androidx.fragment:fragment:aar",
4039
"androidx.lifecycle:lifecycle-common",

dagger-android/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ gen_maven_artifact(
3333
artifact_target = "//dagger-android/main/java/dagger/android:android",
3434
artifact_target_maven_deps = [
3535
"androidx.annotation:annotation",
36-
"androidx.annotation:annotation-jvm",
3736
"com.google.dagger:dagger",
3837
"com.google.dagger:dagger-lint-aar",
3938
],

hilt-android-testing/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ gen_maven_artifact(
9090
artifact_target_maven_deps = [
9191
"androidx.activity:activity:aar",
9292
"androidx.annotation:annotation",
93-
"androidx.annotation:annotation-jvm",
9493
"androidx.annotation:annotation-experimental:aar",
9594
"androidx.fragment:fragment:aar",
9695
"androidx.lifecycle:lifecycle-common",

hilt-android/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ gen_maven_artifact(
108108
artifact_target_maven_deps = [
109109
"androidx.activity:activity:aar",
110110
"androidx.annotation:annotation",
111-
"androidx.annotation:annotation-jvm",
112111
"androidx.annotation:annotation-experimental:aar",
113112
"androidx.fragment:fragment:aar",
114113
"androidx.lifecycle:lifecycle-common",

maven_install.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
3-
"__INPUT_ARTIFACTS_HASH": 1584493936,
4-
"__RESOLVED_ARTIFACTS_HASH": 555303871,
3+
"__INPUT_ARTIFACTS_HASH": -1514565718,
4+
"__RESOLVED_ARTIFACTS_HASH": -1153075347,
55
"conflict_resolution": {
6-
"androidx.annotation:annotation:1.1.0": "androidx.annotation:annotation:1.7.0-beta01",
76
"androidx.test:monitor:1.4.0": "androidx.test:monitor:1.7.2",
87
"com.google.auto.value:auto-value-annotations:1.9": "com.google.auto.value:auto-value-annotations:1.11.0",
98
"com.google.code.findbugs:jsr305:3.0.1": "com.google.code.findbugs:jsr305:3.0.2",
@@ -51,7 +50,7 @@
5150
"shasums": {
5251
"jar": "b11676837cad011a5285d6074418649107ef25eba17131517e9557ef8c9984ed"
5352
},
54-
"version": "1.7.0-beta01"
53+
"version": "1.7.0"
5554
},
5655
"androidx.annotation:annotation-experimental:aar": {
5756
"shasums": {
@@ -63,7 +62,7 @@
6362
"shasums": {
6463
"jar": "e36b8e4b8393a4adc74e3d4ab22ad5a36396f0cea2e40b5734eae14937dfd224"
6564
},
66-
"version": "1.7.0-beta01"
65+
"version": "1.7.0"
6766
},
6867
"androidx.appcompat:appcompat-resources:aar": {
6968
"shasums": {

third_party/java/androidx/annotation/BUILD

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ load("@rules_java//java:defs.bzl", "java_library")
1818

1919
package(default_visibility = ["//:src"])
2020

21+
# Alias target for androidx.annotation
22+
# Ideally libraries could directly depend on @maven//:androidx_annotation_annotation but:
23+
# 1. Directly depending on annotation doesn't work since it contains no classes,
24+
# and results in missing symbol errors.'
25+
# 2. Directly depending on annotation-jvm doesn't work since that can result in
26+
# duplicate class errors when transitive dependencies depend on older versions
27+
# of androidx.annotation
2128
java_library(
2229
name = "annotation",
23-
# TODO(bcorso): Why do we need both of these?
2430
exports = [
2531
"@maven//:androidx_annotation_annotation",
2632
"@maven//:androidx_annotation_annotation_jvm",

tools/maven/maven.bzl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ SHADED_MAVEN_DEPS = [
2525
"com.squareup:kotlinpoet-javapoet",
2626
]
2727

28+
EXCLUDED_MAVEN_DEPS = SHADED_MAVEN_DEPS + [
29+
# Due to androidx.annotation:annotation being a redirtect to androidx.annotation:annotation-jvm,
30+
# we exclude the transitive dep during validation as it will be required because the alias in
31+
# third_party/java/androidx/annotation/BUILD.oss exports both.
32+
"androidx.annotation:annotation-jvm",
33+
]
34+
2835
def dagger_pom_file(name, targets, artifact_name, artifact_id, packaging = None, **kwargs):
2936
pom_file(
3037
name = name,
@@ -337,8 +344,8 @@ def _validate_maven_deps_impl(ctx):
337344
actual_maven_deps = [_strip_artifact_version(artifact) for artifact in maven_nearest_artifacts]
338345
_validate_list(
339346
"artifact_target_maven_deps",
340-
# Exclude shaded maven deps from this list since they're not actual dependencies.
341-
[dep for dep in actual_maven_deps if dep not in SHADED_MAVEN_DEPS],
347+
# Exclude certain maven deps (such as shaded deps since they're not actual dependencies).
348+
[dep for dep in actual_maven_deps if dep not in EXCLUDED_MAVEN_DEPS],
342349
expected_maven_deps,
343350
ctx.attr.banned_maven_deps,
344351
)

0 commit comments

Comments
 (0)