forked from Cysharp/ZLogger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,033 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,43 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public static class PackageExporter | ||
{ | ||
[MenuItem("Tools/Export Unitypackage")] | ||
public static void Export() | ||
{ | ||
var version = Environment.GetEnvironmentVariable("UNITY_PACKAGE_VERSION"); | ||
|
||
// configure | ||
var root = "Scripts/ZLogger"; | ||
var fileName = string.IsNullOrEmpty(version) ? "ZLogger.Unity.unitypackage" : $"ZLogger.Unity.{version}.unitypackage"; | ||
var exportPath = "./" fileName; | ||
|
||
var path = Path.Combine(Application.dataPath, root); | ||
var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) | ||
.Where(x => Path.GetExtension(x) == ".cs" || Path.GetExtension(x) == ".meta" || Path.GetExtension(x) == ".asmdef") | ||
.Where(x => Path.GetFileNameWithoutExtension(x) != "_InternalVisibleTo") | ||
.Select(x => "Assets" x.Replace(Application.dataPath, "").Replace(@"\", "/")) | ||
.ToArray(); | ||
|
||
var netStandardsAsset = Directory.EnumerateFiles(Path.Combine(Application.dataPath, "Plugins/"), "*", SearchOption.AllDirectories) | ||
.Select(x => "Assets" x.Replace(Application.dataPath, "").Replace(@"\", "/")) | ||
.ToArray(); | ||
|
||
assets = assets.Concat(netStandardsAsset).ToArray(); | ||
|
||
UnityEngine.Debug.Log("Export below files" Environment.NewLine string.Join(Environment.NewLine, assets)); | ||
|
||
var dir = new FileInfo(exportPath).Directory; | ||
if (!dir.Exists) dir.Create(); | ||
AssetDatabase.ExportPackage( | ||
assets, | ||
exportPath, | ||
ExportPackageOptions.Default); | ||
|
||
UnityEngine.Debug.Log("Export complete: " Path.GetFullPath(exportPath)); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters