Skip to content

Commit 2849dca

Browse files
realdadfishbretthoerner
authored andcommitted
Get the actual file out of the Provider<File> type to get the correct manifest path (closes #644) (#645)
1 parent 10da2f6 commit 2849dca

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

sentry-android-gradle-plugin/src/main/groovy/io/sentry/android/gradle/SentryPlugin.groovy

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,18 @@ class SentryPlugin implements Plugin<Project> {
153153
manifestPath = variantOutput.processManifest.manifestOutputFile
154154
} catch (Exception ignored) {
155155
// Android Gradle Plugin >= 3.0.0
156-
manifestPath = new File(
157-
variantOutput.processManifest.manifestOutputDirectory.toString(),
158-
"AndroidManifest.xml")
159-
if (!manifestPath.isFile()) {
160-
manifestPath = new File(
161-
new File(
162-
variantOutput.processManifest.manifestOutputDirectory.toString(),
163-
variantOutput.dirName),
164-
"AndroidManifest.xml")
156+
def outputDir = variantOutput.processManifest.manifestOutputDirectory
157+
// Gradle 4.7 introduced the lazy task API and AGP 3.3+ adopts that,
158+
// so we apparently have a Provider<File> here instead
159+
// TODO: This will let us depend on the configuration of each flavor's
160+
// manifest creation task and their transitive dependencies, which in
161+
// turn prolongs the configuration time accordingly. Evaluate how Gradle's
162+
// new Task Avoidance API can be used instead.
163+
// (https://docs.gradle.org/current/userguide/task_configuration_avoidance.html)
164+
if (!(outputDir instanceof File)) {
165+
outputDir = outputDir.get().asFile
165166
}
167+
manifestPath = new File(outputDir, "AndroidManifest.xml")
166168
}
167169
}
168170

0 commit comments

Comments
 (0)