From aa33823a128b2d8dd45c48d6b35812a38e33e988 Mon Sep 17 00:00:00 2001 From: Yoshifumi Kawai Date: Mon, 20 May 2019 02:12:11 +0900 Subject: [PATCH] plus package --- .circleci/config.yml | 44 ++++++++++++++++----------- .gitignore | 4 +++ Assets/Editor.meta | 8 +++++ Assets/Editor/PackageExporter.cs | 35 +++++++++++++++++++++ Assets/Editor/PackageExporter.cs.meta | 11 +++++++ 5 files changed, 85 insertions(+), 17 deletions(-) create mode 100644 Assets/Editor.meta create mode 100644 Assets/Editor/PackageExporter.cs create mode 100644 Assets/Editor/PackageExporter.cs.meta diff --git a/.circleci/config.yml b/.circleci/config.yml index a7ff947..a81f3ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,27 +32,37 @@ jobs: - unity_activate: unity_version: << parameters.unity_version >> unity_license: << parameters.unity_license >> - # - run: - # name: Build Linux(Mono) - # command: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64 - # working_directory: src/RandomFixtureKit.Unity - # - run: src/RandomFixtureKit.Unity/bin/UnitTest/StandaloneLinux64_Mono2x/test - # build-and-create-package: - # executor: unity - # steps: - # - checkout - # - unity_activate - # - run: - # name: Export unitypackage - # command: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export - # working_directory: src/MagicOnion.Client.Unity - # - store_artifacts: - # path: src/MagicOnion.Client.Unity/MagicOnion.Client.Unity.unitypackage - # destination: /MagicOnion.Client.Unity.unitypackage + - run: + name: Build Linux(Mono) + command: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64 + working_directory: . + - run: ./bin/UnitTest/StandaloneLinux64_Mono2x/test + build-and-create-package: + parameters: + unity_version: {type: string} + unity_license: {type: string} + executor: + name: unity + version: << parameters.unity_version >> + steps: + - checkout + - unity_activate: + unity_version: << parameters.unity_version >> + unity_license: << parameters.unity_license >> + - run: + name: Export unitypackage + command: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export + working_directory: . + - store_artifacts: + path: ./UniRx.Async.unitypackage + destination: /UniRx.Async.unitypackage workflows: version: 2 build-unity: jobs: + - build-and-create-package: + unity_version: 2019.3.0a2 + unity_license: ${UNITY_LICENSE_2019_3} - build-and-test: unity_version: 2019.3.0a2 unity_license: ${UNITY_LICENSE_2019_3} diff --git a/.gitignore b/.gitignore index 174b65e..29f4b76 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,7 @@ UniRx\.Async\.Tests\.csproj UniTask\.sln RuntimeUnitTestToolkit\.csproj + +Assembly-CSharp-Editor\.csproj + +UniRx\.Async\.unitypackage diff --git a/Assets/Editor.meta b/Assets/Editor.meta new file mode 100644 index 0000000..1d140d4 --- /dev/null +++ b/Assets/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99c8676e874bf0343b421d3527868f16 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/PackageExporter.cs b/Assets/Editor/PackageExporter.cs new file mode 100644 index 0000000..0d034bd --- /dev/null +++ b/Assets/Editor/PackageExporter.cs @@ -0,0 +1,35 @@ +#if UNITY_EDITOR + +using System; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; + +public static class PackageExporter +{ + [MenuItem("Tools/Export Unitypackage")] + public static void Export() + { + // configure + var root = "UniRx.Async"; + var exportPath = "./UniRx.Async.unitypackage"; + + var path = Path.Combine(Application.dataPath, root); + var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) + .Where(x => Path.GetExtension(x) == ".cs" || Path.GetExtension(x) == ".asmdef" || Path.GetExtension(x) == ".json") + .Select(x => "Assets" + x.Replace(Application.dataPath, "").Replace(@"\", "/")) + .ToArray(); + + UnityEngine.Debug.Log("Export below files" + Environment.NewLine + string.Join(Environment.NewLine, assets)); + + AssetDatabase.ExportPackage( + assets, + exportPath, + ExportPackageOptions.Default); + + UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath)); + } +} + +#endif \ No newline at end of file diff --git a/Assets/Editor/PackageExporter.cs.meta b/Assets/Editor/PackageExporter.cs.meta new file mode 100644 index 0000000..1261cdd --- /dev/null +++ b/Assets/Editor/PackageExporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af97405af79afbb4e9f7f49f30088474 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: