Find all .asmdef files in Assets/ directory.
(project_path: Path)
| 419 | |
| 420 | |
| 421 | def find_assembly_definitions(project_path: Path) -> list[AssemblyDefinition]: |
| 422 | """Find all .asmdef files in Assets/ directory.""" |
| 423 | project_path = project_path.resolve() |
| 424 | assets_dir = project_path / "Assets" |
| 425 | |
| 426 | if not assets_dir.exists(): |
| 427 | return [] |
| 428 | |
| 429 | assemblies: list[AssemblyDefinition] = [] |
| 430 | |
| 431 | for asmdef_path in assets_dir.rglob("*.asmdef"): |
| 432 | try: |
| 433 | asm = AssemblyDefinition.from_file(asmdef_path) |
| 434 | assemblies.append(asm) |
| 435 | except (json.JSONDecodeError, KeyError): |
| 436 | continue |
| 437 | |
| 438 | # Sort by name |
| 439 | assemblies.sort(key=lambda a: a.name) |
| 440 | return assemblies |
no test coverage detected