Skip to content

Commit f1acd72

Browse files
bcorsoDagger Team
authored andcommitted
Update robolectric dependencies.
Our bazel example projects was using an old version of `bazel-robolectric` (4.1) which referenced an obsolete repository for the robolectric jars `"https://repo1.maven.org/central"`: https://github.com/robolectric/robolectric-bazel/blob/4.1/bazel/robolectric.bzl#L7 The new repository we're supposed to use is `"https://repo1.maven.org/maven2"`, which is used by `bazel-robolectric` 4.4+, e.g.: https://github.com/robolectric/robolectric-bazel/blob/4.4/bazel/robolectric.bzl#L7 This CL updates `bazel-robolectric` and all robolectric deps to 4.11.1 so that everything is using the same version. In addition, the above changes ended up breaking other tests (e.g. https://github.com/google/dagger/actions/runs/10360876140/job/28680303187), due to robolectric/robolectric#6593, and required further updating espresso to `androidx.test.espresso:espresso-core:3.5.1`. RELNOTES=N/A PiperOrigin-RevId: 662367956
1 parent f397f6b commit f1acd72

File tree

10 files changed

+21
-18
lines changed

10 files changed

+21
-18
lines changed

examples/bazel/WORKSPACE

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ android_sdk_repository(
5151

5252
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5353

54+
ROBOLECTRIC_VERSION = "4.11.1"
55+
5456
http_archive(
5557
name = "robolectric",
56-
strip_prefix = "robolectric-bazel-4.1",
57-
urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.1.tar.gz"],
58+
sha256 = "1ea1cfe67848decf959316e80dd69af2bbaa359ae2195efe1366cbdf3e968356",
59+
strip_prefix = "robolectric-bazel-%s" % ROBOLECTRIC_VERSION,
60+
urls = ["https://github.com/robolectric/robolectric-bazel/releases/download/%s/robolectric-bazel-%s.tar.gz" % (ROBOLECTRIC_VERSION, ROBOLECTRIC_VERSION)],
5861
)
5962

6063
load("@robolectric//bazel:robolectric.bzl", "robolectric_repositories")
@@ -84,8 +87,8 @@ maven_install(
8487
"androidx.test:runner:1.1.1",
8588
"com.google.truth:truth:1.0.1",
8689
"junit:junit:4.13",
87-
"org.robolectric:robolectric:4.1",
88-
"org.robolectric:annotations:4.1",
90+
"org.robolectric:robolectric:%s" % ROBOLECTRIC_VERSION,
91+
"org.robolectric:annotations:%s" % ROBOLECTRIC_VERSION,
8992
],
9093
repositories = DAGGER_REPOSITORIES + HILT_ANDROID_REPOSITORIES,
9194
)

java/dagger/hilt/android/plugin/main/src/test/kotlin/IncrementalProcessorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class IncrementalProcessorTest(private val incapMode: String) {
183183
testImplementation 'junit:junit:4.12'
184184
testImplementation 'androidx.test.ext:junit:1.1.3'
185185
testImplementation 'androidx.test:runner:1.4.0'
186-
testImplementation 'org.robolectric:robolectric:4.4'
186+
testImplementation 'org.robolectric:robolectric:4.11.1'
187187
testImplementation 'com.google.dagger:hilt-android-testing:LOCAL-SNAPSHOT'
188188
testAnnotationProcessor 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT'
189189
}

