Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ jobs:
black --check ml-agents-envs
black --check gym-unity

- run:
name: Verify there are no hidden/missing metafiles.
# Renaming files or deleting files can leave metafiles behind that makes Unity very unhappy.
command: |
. venv/bin/activate
python utils/validate_meta_files.py

- store_test_results:
path: test-reports

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/UnitySDK/[Uu]nity[Pp]ackage[Mm]anager/
/UnitySDK/Assets/AssetStoreTools*
/UnitySDK/Assets/Plugins*
/UnitySDK/Assets/Gizmos*
/UnitySDK/Assets/Demonstrations*

# Tensorflow Model Info
Expand Down
8 changes: 8 additions & 0 deletions UnitySDK/Assets/Gizmos.meta

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

Empty file added utils/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions utils/validate_meta_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import json
import os


def main():
asset_path = "UnitySDK/Assets"
meta_suffix = ".meta"
python_suffix = ".py"

num_matched = 0

unmatched = set()

for root, dirs, files in os.walk(asset_path):
dirs = set(dirs)
files = set(files)

combined = dirs | files
for f in combined:
if f.endswith(python_suffix):
# Probably this script; skip it
continue

# We expect each non-.meta file to have a .meta file, and each .meta file to have a non-.meta file
if f.endswith(meta_suffix):
expected = f.replace(meta_suffix, "")
else:
expected = f + meta_suffix

if expected not in combined:
unmatched.add(os.path.join(root, f))
else:
num_matched += 1

if unmatched:
raise Exception(f"Mismatch between expected files and their .meta files: {sorted(unmatched)}")

print(f"Found {num_matched} correctly matched files")


if __name__ == "__main__":
main()