Skip to content

Commit

Permalink
fix: workaround for AGP 3.5.0 tasks running before package
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Aug 14, 2020
1 parent cba71b7 commit 36514d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/kotlin/com/bugsnag/android/gradle/internal/GradleUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ internal object AgpVersions {
// Use baseVersion to avoid any qualifiers like `-alpha06`
val CURRENT: VersionNumber = VersionNumber.parse(ANDROID_GRADLE_PLUGIN_VERSION).baseVersion
val VERSION_3_4: VersionNumber = VersionNumber.parse("3.4.0")
val VERSION_3_5: VersionNumber = VersionNumber.parse("3.5.0")
val VERSION_4_0: VersionNumber = VersionNumber.parse("4.0.0")
}

Expand Down Expand Up @@ -123,6 +124,17 @@ private fun BaseVariant.registerManual(project: Project, provider: TaskProvider<
.configureEach {
it.dependsOn(provider)
}

if (AgpVersions.CURRENT.major == AgpVersions.VERSION_3_5.major
&& AgpVersions.CURRENT.minor == AgpVersions.VERSION_3_5.minor) {
// workaround - AGP 3.5.0 executes upload tasks before the package tasks
// so we need to manually specify that it must run after the package task
// this stops config avoidance for AGP 3.5.0 only
project.tasks.matching { it.name.contains("package") }
.configureEach { packageTask ->
provider.get().mustRunAfter(packageTask)
}
}
}

/**
Expand Down

0 comments on commit 36514d1

Please sign in to comment.