Skip to content

Commit

Permalink
Update Hilt Plugin to AGP beta04 and use renamed APIs when configurin…
Browse files Browse the repository at this point in the history
…g the ASM transform.

Fixes #2337

RELNOTES=Fix an incompatibility issue between the Hilt Gradle Plugin and AGP 4.2.0-beta04. Note that this fix makes it so that earlier versions of AGP 4.2.0 are incompatible with Hilt's Plugin.
PiperOrigin-RevId: 354610640
  • Loading branch information
danysantiago authored and Dagger Team committed Jan 29, 2021
1 parent c8713e5 commit 9da5114
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
agp: ['4.1.0', '4.2.0-beta01']
agp: ['4.1.0', '4.2.0-beta04']
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
buildscript {
ext {
kotlin_version = '1.3.61'
agp_version = "4.2.0-beta01"
agp_version = "4.2.0-beta04"
}
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
buildscript {
ext {
kotlin_version = '1.3.61'
agp_version = "4.2.0-beta01"
agp_version = "4.2.0-beta04"
}
repositories {
google()
Expand Down
4 changes: 2 additions & 2 deletions java/dagger/hilt/android/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ configurations {

dependencies {
implementation gradleApi()
compileOnly 'com.android.tools.build:gradle:4.2.0-beta01'
compileOnly 'com.android.tools.build:gradle:4.2.0-beta04'
// TODO(danysantiago): Make compileOnly to avoid dep for non-Kotlin projects.
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20'
implementation 'org.javassist:javassist:3.26.0-GA'
Expand All @@ -51,7 +51,7 @@ dependencies {
testImplementation gradleTestKit()
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:1.0.1'
additionalTestPlugin 'com.android.tools.build:gradle:4.2.0-beta01'
additionalTestPlugin 'com.android.tools.build:gradle:4.2.0-beta04'
}

// Configure the generating task of plugin-under-test-metadata.properties to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ class HiltGradlePlugin : Plugin<Project> {

val androidComponents = project.extensions.getByType(AndroidComponentsExtension::class.java)
androidComponents.onVariants { registerTransform(it) }
androidComponents.androidTest { registerTransform(it) }
androidComponents.unitTest { registerTransform(it) }
androidComponents.androidTests { registerTransform(it) }
androidComponents.unitTests { registerTransform(it) }
}

private fun configureTransform(project: Project, hiltExtension: HiltExtension) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class GradleTestRunner(val tempFolder: TemporaryFolder) {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta01'
classpath 'com.android.tools.build:gradle:4.2.0-beta04'
}
}
Expand Down
2 changes: 1 addition & 1 deletion javatests/artifacts/dagger-android/simple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

buildscript {
ext {
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta01"
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta04"
}
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion javatests/artifacts/hilt-android/simple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
ext {
dagger_version = 'LOCAL-SNAPSHOT'
kotlin_version = '1.3.61'
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta01"
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta04"
}
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion javatests/artifacts/hilt-android/simpleKotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
buildscript {
ext {
kotlin_version = '1.3.61'
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta01"
agp_version = System.getenv('AGP_VERSION') ?: "4.2.0-beta04"
}
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion util/run-local-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pushd examples/maven && mvn compile && popd
# Run local gradle tests
util/run-local-gradle-tests.sh
util/run-local-gradle-android-tests.sh "4.1.0"
util/run-local-gradle-android-tests.sh "4.2.0-beta01"
util/run-local-gradle-android-tests.sh "4.2.0-beta04"

0 comments on commit 9da5114

Please sign in to comment.