Skip to content

Commit 1c33763

Browse files
committed
Updating build,gradle to generate the support jar dependency dynamically.
This keeps the dependency file up to date with the version of the plugin. Change-Id: I9bd34d73740e9be79720f1a4945fa12a8a9266fa
1 parent 7709f87 commit 1c33763

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

GoogleSignInPlugin/Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,11 @@
33
<!-- See https://github.com/googlesamples/unity-jar-resolver#usage for
44
how to configure dependencies -->
55
<androidPackages>
6-
<!-- Internal library dependency. -->
7-
<androidPackage spec="com.google.signin:google-signin-support:1+">
8-
<repositories>
9-
<repository>Assets/GoogleSignIn/Editor/m2repository</repository>
10-
</repositories>
11-
</androidPackage>
12-
<!--- Auth THIS IS ALWAYS REQUIRED -->
13-
<!-- The dependency is actually on 10.2, but 10+ is close enough.
14-
If you have problems, please change this to a concrete value.
15-
-->
166
<androidPackage spec="com.google.android.gms:play-services-auth:10+">
177
<androidSdkPackageIds>
188
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
199
</androidSdkPackageIds>
2010
</androidPackage>
21-
22-
<!-- IF YOU ARE USING THE GAMES_CONFIG TO SIGN-IN, YOU NEED TO
23-
UNCOMMENT THIS DEPENDENCY!!
24-
25-
This is only used if you need to add play-services-games to your
26-
project.
27-
-->
28-
<!--
29-
<androidPackage spec="com.google.android.gms:play-services-games:10+">
30-
<androidSdkPackageIds>
31-
<androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
32-
</androidSdkPackageIds>
33-
</androidPackage>
34-
-->
35-
3611
</androidPackages>
3712

3813
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->

GoogleSignInPlugin/Assets/GoogleSignIn/Editor/GoogleSignInSupportDependencies.xml.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GoogleSignInPlugin/Assets/GoogleSignIn/Editor/google-signin-plugin_v1.0.1.txt.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,27 @@ task import_jarresolver() {
180180
}
181181
}
182182

183+
task generate_dependency_xml() {
184+
description "Generate the JarResolver dependency file for the support library"
185+
dependsOn copy_unity_project
186+
doFirst {
187+
def xmlFile = file("${pluginProjectPath}/${editorDir}/GoogleSignInSupportDependencies.xml")
188+
189+
xmlFile << '<?xml version="1.0" encoding="UTF-8" ?>\n'
190+
xmlFile << '<dependencies>\n'
191+
xmlFile << '<!-- Internal library dependency generated at build time. -->\n'
192+
xmlFile << ' <androidPackages>\n'
193+
xmlFile << ' <androidPackage spec="com.google.signin:google-signin-support:'
194+
xmlFile << "${pluginVersion}\">\n"
195+
xmlFile << ' <repositories>\n'
196+
xmlFile << ' <repository>Assets/GoogleSignIn/Editor/m2repository</repository>\n'
197+
xmlFile << ' </repositories>\n'
198+
xmlFile << ' </androidPackage>\n'
199+
xmlFile << ' </androidPackages>\n'
200+
xmlFile << '</dependencies>\n'
201+
}
202+
}
203+
183204
task generate_manifest(dependsOn: [ 'inject_versionIntoMetaFiles']) {
184205
description 'Generate a manifest for the files in the plug-in.'
185206
doLast {
@@ -293,7 +314,7 @@ task package_sample () {
293314

294315
task inject_versionIntoMetaFiles() {
295316
description 'Inject the version number into the plugin\'s meta files.'
296-
dependsOn copy_unity_project, import_jarresolver
317+
dependsOn copy_unity_project, generate_dependency_xml, import_jarresolver
297318
doLast {
298319
for (fileobj in fileTree("${pluginProjectPath}")) {
299320
if (fileobj.path.endsWith('.meta')) {

0 commit comments

Comments
 (0)