diff --git a/.github/workflows/create-unitypackage.yml b/.github/workflows/create-unitypackage.yml index a67ef89cb9..a3bf2e3efc 100644 --- a/.github/workflows/create-unitypackage.yml +++ b/.github/workflows/create-unitypackage.yml @@ -92,7 +92,7 @@ jobs: create-unitypackage: needs: [detect-unity-version, run-edit-mode-tests] runs-on: [self-hosted, Windows, X64, Unity] - timeout-minutes: 10 + timeout-minutes: 20 steps: - name: Create UnityPackage id: create-unitypackage @@ -103,6 +103,7 @@ jobs: -projectPath "${UNITY_PROJECT_PATH}" \ -executeMethod "VRM.DevOnly.PackageExporter.VRMExportUnityPackage.CreateUnityPackageWithBuild" \ -logFile create-unitypackage.log + - name: Upload UnityPackage uses: actions/upload-artifact@v4 with: diff --git a/Assets/VRM/Editor/VRMExportUnityPackage.cs b/Assets/VRM/Editor/VRMExportUnityPackage.cs index 6f642c1770..1ad482342c 100644 --- a/Assets/VRM/Editor/VRMExportUnityPackage.cs +++ b/Assets/VRM/Editor/VRMExportUnityPackage.cs @@ -22,6 +22,9 @@ public static bool EndsWithAndMeta(this string str, string terminator) } } + /// + /// TODO: 本来このクラスは「パッケージとしての UniVRM」のスコープのクラスであるが、「UPM Package VRM」のスコープにコードがあるので変 + /// public static class VRMExportUnityPackage { static string GetProjectRoot() @@ -142,18 +145,20 @@ public static void CreateUnityPackageWithBuild() { try { + Debug.Log($"[{nameof(VRMExportUnityPackage)}] Start CreateUnityPackageWithBuild..."); var folder = GetProjectRoot(); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } - if (!BuildTestScene()) - { - throw new Exception("Failed to build test scenes"); - } + Debug.Log($"[{nameof(VRMExportUnityPackage)}] Try to build test scenes..."); + BuildTestScene(); + + Debug.Log($"[{nameof(VRMExportUnityPackage)}] Create UnityPackages..."); CreateUnityPackages(folder); + Debug.Log($"[{nameof(VRMExportUnityPackage)}] Finish CreateUnityPackageWithBuild"); if (Application.isBatchMode) { EditorApplication.Exit(0); @@ -201,7 +206,7 @@ public PackageInfo(string name) } } - public static void CreateUnityPackages(string outputDir) + private static void CreateUnityPackages(string outputDir) { if (!VRMSampleCopy.Validate()) { @@ -250,7 +255,7 @@ public static void CreateUnityPackages(string outputDir) } } - public static void CreateUnityPackage( + private static void CreateUnityPackage( string outputDir, PackageInfo package ) @@ -264,13 +269,18 @@ PackageInfo package AssetDatabase.ExportPackage(targetFileNames, path, ExportPackageOptions.Default); } - public static bool BuildTestScene() + private static void BuildTestScene() { - var levels = new string[] { "Assets/VRM.Samples/Scenes/VRMRuntimeLoaderSample.unity" }; - return Build(levels); + var levels = new string[] + { + "Assets/UniGLTF_Samples/GltfViewer/GltfViewer.unity", + "Assets/VRM_Samples/SimpleViewer/SimpleViewer.unity", + "Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity", + }; + Build(levels); } - public static bool Build(string[] levels) + private static void Build(string[] levels) { var buildPath = Path.GetFullPath(Application.dataPath + "/../build/build.exe"); Debug.LogFormat("BuildPath: {0}", buildPath); @@ -279,12 +289,10 @@ public static bool Build(string[] levels) BuildTarget.StandaloneWindows, BuildOptions.None ); -#if UNITY_2018_1_OR_NEWER - var isSuccess = build.summary.result == BuildResult.Succeeded; -#else - var isSuccess = !string.IsNullOrEmpty(build); -#endif - return isSuccess; + if (build.summary.result != BuildResult.Succeeded) + { + throw new Exception("Failed to build scenes"); + } } } }