unity-devkit 0.3.1.dev236__tar.gz → 0.3.2.dev243__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/PKG-INFO +1 -1
  2. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/pyproject.toml +1 -1
  3. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/compile_check_unity.py +23 -1
  4. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/.gitignore +0 -0
  5. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/__init__.py +0 -0
  6. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/build_unity.py +0 -0
  7. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/identity.py +0 -0
  8. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/install.py +0 -0
  9. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/license.py +0 -0
  10. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/license_restore.py +0 -0
  11. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/lock_unity.py +0 -0
  12. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/matrix.py +0 -0
  13. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/player_build.py +0 -0
  14. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/projects.py +0 -0
  15. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/py.typed +0 -0
  16. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/test_unity.py +0 -0
  17. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/src/unity_devkit/upm_cache.py +0 -0
  18. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_build_player.py +0 -0
  19. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_identity.py +0 -0
  20. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_matrix.py +0 -0
  21. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_prepare.py +0 -0
  22. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_projects.py +0 -0
  23. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_run_unity_batchmode.py +0 -0
  24. {unity_devkit-0.3.1.dev236 → unity_devkit-0.3.2.dev243}/tests/test_upm_cache.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: unity-devkit
3
- Version: 0.3.1.dev236
3
+ Version: 0.3.2.dev243
4
4
  Summary: Unity build, license, and CI tooling
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: bashrun>=0.1.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "unity-devkit"
3
- version = "0.3.1.dev236"
3
+ version = "0.3.2.dev243"
4
4
  description = "Unity build, license, and CI tooling"
5
5
  requires-python = ">=3.13"
6
6
  dependencies = [
@@ -1,11 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import shutil
4
+ from pathlib import Path
3
5
  from typing import Annotated
4
6
 
5
7
  import typer
6
8
 
9
+ from build_artifact_registry.cache import restore, save
7
10
  from build_artifact_registry.setup_oras import install_oras
8
- from .identity import cache_registry
11
+ from .identity import cache_key, cache_registry
9
12
  from .license_restore import restore_or_activate_license
10
13
  from .player_build import prepare_unity_project, resolve_unity_project, run_unity_batchmode
11
14
  from .upm_cache import restore_upm_cache, save_upm_cache
@@ -13,11 +16,15 @@ from .upm_cache import restore_upm_cache, save_upm_cache
13
16
  app = typer.Typer(add_completion=False, pretty_exceptions_show_locals=False)
14
17
 
15
18
  COMPILE_ERROR_SIGNATURES = ("error CS",)
19
+ COMPILE_CACHE_SCOPE = "compile"
16
20
 
17
21
 
18
22
  @app.command()
19
23
  def compile_check_unity(
20
24
  project: Annotated[str, typer.Option(help="Unity project name (the 'name' field of its unity-devkit.json)")],
25
+ pr_number: Annotated[
26
+ str, typer.Option(help="Pull-request number; empty on non-PR runs selects the dev library-cache scope")
27
+ ] = "",
21
28
  license_cache_key: Annotated[
22
29
  str,
23
30
  typer.Option("--license-cache-key", help="ORAS tag the license cache restores under; empty uses today's tag"),
@@ -28,13 +35,28 @@ def compile_check_unity(
28
35
  raise SystemExit("compile-check needs --registry (the OCI registry root)")
29
36
  project_path = resolve_unity_project(project).path
30
37
  cache_namespace = cache_registry(registry)
38
+ parsed_pr_number = int(pr_number) if pr_number else None
39
+ library_cache_key = cache_key(project, COMPILE_CACHE_SCOPE, parsed_pr_number)
31
40
 
32
41
  install_oras()
33
42
  restore_or_activate_license(cache_namespace, license_cache_key or None)
34
43
  restore_upm_cache(project_path, cache_namespace)
44
+ restore(
45
+ cache_namespace,
46
+ "unity-library",
47
+ library_cache_key,
48
+ Path("."),
49
+ fallback_tags=[cache_key(project, COMPILE_CACHE_SCOPE, None)] if parsed_pr_number is not None else None,
50
+ )
35
51
 
36
52
  print(f"Compile-checking {project}...")
37
53
  prepare_unity_project(project_path)
38
54
  run_unity_batchmode(project_path, extra_failure_signatures=COMPILE_ERROR_SIGNATURES)
55
+
56
+ package_cache = project_path / "Library" / "PackageCache"
57
+ if package_cache.exists():
58
+ shutil.rmtree(package_cache)
59
+ relative_project_path = project_path.relative_to(Path.cwd())
60
+ save(cache_namespace, "unity-library", library_cache_key, Path("."), [f"{relative_project_path}/Library/"])
39
61
  save_upm_cache(project_path, cache_namespace)
40
62
  print(" Compiles clean")