Update Dagger & Hilt to 2.29.1 (and 2.29.1-alpha)
Test: ./gradlew bOS
Relnote: n/a
Change-Id: I2b4f45e346c9a38e2dbde26d0cd17c330bf9f05a
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 968da01..0a2cf1c4 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -77,7 +77,7 @@
cacheableImplementation "org.anarres.jarjar:jarjar-gradle:1.0.1"
// dependencies that aren't used by buildSrc directly but that we resolve here so that the
// root project doesn't need to re-resolve them and their dependencies on every build
- cacheableRuntime "com.google.dagger:hilt-android-gradle-plugin:DEV-SNAPSHOT"
+ cacheableRuntime build_libs.hilt_plugin
// dependencies whose resolutions we don't need to cache
compileOnly(findGradleKotlinDsl()) // Only one file in this configuration, no need to cache it
implementation project("jetpad-integration") // Doesn't have a .pom, so not slow to load
diff --git a/buildSrc/build_dependencies.gradle b/buildSrc/build_dependencies.gradle
index a9a02f3..2a729df 100644
--- a/buildSrc/build_dependencies.gradle
+++ b/buildSrc/build_dependencies.gradle
@@ -25,6 +25,8 @@
build_versions.kotlin = "1.4.0"
build_versions.kotlin_coroutines = "1.3.9"
+build_versions.hilt = "2.29.1-alpha"
+
def agpOverride = System.getenv("GRADLE_PLUGIN_VERSION")
if (agpOverride != null) {
logger.warn("Using custom version ${agpOverride} of AGP due to GRADLE_PLUGIN_VERSION being set.")
@@ -69,4 +71,6 @@
]
build_libs.kotlinpoet = "com.squareup:kotlinpoet:1.4.0"
+build_libs.hilt_plugin = "com.google.dagger:hilt-android-gradle-plugin:${build_versions.hilt}"
+
rootProject.ext['build_libs'] = build_libs
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
index 54598a6..f8b80c4 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
@@ -230,6 +230,7 @@
androidx.build.dependencies.kotlinCoroutinesVersion = getVersion("kotlin_coroutines")
androidx.build.dependencies.agpVersion = getVersion("agp")
androidx.build.dependencies.lintVersion = getVersion("lint")
+ androidx.build.dependencies.hiltVersion = getVersion("hilt")
}
companion object {
diff --git a/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt b/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
index d0d836c..bc3eff6 100644
--- a/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
@@ -36,8 +36,8 @@
const val CHECKER_FRAMEWORK = "org.checkerframework:checker-qual:2.5.3"
const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:1.1.0@aar"
const val CONSTRAINT_LAYOUT_CORE = "androidx.constraintlayout:constraintlayout-core:1.0.0-alpha1"
-const val DAGGER = "com.google.dagger:dagger:2.28"
-const val DAGGER_COMPILER = "com.google.dagger:dagger-compiler:2.28"
+const val DAGGER = "com.google.dagger:dagger:2.29.1"
+const val DAGGER_COMPILER = "com.google.dagger:dagger-compiler:2.29.1"
const val DEXMAKER_MOCKITO = "com.linkedin.dexmaker:dexmaker-mockito:2.25.0"
const val ESPRESSO_CONTRIB = "androidx.test.espresso:espresso-contrib:3.3.0"
const val ESPRESSO_CORE = "androidx.test.espresso:espresso-core:3.3.0"
@@ -56,10 +56,12 @@
const val GUAVA_LISTENABLE_FUTURE = "com.google.guava:listenablefuture:1.0"
const val GRADLE_INCAP_HELPER = "net.ltgt.gradle.incap:incap:0.2"
const val GRADLE_INCAP_HELPER_PROCESSOR = "net.ltgt.gradle.incap:incap-processor:0.2"
-const val HILT_ANDROID = "com.google.dagger:hilt-android:2.28.3-alpha"
-const val HILT_ANDROID_COMPILER = "com.google.dagger:hilt-android-compiler:2.28.3-alpha"
-const val HILT_ANDROID_TESTING = "com.google.dagger:hilt-android-testing:2.28.3-alpha"
-const val HILT_ANDROID_GRADLE_PLUGIN = "com.google.dagger:hilt-android-gradle-plugin:2.28.3-alpha"
+internal lateinit var hiltVersion: String
+val HILT_ANDROID get() = "com.google.dagger:hilt-android:$hiltVersion"
+val HILT_ANDROID_TESTING get() = "com.google.dagger:hilt-android-testing:$hiltVersion"
+val HILT_ANDROID_GRADLE_PLUGIN get() = "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
+val HILT_COMPILER get() = "com.google.dagger:hilt-compiler:$hiltVersion"
+val HILT_CORE get() = "com.google.dagger:hilt-core:$hiltVersion"
const val INTELLIJ_ANNOTATIONS = "com.intellij:annotations:12.0"
const val JAVAPOET = "com.squareup:javapoet:1.13.0"
const val JSQLPARSER = "com.github.jsqlparser:jsqlparser:3.1"
diff --git a/hilt/hilt-common/build.gradle b/hilt/hilt-common/build.gradle
index 8b6273a..8c6ee95 100644
--- a/hilt/hilt-common/build.gradle
+++ b/hilt/hilt-common/build.gradle
@@ -16,31 +16,18 @@
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.Publish
plugins {
id("AndroidXPlugin")
- id("com.android.library")
+ id("java-library")
}
dependencies {
- implementation(HILT_ANDROID)
- annotationProcessor(HILT_ANDROID_COMPILER)
-}
-
-android.libraryVariants.all { variant ->
- def name = variant.name
- def suffix = name.capitalize()
-
- // Create jar<variant> task for testImplementation in hilt-compiler.
- project.tasks.register("jar${suffix}", Jar).configure {
- dependsOn variant.javaCompileProvider
- from variant.javaCompileProvider.map { task -> task.destinationDir}
- destinationDir new File(project.buildDir, "libJar")
- }
+ implementation(HILT_CORE)
+ annotationProcessor(HILT_COMPILER)
}
androidx {
diff --git a/hilt/hilt-common/src/main/java/androidx/hilt/work/WorkerInject.java b/hilt/hilt-common/src/main/java/androidx/hilt/work/WorkerInject.java
index 9f6f735..7beca86 100644
--- a/hilt/hilt-common/src/main/java/androidx/hilt/work/WorkerInject.java
+++ b/hilt/hilt-common/src/main/java/androidx/hilt/work/WorkerInject.java
@@ -63,7 +63,7 @@
* dependencies. Both the {@code Context} and {@code WorkerParameters} must not be a type param
* of {@link javax.inject.Provider} nor {@link dagger.Lazy} and must not be qualified.
* <p>
- * Only dependencies available in the {@link dagger.hilt.android.components.ApplicationComponent}
+ * Only dependencies available in the {@link dagger.hilt.components.SingletonComponent}
* can be injected into the {@code Worker}.
*/
@Target(ElementType.CONSTRUCTOR)
diff --git a/hilt/hilt-compiler/build.gradle b/hilt/hilt-compiler/build.gradle
index f452650..7504c2e 100644
--- a/hilt/hilt-compiler/build.gradle
+++ b/hilt/hilt-compiler/build.gradle
@@ -40,14 +40,12 @@
implementation(AUTO_COMMON)
implementation(JAVAPOET)
+ testImplementation(project(":hilt:hilt-common"))
testImplementation(JUNIT)
testImplementation(TRUTH)
testImplementation(GOOGLE_COMPILE_TESTING)
testImplementation(HILT_ANDROID)
testImplementation fileTree(
- dir: "${new File(project(":hilt:hilt-common").buildDir, "libJar")}",
- include : "*.jar")
- testImplementation fileTree(
dir: "${new File(project(":hilt:hilt-lifecycle-viewmodel").buildDir, "libJar")}",
include : "*.jar")
testImplementation fileTree(
@@ -72,7 +70,6 @@
}
tasks.named("compileKotlin").configure {
- dependsOn(":hilt:hilt-common:jarDebug")
dependsOn(":hilt:hilt-lifecycle-viewmodel:jarDebug")
dependsOn(":hilt:hilt-work:jarDebug")
dependsOn(":hilt:hilt-compiler:extractHiltJar")
diff --git a/hilt/hilt-lifecycle-viewmodel/build.gradle b/hilt/hilt-lifecycle-viewmodel/build.gradle
index f5ca26a..7693f3f 100644
--- a/hilt/hilt-lifecycle-viewmodel/build.gradle
+++ b/hilt/hilt-lifecycle-viewmodel/build.gradle
@@ -38,7 +38,7 @@
api("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0")
implementation("androidx.activity:activity:1.1.0")
api(HILT_ANDROID)
- annotationProcessor(HILT_ANDROID_COMPILER)
+ annotationProcessor(HILT_COMPILER)
}
android.libraryVariants.all { variant ->
diff --git a/hilt/hilt-work/build.gradle b/hilt/hilt-work/build.gradle
index 0e60e98..0b595d7 100644
--- a/hilt/hilt-work/build.gradle
+++ b/hilt/hilt-work/build.gradle
@@ -37,7 +37,7 @@
api(project(":hilt:hilt-common"))
api("androidx.work:work-runtime:2.3.4")
api(HILT_ANDROID)
- annotationProcessor(HILT_ANDROID_COMPILER)
+ annotationProcessor(HILT_COMPILER)
}
android.libraryVariants.all { variant ->
diff --git a/hilt/integration-tests/viewmodelapp/build.gradle b/hilt/integration-tests/viewmodelapp/build.gradle
index 13c3c7b..b87e020 100644
--- a/hilt/integration-tests/viewmodelapp/build.gradle
+++ b/hilt/integration-tests/viewmodelapp/build.gradle
@@ -43,12 +43,12 @@
kapt(project(":hilt:hilt-compiler"))
implementation(KOTLIN_STDLIB)
implementation(HILT_ANDROID)
- kapt(HILT_ANDROID_COMPILER)
+ kapt(HILT_COMPILER)
androidTestImplementation(TRUTH)
androidTestImplementation(ANDROIDX_TEST_CORE)
androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
androidTestImplementation(ANDROIDX_TEST_RUNNER)
androidTestImplementation(HILT_ANDROID_TESTING)
- kaptAndroidTest(HILT_ANDROID_COMPILER)
+ kaptAndroidTest(HILT_COMPILER)
}
\ No newline at end of file
diff --git a/hilt/integration-tests/workerapp/build.gradle b/hilt/integration-tests/workerapp/build.gradle
index a6f2f1e..350b72d 100644
--- a/hilt/integration-tests/workerapp/build.gradle
+++ b/hilt/integration-tests/workerapp/build.gradle
@@ -46,7 +46,7 @@
kapt(project(":hilt:hilt-compiler"))
implementation(KOTLIN_STDLIB)
implementation(HILT_ANDROID)
- kapt(HILT_ANDROID_COMPILER)
+ kapt(HILT_COMPILER)
androidTestImplementation(TRUTH)
androidTestImplementation(ANDROIDX_TEST_CORE)
@@ -54,5 +54,5 @@
androidTestImplementation(ANDROIDX_TEST_RUNNER)
androidTestImplementation(project(":work:work-testing"))
androidTestImplementation(HILT_ANDROID_TESTING)
- kaptAndroidTest(HILT_ANDROID_COMPILER)
+ kaptAndroidTest(HILT_COMPILER)
}
\ No newline at end of file