Skip to content

Commit e352955

Browse files
author
Stewart Miles
committed
Metadata that makes it possible to upgrade to renamed EDM.
* Added manifest from 1.2.137 so that it's possible to clean up old components of EDM before it was renamed. This manifest must be at the old location so old versions of the Version Handler (i.e in memory) can perform the first phase of the upgrade process. * Added manifestname to the manifest so that it's possible to associate the previous manifest play-services-resolver_vx.x.x.x.txt with the new manifest external-dependency-managervx.x.x.x.txt. * Added the exportpath to all files in the package so they can be moved in a project and still manageed by the Version Handler. * Bumped the version number in preparation for release. Bug: 150886091 Change-Id: I8b43191645e5b053172c0370bcde9c1aa6810699
1 parent c4f57f3 commit e352955

18 files changed

+75
-47
lines changed

build.gradle

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ project.ext {
189189
pluginExportFile = new File(buildDir, "plugin.unitypackage")
190190
// Directory within the plugin staging area that just contains the plugin.
191191
pluginAssetsDir = new File("Assets", "ExternalDependencyManager")
192+
// Directories within the staging area to export.
193+
pluginExportDirs = [pluginAssetsDir, new File("Assets", "PlayServicesResolver")]
192194
// Directory within the plugin directory that contains the managed DLLs.
193195
pluginEditorDllDir = new File(pluginAssetsDir, "Editor")
194196
// Directory which contains the solution for all C# projects with a project in
@@ -197,7 +199,7 @@ project.ext {
197199
// Solution which references all projects used by the plugin.
198200
pluginSolutionFile = new File(pluginSourceDir, "ExternalDependencyManager.sln")
199201
// Version of the plugin (update this with CHANGELOG.md on each release).
200-
pluginVersion = "1.2.137.0"
202+
pluginVersion = "1.2.138.0"
201203
// Semantic version of the plugin.
202204
pluginVersionSemVer = pluginVersion.tokenize(".")[0..2].join(".")
203205
// Base filename of the released plugin.
@@ -525,6 +527,7 @@ File copyAssetMetadataFile(File sourceFile, File targetFile) {
525527
// Parse the existing version from the asset metadata.
526528
def folderAssetRegEx = /^folderAsset:\s+yes\s*$/
527529
def versionRegEx = /^(-\s+gvh_version-)([a-zA-Z0-9.]+)\s*$/
530+
def exportPathRegEx = /^(-\s+gvhp_exportpath-)(.*)$/
528531
Boolean isFolder = false
529532
String currentVersion = ""
530533
lines.each { String line ->
@@ -536,15 +539,19 @@ File copyAssetMetadataFile(File sourceFile, File targetFile) {
536539
isFolder = true
537540
}
538541
}
542+
Boolean isNotVersioned = (isFolder ||
543+
targetFile.name.startsWith(
544+
"play-services-resolver"))
539545
// Ignore folder assets, they don't need to be versioned.
540-
if (isFolder) return copyFile(sourceFile, targetFile)
546+
if (isNotVersioned) return copyFile(sourceFile, targetFile)
541547
Boolean versionChanged = currentVersion != project.ext.pluginVersion
542548

543549
List<String> outputLines = []
544550
lines.each { line ->
545551
if (versionChanged) {
546552
def guidMatch = (line =~ /^(guid:)\s+(.*)/)
547553
def versionLabelMatch = (line =~ versionRegEx)
554+
def exportPathMatch = (line =~ exportPathRegEx)
548555
if (guidMatch.matches() && sourceFile.name != targetFile.name) {
549556
// Update the metadata's GUID.
550557
// 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) {
553560
"%s %s",
554561
guidMatch.group(1),
555562
java.util.UUID.randomUUID().toString().replace("-", ""))
556-
}
557-
else if (versionLabelMatch.matches()) {
563+
} else if (versionLabelMatch.matches()) {
558564
// Update the version metadata for the asset.
559565
line = sprintf("%s%s", versionLabelMatch.group(1),
560566
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())
561573
}
562574
}
563575
outputLines.add(line)
@@ -1136,7 +1148,13 @@ Task copyPluginTemplateToStagingArea = createCopyFilesTask(
11361148
new File(new File(new File("Assets", "ExternalDependencyManager"), "Editor"),
11371149
"GoogleRegistries.xml"),
11381150
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")],
11401158
project.ext.pluginTemplateDir, project.ext.pluginStagingAreaDir,
11411159
[preparePluginStagingAreaDir],
11421160
{ sourceFile, targetFile -> copyAssetMetadataFile(sourceFile, targetFile) })
@@ -1172,11 +1190,7 @@ task copyPluginComponentsToStagingArea(
11721190
task generatePluginManifest(dependsOn: [preparePluginStagingAreaDir,
11731191
copyPluginTemplateToStagingArea,
11741192
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"
11801194
File outputDir = new File(project.ext.pluginStagingAreaDir,
11811195
project.ext.pluginEditorDllDir.path)
11821196
File manifestMetadataTemplateFile =
@@ -1217,8 +1231,8 @@ Task buildPlugin = createUnityTask(
12171231
project.ext.buildDir,
12181232
["-g.building",
12191233
"-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,
12221236
"-gvh_disable",
12231237
"-quit"], true, null)
12241238
buildPlugin.with {
@@ -1263,7 +1277,9 @@ task releasePlugin(dependsOn: buildPlugin) {
12631277
copy {
12641278
from project.ext.pluginStagingAreaDir
12651279
into project.ext.pluginExplodedDir
1266-
include (project.ext.pluginAssetsDir.path + "/**/*")
1280+
include project.ext.pluginExportDirs.collect {
1281+
it.path + "/**/*"
1282+
}
12671283
}
12681284
pluginTemplateFilesMap.each {
12691285
sourceFile, targetFile -> copyFile(sourceFile, targetFile)

plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManager.dll.meta

Lines changed: 0 additions & 24 deletions
This file was deleted.

plugin/Assets/ExternalDependencyManager/Editor/Google.UnityPackageManagerResolver.dll.mdb.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.UnityPackageManagerResolver.dll.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta

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

plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta

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

0 commit comments

Comments
 (0)