@@ -189,6 +189,8 @@ project.ext {
189
189
pluginExportFile = new File (buildDir, " plugin.unitypackage" )
190
190
// Directory within the plugin staging area that just contains the plugin.
191
191
pluginAssetsDir = new File (" Assets" , " ExternalDependencyManager" )
192
+ // Directories within the staging area to export.
193
+ pluginExportDirs = [pluginAssetsDir, new File (" Assets" , " PlayServicesResolver" )]
192
194
// Directory within the plugin directory that contains the managed DLLs.
193
195
pluginEditorDllDir = new File (pluginAssetsDir, " Editor" )
194
196
// Directory which contains the solution for all C# projects with a project in
@@ -197,7 +199,7 @@ project.ext {
197
199
// Solution which references all projects used by the plugin.
198
200
pluginSolutionFile = new File (pluginSourceDir, " ExternalDependencyManager.sln" )
199
201
// Version of the plugin (update this with CHANGELOG.md on each release).
200
- pluginVersion = " 1.2.137 .0"
202
+ pluginVersion = " 1.2.138 .0"
201
203
// Semantic version of the plugin.
202
204
pluginVersionSemVer = pluginVersion. tokenize(" ." )[0 .. 2 ]. join(" ." )
203
205
// Base filename of the released plugin.
@@ -525,6 +527,7 @@ File copyAssetMetadataFile(File sourceFile, File targetFile) {
525
527
// Parse the existing version from the asset metadata.
526
528
def folderAssetRegEx = / ^folderAsset:\s +yes\s *$/
527
529
def versionRegEx = / ^(-\s +gvh_version-)([a-zA-Z0-9.]+)\s *$/
530
+ def exportPathRegEx = / ^(-\s +gvhp_exportpath-)(.*)$/
528
531
Boolean isFolder = false
529
532
String currentVersion = " "
530
533
lines. each { String line ->
@@ -536,15 +539,19 @@ File copyAssetMetadataFile(File sourceFile, File targetFile) {
536
539
isFolder = true
537
540
}
538
541
}
542
+ Boolean isNotVersioned = (isFolder ||
543
+ targetFile. name. startsWith(
544
+ " play-services-resolver" ))
539
545
// Ignore folder assets, they don't need to be versioned.
540
- if (isFolder ) return copyFile(sourceFile, targetFile)
546
+ if (isNotVersioned ) return copyFile(sourceFile, targetFile)
541
547
Boolean versionChanged = currentVersion != project. ext. pluginVersion
542
548
543
549
List<String > outputLines = []
544
550
lines. each { line ->
545
551
if (versionChanged) {
546
552
def guidMatch = (line =~ / ^(guid:)\s +(.*)/ )
547
553
def versionLabelMatch = (line =~ versionRegEx)
554
+ def exportPathMatch = (line =~ exportPathRegEx)
548
555
if (guidMatch. matches() && sourceFile. name != targetFile. name) {
549
556
// Update the metadata's GUID.
550
557
// If a file is renamed we want to make sure Unity imports it as a new
@@ -553,11 +560,16 @@ File copyAssetMetadataFile(File sourceFile, File targetFile) {
553
560
" %s %s" ,
554
561
guidMatch. group(1 ),
555
562
java. util. UUID . randomUUID(). toString(). replace(" -" , " " ))
556
- }
557
- else if (versionLabelMatch. matches()) {
563
+ } else if (versionLabelMatch. matches()) {
558
564
// Update the version metadata for the asset.
559
565
line = sprintf (" %s%s" , versionLabelMatch. group(1 ),
560
566
project. ext. pluginVersion)
567
+ } else if (exportPathMatch. matches()) {
568
+ // Update the export path of the asset.
569
+ line = sprintf (" %s%s" , exportPathMatch. group(1 ),
570
+ targetFile. path. replaceFirst(/ .*\/ Assets\/ / , " Assets/" ))
571
+ line = line. substring(0 , line. length() -
572
+ project. ext. unityMetadataExtension. length())
561
573
}
562
574
}
563
575
outputLines. add(line)
@@ -1136,7 +1148,13 @@ Task copyPluginTemplateToStagingArea = createCopyFilesTask(
1136
1148
new File (new File (new File (" Assets" , " ExternalDependencyManager" ), " Editor" ),
1137
1149
" GoogleRegistries.xml" ),
1138
1150
new File (new File (new File (" Assets" , " ExternalDependencyManager" ), " Editor" ),
1139
- " GoogleRegistries.xml.meta" )],
1151
+ " GoogleRegistries.xml.meta" ),
1152
+ new File (" Assets" , " PlayServicesResolver.meta" ),
1153
+ new File (new File (" Assets" , " PlayServicesResolver" ), " Editor.meta" ),
1154
+ new File (new File (new File (" Assets" , " PlayServicesResolver" ), " Editor" ),
1155
+ " play-services-resolver_v1.2.137.0.txt" ),
1156
+ new File (new File (new File (" Assets" , " PlayServicesResolver" ), " Editor" ),
1157
+ " play-services-resolver_v1.2.137.0.txt.meta" )],
1140
1158
project. ext. pluginTemplateDir, project. ext. pluginStagingAreaDir,
1141
1159
[preparePluginStagingAreaDir],
1142
1160
{ sourceFile , targetFile -> copyAssetMetadataFile(sourceFile, targetFile) })
@@ -1172,11 +1190,7 @@ task copyPluginComponentsToStagingArea(
1172
1190
task generatePluginManifest (dependsOn : [preparePluginStagingAreaDir,
1173
1191
copyPluginTemplateToStagingArea,
1174
1192
copyPluginComponentsToStagingArea]) {
1175
- // This should use currentPluginBasename when we have support for plugin
1176
- // aliases which will allow the detection of a play-services-resolver
1177
- // plugin to be upgraded to external-dependency-manager.
1178
- String unversionedManifestName =
1179
- " play-services-resolver" /* currentPluginBasename */ + " .txt"
1193
+ String unversionedManifestName = currentPluginBasename + " .txt"
1180
1194
File outputDir = new File (project. ext. pluginStagingAreaDir,
1181
1195
project. ext. pluginEditorDllDir. path)
1182
1196
File manifestMetadataTemplateFile =
@@ -1217,8 +1231,8 @@ Task buildPlugin = createUnityTask(
1217
1231
project. ext. buildDir,
1218
1232
[" -g.building" ,
1219
1233
" -buildTarget" , " android" ,
1220
- " -exportPackage" , project. ext. pluginAssetsDir . path,
1221
- project. ext. pluginExportFile. absolutePath,
1234
+ " -exportPackage" ] + ( project. ext. pluginExportDirs . collect { it . path }) +
1235
+ [ project. ext. pluginExportFile. absolutePath,
1222
1236
" -gvh_disable" ,
1223
1237
" -quit" ], true , null )
1224
1238
buildPlugin. with {
@@ -1263,7 +1277,9 @@ task releasePlugin(dependsOn: buildPlugin) {
1263
1277
copy {
1264
1278
from project. ext. pluginStagingAreaDir
1265
1279
into project. ext. pluginExplodedDir
1266
- include (project. ext. pluginAssetsDir. path + " /**/*" )
1280
+ include project. ext. pluginExportDirs. collect {
1281
+ it. path + " /**/*"
1282
+ }
1267
1283
}
1268
1284
pluginTemplateFilesMap. each {
1269
1285
sourceFile, targetFile -> copyFile(sourceFile, targetFile)
0 commit comments