javatests/artifacts/dagger-android/simple/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ dependencies {
5353
annotationProcessor 'com.google.dagger:dagger-android-processor:LOCAL-SNAPSHOT'
5454

5555
testImplementation 'com.google.truth:truth:1.0.1'
56-
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
56+
testImplementation 'org.robolectric:robolectric:4.11.1'
5757
testImplementation 'androidx.core:core:1.3.2'
5858
testImplementation 'androidx.test.ext:junit:1.1.3'
5959
testImplementation 'androidx.test:runner:1.4.0'
60-
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
60+
testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6161
testImplementation 'com.google.dagger:dagger-compiler:LOCAL-SNAPSHOT'
6262
testAnnotationProcessor 'com.google.dagger:dagger-android-processor:LOCAL-SNAPSHOT'
6363

6464
androidTestImplementation 'com.google.truth:truth:1.0.1'
6565
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
6666
androidTestImplementation 'androidx.test:runner:1.4.0'
67-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
67+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6868
androidTestImplementation 'com.google.dagger:dagger-compiler:LOCAL-SNAPSHOT'
6969
androidTestAnnotationProcessor 'com.google.dagger:dagger-android-processor:LOCAL-SNAPSHOT'
7070

javatests/artifacts/dagger/lazyclasskey/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies {
5656
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
5757
androidTestImplementation "androidx.test:runner:1.5.2"
5858
androidTestImplementation "androidx.test:rules:1.5.0"
59-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
59+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6060

6161
// Dagger dependencies
6262
implementation "com.google.dagger:dagger:$dagger_version"

javatests/artifacts/hilt-android/lazyclasskey/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies {
5757
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
5858
androidTestImplementation "androidx.test:runner:1.5.2"
5959
androidTestImplementation "androidx.test:rules:1.5.0"
60-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6161

6262
// Hilt dependencies
6363
implementation "com.google.dagger:hilt-android:$hilt_version"

javatests/artifacts/hilt-android/simple/app-java-only/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ dependencies {
6161

6262
testImplementation 'com.google.truth:truth:1.0.1'
6363
testImplementation 'junit:junit:4.13'
64-
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
64+
testImplementation 'org.robolectric:robolectric:4.11.1'
6565
testImplementation 'androidx.core:core:1.3.2'
6666
testImplementation 'androidx.test.ext:junit:1.1.3'
6767
testImplementation 'androidx.test:runner:1.4.0'
68-
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
68+
testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6969
}

javatests/artifacts/hilt-android/simple/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ dependencies {
108108

109109
testImplementation 'com.google.truth:truth:1.0.1'
110110
testImplementation 'junit:junit:4.13'
111-
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
111+
testImplementation 'org.robolectric:robolectric:4.11.1'
112112
testImplementation 'androidx.core:core:1.3.2'
113113
testImplementation 'androidx.test.ext:junit:1.1.3'
114114
testImplementation 'androidx.test:runner:1.4.0'
115-
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
115+
testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
116116
testImplementation "com.google.dagger:hilt-android-testing:$dagger_version"
117117
testAnnotationProcessor "com.google.dagger:hilt-compiler:$dagger_version"
118118

119119
androidTestImplementation 'com.google.truth:truth:1.0.1'
120120
androidTestImplementation 'junit:junit:4.13'
121121
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
122122
androidTestImplementation 'androidx.test:runner:1.4.0'
123-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
123+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
124124
androidTestImplementation "com.google.dagger:hilt-android-testing:$dagger_version"
125125
androidTestAnnotationProcessor "com.google.dagger:hilt-compiler:$dagger_version"
126126

javatests/artifacts/hilt-android/simple/earlyentrypoint/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ dependencies {
5959

6060
testImplementation 'com.google.truth:truth:1.0.1'
6161
testImplementation 'junit:junit:4.13'
62-
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
62+
testImplementation 'org.robolectric:robolectric:4.11.1'
6363
testImplementation 'androidx.core:core:1.3.2'
6464
testImplementation 'androidx.test.ext:junit:1.1.3'
6565
testImplementation 'androidx.test:runner:1.4.0'

javatests/artifacts/hilt-android/simpleKotlin/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ dependencies {
9999
testImplementation 'androidx.test:runner:1.4.0'
100100
testImplementation 'com.google.truth:truth:1.0.1'
101101
testImplementation 'junit:junit:4.13'
102-
testImplementation 'org.robolectric:robolectric:4.5-alpha-3'
102+
testImplementation 'org.robolectric:robolectric:4.11.1'
103103
testImplementation 'androidx.core:core:1.3.2'
104104
// TODO(bcorso): This multidex dep shouldn't be required -- it's a dep for the generated code.
105105
testImplementation 'androidx.multidex:multidex:2.0.0'

javatests/artifacts/hilt-android/viewmodel/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies {
5757
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
5858
androidTestImplementation "androidx.test:runner:1.5.2"
5959
androidTestImplementation "androidx.test:rules:1.5.0"
60-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6161

6262
// Hilt dependencies
6363
implementation "com.google.dagger:hilt-android:$hilt_version"

0 commit comments

Comments
 (0)