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
Add support for EnableGoogleServicesPlugin #438
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ buildscript { | |
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.1.0' | ||
classpath 'com.google.gms:google-services:3.2.1' | ||
} | ||
} | ||
|
||
|
@@ -322,3 +323,7 @@ for (def func : cdvPluginPostBuildExtras) { | |
if (hasProperty('postBuildExtras')) { | ||
postBuildExtras() | ||
} | ||
|
||
if (cdvHelpers.getConfigPreference('EnableGoogleServicesPlugin', 'false').toBoolean()) { | ||
apply plugin: 'com.google.gms.google-services' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chemerisuk I've had to make this line:
because the class must be used instead of id(string) to be able to apply plugin from non-root gradle file. I haven't tested the PR yet but I'm assuming the reason you are using the ID is because it is a root gradle file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because this is the root Gradle file. Worked fine on my side. For testing I commented changes from cordova-support-google-services and inserted PR code manually. Then rebuilt the project and tried to start (btw google services v15 trigger error at runtime, if ‘google.services’ was not processed properly while previously it was build time error). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to wrap this
classpath
in an if condition, like how the apply is done?It would be nice to minimize the amount of downloading of build related libraries if they are not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the object
cdvHelpers
is not available at the dependency scope. Project build failed with the error:Happens when I apply the changes you suggest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chemerisuk Yes, it seems
cordova.gradle
would need to be applied within the scope so it becomes available.@dpogue Would you know off-hand if something like this would be problematic? The
cordova.gradle
content seems to be only helper methods. Adding it seems to solve the desire to make the classpaths conditional.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about Gradle, and my experience consists mostly of swearing at it.
I believe you're correct that
cordova.gradle
is helper methods, but I don't know anything about scoping or when it's safe to import (apply?) stuff.