Skip to content

Commit

Permalink
ci: ignore lint check for browser bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Jun 25, 2023
1 parent 14d89dc commit c5f3915
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/.*
FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*)
8 changes: 8 additions & 0 deletions src/Packages/Passport/Runtime/Assets/Resources/Bundles.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Packages/Passport/Runtime/Assets/Resources/passport.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<script src="./passport.js"></script>
<script src="./config.js"></script>
<script src="./Bundles/passport.js"></script>
<script src="./Bundles/config.js"></script>
<script src="./index.js"></script>
</head>
<body>
Expand Down
44 changes: 19 additions & 25 deletions src/Packages/Passport/Runtime/Editor/PassportPostprocess.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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");
}
}
}
Expand Down

0 comments on commit c5f3915

Please sign in to comment.