diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5cd8c4a6..7fb543cb 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -57,4 +57,4 @@ jobs: VALIDATE_ALL_CODEBASE: true DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: .*src/Packages/Passport/Runtime/Assets/ThirdParty/.* \ No newline at end of file + FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*) \ No newline at end of file diff --git a/src/Packages/Passport/Runtime/Assets/Resources/Bundles.meta b/src/Packages/Passport/Runtime/Assets/Resources/Bundles.meta new file mode 100644 index 00000000..c5a75197 --- /dev/null +++ b/src/Packages/Passport/Runtime/Assets/Resources/Bundles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 33649cfd35b82d5439bc1f09c93b67f1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/Packages/Passport/Runtime/Assets/Resources/config.js b/src/Packages/Passport/Runtime/Assets/Resources/Bundles/config.js similarity index 100% rename from src/Packages/Passport/Runtime/Assets/Resources/config.js rename to src/Packages/Passport/Runtime/Assets/Resources/Bundles/config.js diff --git a/src/Packages/Passport/Runtime/Assets/Resources/config.js.meta b/src/Packages/Passport/Runtime/Assets/Resources/Bundles/config.js.meta similarity index 100% rename from src/Packages/Passport/Runtime/Assets/Resources/config.js.meta rename to src/Packages/Passport/Runtime/Assets/Resources/Bundles/config.js.meta diff --git a/src/Packages/Passport/Runtime/Assets/Resources/passport.js b/src/Packages/Passport/Runtime/Assets/Resources/Bundles/passport.js similarity index 100% rename from src/Packages/Passport/Runtime/Assets/Resources/passport.js rename to src/Packages/Passport/Runtime/Assets/Resources/Bundles/passport.js diff --git a/src/Packages/Passport/Runtime/Assets/Resources/passport.js.meta b/src/Packages/Passport/Runtime/Assets/Resources/Bundles/passport.js.meta similarity index 100% rename from src/Packages/Passport/Runtime/Assets/Resources/passport.js.meta rename to src/Packages/Passport/Runtime/Assets/Resources/Bundles/passport.js.meta diff --git a/src/Packages/Passport/Runtime/Assets/Resources/passport.html b/src/Packages/Passport/Runtime/Assets/Resources/passport.html index f0445c61..b0506684 100644 --- a/src/Packages/Passport/Runtime/Assets/Resources/passport.html +++ b/src/Packages/Passport/Runtime/Assets/Resources/passport.html @@ -1,8 +1,8 @@
- - + + diff --git a/src/Packages/Passport/Runtime/Editor/PassportPostprocess.cs b/src/Packages/Passport/Runtime/Editor/PassportPostprocess.cs index 63bb34e2..f6c467c4 100644 --- a/src/Packages/Passport/Runtime/Editor/PassportPostprocess.cs +++ b/src/Packages/Passport/Runtime/Editor/PassportPostprocess.cs @@ -1,8 +1,6 @@ #if UNITY_EDITOR -using System.Collections.Generic; using System.IO; -using System.Linq; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; @@ -42,16 +40,16 @@ public void OnPostprocessBuild(BuildReport report) { string buildPassportPath = $"{buildDataPath}/Passport/"; // Make sure it exists - DirectoryInfo buildUwbInfo = new(buildPassportPath); - if (!buildUwbInfo.Exists){ + DirectoryInfo buildPassportInfo = new(buildPassportPath); + if (!buildPassportInfo.Exists){ Directory.CreateDirectory(buildPassportPath); } else { // If the directory exists, clear it - foreach (FileInfo fileInfo in buildUwbInfo.EnumerateFiles()) { + foreach (FileInfo fileInfo in buildPassportInfo.EnumerateFiles()) { fileInfo.Delete(); } - foreach (DirectoryInfo directoryInfo in buildUwbInfo.EnumerateDirectories()) { + foreach (DirectoryInfo directoryInfo in buildPassportInfo.EnumerateDirectories()) { directoryInfo.Delete(true); } } @@ -61,31 +59,27 @@ public void OnPostprocessBuild(BuildReport report) { Debug.Log("Copying Passport files..."); // Find the location of the files - string engineFilesDir = Path.GetFullPath("Packages/com.immutable.passport/Runtime/Assets/Resources"); - if (!Directory.Exists(engineFilesDir)) { + string passportWebFilesDir = Path.GetFullPath("Packages/com.immutable.passport/Runtime/Assets/Resources"); + if (!Directory.Exists(passportWebFilesDir)) { Debug.LogError("The Passport files directory doesn't exist!"); return; } - // Get all files that aren't .meta files - string[] files = Directory.EnumerateFiles(engineFilesDir, "*.*", SearchOption.AllDirectories) - .Where(fileType => !fileType.EndsWith(".meta")) - .ToArray(); - - int size = files.Length; - - // Copy files - for (int i = 0; i < size; i++) { - string file = files[i]; - string destFileName = Path.GetFileName(file); - EditorUtility.DisplayProgressBar("Copying Passport Files", $"Copying {destFileName}", i / size); - - File.Copy(file, $"{buildPassportPath}{destFileName}", true); - - EditorUtility.ClearProgressBar(); + foreach (string dir in Directory.GetDirectories(passportWebFilesDir, "*", SearchOption.AllDirectories)) + { + string dirToCreate = dir.Replace(passportWebFilesDir, buildPassportPath); + Directory.CreateDirectory(dirToCreate); + } + + foreach (string newPath in Directory.GetFiles(passportWebFilesDir, "*.*", SearchOption.AllDirectories)) + { + if (!newPath.EndsWith(".meta")) + { + File.Copy(newPath, newPath.Replace(passportWebFilesDir, buildPassportPath), true); + } } - Debug.Log($"Sucessfully copied {size} Passport files"); + Debug.Log($"Sucessfully copied Passport web files"); } } }