unity-devkit 0.1.25__py3-none-any.whl → 0.2.0.dev215__py3-none-any.whl
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.
- unity_devkit/build_unity.py +4 -2
- unity_devkit/ci_build_unity.py +29 -9
- unity_devkit/install.py +7 -7
- unity_devkit/player_build.py +3 -3
- {unity_devkit-0.1.25.dist-info → unity_devkit-0.2.0.dev215.dist-info}/METADATA +1 -1
- {unity_devkit-0.1.25.dist-info → unity_devkit-0.2.0.dev215.dist-info}/RECORD +8 -8
- {unity_devkit-0.1.25.dist-info → unity_devkit-0.2.0.dev215.dist-info}/WHEEL +0 -0
- {unity_devkit-0.1.25.dist-info → unity_devkit-0.2.0.dev215.dist-info}/entry_points.txt +0 -0
unity_devkit/build_unity.py
CHANGED
|
@@ -15,7 +15,9 @@ def build_unity(
|
|
|
15
15
|
str,
|
|
16
16
|
typer.Option(help="Version string to stamp into ProjectSettings.asset; empty builds unversioned"),
|
|
17
17
|
] = "",
|
|
18
|
-
|
|
18
|
+
version_code: Annotated[
|
|
19
|
+
int, typer.Option(help="Android bundleVersionCode to stamp; local builds default to 0")
|
|
20
|
+
] = 0,
|
|
19
21
|
development: Annotated[bool, typer.Option(help="Development build column")] = False,
|
|
20
22
|
environment_preset: Annotated[
|
|
21
23
|
str,
|
|
@@ -33,7 +35,7 @@ def build_unity(
|
|
|
33
35
|
project,
|
|
34
36
|
build,
|
|
35
37
|
version=version,
|
|
36
|
-
|
|
38
|
+
version_code=version_code,
|
|
37
39
|
development=development,
|
|
38
40
|
environment_preset=environment_preset,
|
|
39
41
|
environment_fields=fields,
|
unity_devkit/ci_build_unity.py
CHANGED
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
from typing import Annotated
|
|
6
6
|
|
|
7
7
|
import typer
|
|
8
|
-
from bashrun.bash import bash
|
|
8
|
+
from bashrun.bash import bash, bash_output
|
|
9
9
|
from pydantic_settings import BaseSettings
|
|
10
10
|
|
|
11
11
|
from ci_devkit.builds import build_repository, push_build
|
|
@@ -30,7 +30,9 @@ app = typer.Typer(add_completion=False, pretty_exceptions_show_locals=False)
|
|
|
30
30
|
def ci_build_unity(
|
|
31
31
|
project: Annotated[str, typer.Option(help="Project name")],
|
|
32
32
|
platform: Annotated[str, typer.Option(help="Target platform")],
|
|
33
|
-
|
|
33
|
+
version_code: Annotated[
|
|
34
|
+
int, typer.Option(help="Android bundleVersionCode (the per-app commit count from get-app-version)")
|
|
35
|
+
],
|
|
34
36
|
registry: Annotated[str, typer.Option(help="OCI registry root; the verb derives the cache and builds namespaces")],
|
|
35
37
|
pr_number: Annotated[
|
|
36
38
|
str, typer.Option(help="Pull-request number; empty on non-PR runs selects the dev cache scope")
|
|
@@ -75,7 +77,7 @@ def ci_build_unity(
|
|
|
75
77
|
project,
|
|
76
78
|
platform,
|
|
77
79
|
version=version,
|
|
78
|
-
|
|
80
|
+
version_code=version_code,
|
|
79
81
|
development=development,
|
|
80
82
|
environment_preset=environment_preset,
|
|
81
83
|
environment_fields=fields,
|
|
@@ -99,15 +101,22 @@ def ci_build_unity(
|
|
|
99
101
|
build_directory = project_path / "Build"
|
|
100
102
|
if build_directory.is_dir():
|
|
101
103
|
artifact_directory = Path("/tmp/unity-builds")
|
|
102
|
-
|
|
104
|
+
shutil.rmtree(artifact_directory, ignore_errors=True)
|
|
105
|
+
artifact_directory.mkdir(parents=True)
|
|
106
|
+
report_directory = Path("/tmp/unity-build-reports")
|
|
107
|
+
shutil.rmtree(report_directory, ignore_errors=True)
|
|
103
108
|
if platform == "Linux":
|
|
104
109
|
shutil.copytree(build_directory, artifact_directory, dirs_exist_ok=True)
|
|
105
110
|
else:
|
|
106
|
-
for file in build_directory.rglob("*")
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
binaries = [file for file in build_directory.rglob("*") if file.suffix in {".apk", ".exe"}]
|
|
112
|
+
if len(binaries) != 1:
|
|
113
|
+
raise SystemExit(
|
|
114
|
+
f"build for ({project}, {platform}) must produce exactly one binary, "
|
|
115
|
+
f"found {len(binaries)} ({', '.join(file.name for file in binaries)})"
|
|
116
|
+
)
|
|
117
|
+
shutil.copy2(binaries[0], artifact_directory / binaries[0].name)
|
|
109
118
|
for report in build_directory.rglob("BuildReport.json"):
|
|
110
|
-
destination =
|
|
119
|
+
destination = report_directory / report.relative_to(build_directory)
|
|
111
120
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
112
121
|
shutil.copy2(report, destination)
|
|
113
122
|
|
|
@@ -116,7 +125,8 @@ def ci_build_unity(
|
|
|
116
125
|
if not artifact_directory.is_dir() or not any(artifact_directory.iterdir()):
|
|
117
126
|
print("No build artifacts to push")
|
|
118
127
|
else:
|
|
119
|
-
|
|
128
|
+
head_sha = bash_output("git rev-parse HEAD").strip()
|
|
129
|
+
tags = (derived_cache_key, f"sha-{head_sha}")
|
|
120
130
|
if platform == "Linux":
|
|
121
131
|
staging = Path("/tmp/unity-builds-push")
|
|
122
132
|
staging.mkdir(parents=True, exist_ok=True)
|
|
@@ -135,5 +145,15 @@ def ci_build_unity(
|
|
|
135
145
|
)
|
|
136
146
|
for build_tag in tags:
|
|
137
147
|
push_build(builds_namespace, project, platform, build_tag, artifact_directory, paths)
|
|
148
|
+
|
|
149
|
+
report_directory = Path("/tmp/unity-build-reports")
|
|
150
|
+
if report_directory.is_dir():
|
|
151
|
+
report_paths = sorted(
|
|
152
|
+
str(path.relative_to(report_directory)) for path in report_directory.rglob("BuildReport.json")
|
|
153
|
+
)
|
|
154
|
+
for build_tag in tags:
|
|
155
|
+
push_build(
|
|
156
|
+
builds_namespace, project, f"{platform}-report", build_tag, report_directory, report_paths
|
|
157
|
+
)
|
|
138
158
|
repository = build_repository(builds_namespace, project, platform)
|
|
139
159
|
print(f"Pushed build artifacts: {repository} ({', '.join(tags)})")
|
unity_devkit/install.py
CHANGED
|
@@ -33,9 +33,9 @@ def main(
|
|
|
33
33
|
str,
|
|
34
34
|
typer.Option("--pr-number", help="Pull-request number; empty (outside PRs) selects the dev cache-key tag"),
|
|
35
35
|
] = "",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
typer.Option("--
|
|
36
|
+
sha: Annotated[
|
|
37
|
+
str | None,
|
|
38
|
+
typer.Option("--sha", help="CI head SHA whose sha-{sha} builds-shelf tag to pull"),
|
|
39
39
|
] = None,
|
|
40
40
|
serial: Annotated[str | None, typer.Option("--serial", "-s", help="adb device serial")] = None,
|
|
41
41
|
build_locally: Annotated[
|
|
@@ -45,7 +45,7 @@ def main(
|
|
|
45
45
|
"-B",
|
|
46
46
|
help=(
|
|
47
47
|
"Build the project locally via `build-unity` and install the produced APK / "
|
|
48
|
-
"linux executable. Skips the OCI pull; --pr-number / --
|
|
48
|
+
"linux executable. Skips the OCI pull; --pr-number / --sha are ignored."
|
|
49
49
|
),
|
|
50
50
|
),
|
|
51
51
|
] = False,
|
|
@@ -95,8 +95,8 @@ def main(
|
|
|
95
95
|
return
|
|
96
96
|
|
|
97
97
|
if build_locally:
|
|
98
|
-
if pr_number or
|
|
99
|
-
print("Warning: --pr-number / --
|
|
98
|
+
if pr_number or sha:
|
|
99
|
+
print("Warning: --pr-number / --sha are ignored when --build is set")
|
|
100
100
|
if dry_run:
|
|
101
101
|
print(f"Would build {project_name} [{target_name}] locally")
|
|
102
102
|
if target_name in ADB_TARGETS:
|
|
@@ -110,7 +110,7 @@ def main(
|
|
|
110
110
|
executables = [path for path in produced if path.suffix in {".exe", ".x86_64"}]
|
|
111
111
|
else:
|
|
112
112
|
parsed_pr_number = int(pr_number) if pr_number else None
|
|
113
|
-
tag = f"
|
|
113
|
+
tag = f"sha-{sha}" if sha else cache_key(project_name, target_name, parsed_pr_number)
|
|
114
114
|
|
|
115
115
|
registry = _builds_registry()
|
|
116
116
|
reference = build_reference(registry, project_name, target_name, tag)
|
unity_devkit/player_build.py
CHANGED
|
@@ -197,7 +197,7 @@ def build_player(
|
|
|
197
197
|
build: str,
|
|
198
198
|
*,
|
|
199
199
|
version: str = "",
|
|
200
|
-
|
|
200
|
+
version_code: int = 0,
|
|
201
201
|
development: bool = False,
|
|
202
202
|
environment_preset: str = "",
|
|
203
203
|
environment_fields: dict[str, str] | None = None,
|
|
@@ -220,10 +220,10 @@ def build_player(
|
|
|
220
220
|
if version:
|
|
221
221
|
settings_path = project_path / "ProjectSettings" / "ProjectSettings.asset"
|
|
222
222
|
rewritten = settings_path.read_text(encoding="utf-8")
|
|
223
|
-
for field_name, value in (("AndroidBundleVersionCode", str(
|
|
223
|
+
for field_name, value in (("AndroidBundleVersionCode", str(version_code)), ("bundleVersion", version)):
|
|
224
224
|
rewritten = replace_serialized_field(rewritten, field_name, value)
|
|
225
225
|
settings_path.write_text(rewritten, encoding="utf-8")
|
|
226
|
-
print(f"Stamped bundleVersion {version} (bundleVersionCode={
|
|
226
|
+
print(f"Stamped bundleVersion {version} (bundleVersionCode={version_code}) into ProjectSettings")
|
|
227
227
|
|
|
228
228
|
build_directory = project_path / "Build"
|
|
229
229
|
before = snapshot_artifacts(build_directory)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
unity_devkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
unity_devkit/build_unity.py,sha256=
|
|
3
|
-
unity_devkit/ci_build_unity.py,sha256=
|
|
2
|
+
unity_devkit/build_unity.py,sha256=LHQxx5gZ_Cff8WcD0PA46nWl5jqFgt5wobmKiaIRLMk,1573
|
|
3
|
+
unity_devkit/ci_build_unity.py,sha256=t8YWIWqJ55HoeqTaYlQTORrZbS5OWgOi25W0BffkiVs,7194
|
|
4
4
|
unity_devkit/compile_check_unity.py,sha256=tzxSywm8EI8RC93ibrkYkJ4deLs4MAN75qArt2unq3E,2335
|
|
5
5
|
unity_devkit/identity.py,sha256=8uuIU49EEX3FPA3FRBW6XFZZijRBcb3trEQmz0hbiL4,364
|
|
6
|
-
unity_devkit/install.py,sha256=
|
|
6
|
+
unity_devkit/install.py,sha256=HnFDlFIqDx7d4dOir1XvlCU90JZAn-GfPORDEHOSRLc,7724
|
|
7
7
|
unity_devkit/license.py,sha256=ssRe2xaKND4MOzQ-USx36pfUohIR4WgI3hca8nX67mo,1027
|
|
8
8
|
unity_devkit/license_restore.py,sha256=D73EPjCjKsW-7FFrkB8bK16hwQn_hAGphTGLgoxiyh4,2388
|
|
9
9
|
unity_devkit/lock_unity.py,sha256=-1d-mHva5XUOlki8LSO5qwABR52q7jzc7FTJnnTH9f8,1012
|
|
10
10
|
unity_devkit/matrix.py,sha256=PBpRe0w5KYvWXyNwEqVIsUN8uHJyAhUSjFxg3QgvtCc,2585
|
|
11
|
-
unity_devkit/player_build.py,sha256=
|
|
11
|
+
unity_devkit/player_build.py,sha256=z0D74HjNRqPig2PnhQ6xvr9mlWkitblIieeysQFQd88,11408
|
|
12
12
|
unity_devkit/projects.py,sha256=PO5plIj-mn8KkKOUhGRRIL_sDdd6ohl12neS2poILhs,2665
|
|
13
13
|
unity_devkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
unity_devkit/test_unity.py,sha256=SpeWnV2hpdZBaGsstL8RTO50C2HEAcvantzBQYeaTpE,1075
|
|
15
15
|
unity_devkit/upm_cache.py,sha256=wBN8PnJ96kcXSzKnrdfFmZIa8raaa0prNqIH6qgKNpA,1144
|
|
16
|
-
unity_devkit-0.
|
|
17
|
-
unity_devkit-0.
|
|
18
|
-
unity_devkit-0.
|
|
19
|
-
unity_devkit-0.
|
|
16
|
+
unity_devkit-0.2.0.dev215.dist-info/METADATA,sha256=N03ibX3rQX1xOhw-mHBWfzohFRPNtKckALDNy1OZbJs,297
|
|
17
|
+
unity_devkit-0.2.0.dev215.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
18
|
+
unity_devkit-0.2.0.dev215.dist-info/entry_points.txt,sha256=ma3InxWKmFwqjQ7e2bJV5cxgH3GYoU2m9wEAvVHczUI,520
|
|
19
|
+
unity_devkit-0.2.0.dev215.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|