Skip to content

Commit

Permalink
Merge pull request #122 from bugsnag/provider-compat-fix
Browse files Browse the repository at this point in the history
fix: support provider api introduced in gradle 4.7
  • Loading branch information
fractalwrench authored Aug 7, 2018
2 parents 7066053 + 0c09c7e commit 649cb0f
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.android.build.gradle.api.BaseVariant
import com.android.build.gradle.api.BaseVariantOutput
import groovy.xml.Namespace
import org.gradle.api.DefaultTask
import org.gradle.api.file.Directory
import org.gradle.api.provider.Provider

import java.nio.file.Paths

Expand Down Expand Up @@ -31,7 +33,18 @@ class BugsnagVariantOutputTask extends DefaultTask {
* https://issuetracker.google.com/issues/37085185
*/
File getManifestPath() {
File directory = variantOutput.processManifest.manifestOutputDirectory
File directory
def outputDir = variantOutput.processManifest.manifestOutputDirectory

if (outputDir instanceof File) {
directory = outputDir
} else {
// gradle 4.7 introduced a provider API for lazy evaluation of properties,
// AGP subsequently changed the API from File to Provider<File>
// see https://docs.gradle.org/4.7/userguide/lazy_configuration.html
directory = outputDir.get().asFile
}

File manifestFile = Paths.get(directory.toString(), variantOutput.dirName, "AndroidManifest.xml").toFile()

if (!manifestFile.exists()) {
Expand Down

0 comments on commit 649cb0f

Please sign in to comment.