Skip to content

Commit

Permalink
Don't shadow transitive dependencies of the :agp-wrapper-* projects.
Browse files Browse the repository at this point in the history
* Make gradleApi() a compileOnly dependency, essentially excluding them from shadow config.
* Exclude Kotlin stdlib auto added dependencies in shadow config.

RELNOTES=Fix an issue with the Hilt Gradle Plugin artifact was being bloated with additional classes causing its size to be way bigger than its suppose to be.
PiperOrigin-RevId: 465108569
  • Loading branch information
danysantiago authored and Dagger Team committed Aug 3, 2022
1 parent 62b7f45 commit 8235beb
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
implementation project(':agp-wrapper')
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:4.2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
implementation project(':agp-wrapper')
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:7.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
implementation project(':agp-wrapper')
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:7.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
implementation project(':agp-wrapper')
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:7.2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
implementation project(':agp-wrapper-7-0')
implementation project(':agp-wrapper-7-1')
implementation project(':agp-wrapper-7-2')
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:$agp_version"

testImplementation 'junit:junit:4.12'
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/android/plugin/agp-wrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ plugins {
}

dependencies {
implementation gradleApi()
compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:$agp_version"
}
2 changes: 1 addition & 1 deletion java/dagger/hilt/android/plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
// Use shadow version >= 7.1.1 to get log4j vulnerability patches:
// https://github.com/johnrengelman/shadow/releases/tag/7.1.1
id 'com.github.johnrengelman.shadow' version '7.1.1'
id 'org.jetbrains.kotlin.android' version '1.6.20-RC2' apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
}

allprojects {
Expand Down
5 changes: 5 additions & 0 deletions java/dagger/hilt/android/plugin/main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ jar {
shadowJar {
archiveClassifier = ""
configurations = [project.configurations.shadowed]
dependencies {
// Don't jarjar stdlib deps that are automatically added by Kotlin plugin
exclude(dependency("org.jetbrains.kotlin::"))
exclude(dependency("org.jetbrains:annotations:"))
}
}

dependencies {
Expand Down

0 comments on commit 8235beb

Please sign in to comment.