Skip to content

Commit 2adf064

Browse files
committed
Add OpenUPM support
This commit modifies the build.gradle file so that it explodes the generated UPM package into the repo as part of the release process.
1 parent ae200af commit 2adf064

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

build.gradle

+15-3
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,18 @@ project.ext {
264264
pluginStagingAreaDir = new File(buildDir, "staging")
265265
// Directory where the build plugin is unpacked to.
266266
pluginExplodedDir = new File(scriptDirectory, "exploded")
267+
// Directory where the UPM package is unpacked to.
268+
pluginUpmDir = new File(scriptDirectory, "upm")
267269
// Base filename of the released plugin.
268270
currentPluginBasename = "external-dependency-manager"
271+
// Base UPM package name of the released plugin.
272+
currentPluginUpmPackageName = "com.google.external-dependency-manager"
269273
// Where the exported plugin file is built before it's copied to the release
270274
// location.
271275
pluginExportFile = new File(buildDir, currentPluginBasename + ".unitypackage")
272276
// Where the exported UPM plugin file is built.
273277
pluginUpmExportFile = new File(buildDir,
274-
currentPluginBasename + pluginVersion + ".tgz")
278+
currentPluginUpmPackageName + "-" + pluginVersion + ".tgz")
275279
// Directory within the plugin staging area that just contains the plugin.
276280
pluginAssetsDir = new File("Assets", "ExternalDependencyManager")
277281
// Directories within the staging area to export.
@@ -2069,8 +2073,7 @@ buildPlugin.with {
20692073
}
20702074

20712075
// Guid paths for UPM package.
2072-
File upmPluginPackageDir = new File("com.google.external-dependency-manager",
2073-
"ExternalDependencyManager")
2076+
File upmPluginPackageDir = new File(currentPluginUpmPackageName, "ExternalDependencyManager")
20742077
File upmPluginEditorDir = new File(upmPluginPackageDir, "Editor")
20752078
File upmPluginDllDir = new File(upmPluginEditorDir, project.ext.pluginVersion)
20762079

@@ -2142,6 +2145,15 @@ task releasePlugin(dependsOn: [buildPlugin, buildUpmPlugin]) {
21422145
it.path + "/**/*"
21432146
}
21442147
}
2148+
delete fileTree(dir: project.ext.pluginUpmDir)
2149+
copy {
2150+
// Rename the top-level package folder to upm.
2151+
eachFile {
2152+
path = path.replaceFirst(/^.+?\//, "upm/")
2153+
}
2154+
from tarTree(project.ext.pluginUpmExportFile)
2155+
into project.ext.scriptDirectory
2156+
}
21452157
pluginTemplateFilesMap.each {
21462158
sourceFile, targetFile -> copyFile(sourceFile, targetFile)
21472159
}

0 commit comments

Comments
 (0)