Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support provider api introduced in gradle 4.7 #122

Merged
merged 1 commit into from
Aug 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we support gradle versions less than 4.7? If so would there be an issue with this import when used with gradle < 4.7?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We support lower than 4.7. The import doesn't seem to be an issue as the mazerunner scenarios pass on CI, which uses gradle <4.7.


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