unity-devkit 0.1.16__py3-none-any.whl → 0.1.17__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/dispatch_workflow_generator.py +31 -39
- {unity_devkit-0.1.16.dist-info → unity_devkit-0.1.17.dist-info}/METADATA +1 -1
- {unity_devkit-0.1.16.dist-info → unity_devkit-0.1.17.dist-info}/RECORD +5 -5
- {unity_devkit-0.1.16.dist-info → unity_devkit-0.1.17.dist-info}/WHEEL +0 -0
- {unity_devkit-0.1.16.dist-info → unity_devkit-0.1.17.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from collections import Counter
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Annotated
|
|
4
5
|
|
|
@@ -13,6 +14,7 @@ app = typer.Typer(add_completion=False, pretty_exceptions_show_locals=False)
|
|
|
13
14
|
|
|
14
15
|
DUMP_EXECUTE_METHOD = "Outernet.PlayerBuild.DumpEnvironment"
|
|
15
16
|
DISPATCH_INPUT_CAP = 25
|
|
17
|
+
RESERVED_INPUT_IDS = frozenset({"environment-preset", "development"})
|
|
16
18
|
NUMERIC_FIELD_TYPES = {
|
|
17
19
|
"Byte",
|
|
18
20
|
"SByte",
|
|
@@ -124,19 +126,26 @@ def extract_environment_dump(log_path: Path) -> EnvironmentDump:
|
|
|
124
126
|
|
|
125
127
|
def render_dispatch_workflow(dump: EnvironmentDump, *, project: str, output: str, build_workflow: str) -> str:
|
|
126
128
|
enums_by_name = {environment_enum.name: environment_enum for environment_enum in dump.enums}
|
|
127
|
-
|
|
129
|
+
emitted_fields = [field for field in dump.fields if field.path != dump.mode_field]
|
|
130
|
+
leaf_counts = Counter(field.path.rsplit(".", 1)[-1] for field in emitted_fields)
|
|
131
|
+
input_ids: dict[str, str] = {}
|
|
132
|
+
for field in emitted_fields:
|
|
133
|
+
leaf = field.path.rsplit(".", 1)[-1]
|
|
134
|
+
input_ids[field.path] = (
|
|
135
|
+
leaf if leaf_counts[leaf] == 1 and leaf not in RESERVED_INPUT_IDS else field.path.replace(".", "-")
|
|
136
|
+
)
|
|
137
|
+
default_preset = next(iter(dump.presets), "")
|
|
138
|
+
input_blocks: list[tuple[str, str | None, list[str], str | None]] = [
|
|
128
139
|
(
|
|
129
140
|
"environment-preset",
|
|
130
|
-
"
|
|
141
|
+
"Preset to apply — blank leaves the workspace untouched; leave fields empty to keep the preset's values",
|
|
131
142
|
["type: choice", "options:", *indent_lines([*(f'- "{preset}"' for preset in ("", *dump.presets))], 2)],
|
|
132
|
-
'default: ""',
|
|
143
|
+
f'default: "{default_preset}"',
|
|
133
144
|
),
|
|
134
|
-
("development", "Development build
|
|
145
|
+
("development", "Development build (debug symbols)", ["type: boolean"], "default: false"),
|
|
135
146
|
]
|
|
136
|
-
for field in
|
|
137
|
-
|
|
138
|
-
continue
|
|
139
|
-
input_blocks.append(field_input_block(field, enums_by_name))
|
|
147
|
+
for field in emitted_fields:
|
|
148
|
+
input_blocks.append(field_input_block(field, input_ids[field.path], enums_by_name))
|
|
140
149
|
|
|
141
150
|
input_count = len(input_blocks)
|
|
142
151
|
if input_count > DISPATCH_INPUT_CAP:
|
|
@@ -145,7 +154,7 @@ def render_dispatch_workflow(dump: EnvironmentDump, *, project: str, output: str
|
|
|
145
154
|
"Shrink the env class or move configuration out of it."
|
|
146
155
|
)
|
|
147
156
|
|
|
148
|
-
transport_lines = [field_transport_line(field) for field in
|
|
157
|
+
transport_lines = [field_transport_line(field, input_ids[field.path]) for field in emitted_fields]
|
|
149
158
|
header = (
|
|
150
159
|
f"# Generated by '{regen_command(project, output, build_workflow)}' from the environment class "
|
|
151
160
|
f"{dump.class_name} —"
|
|
@@ -182,32 +191,23 @@ def regen_command(project: str, output: str, build_workflow: str) -> str:
|
|
|
182
191
|
|
|
183
192
|
|
|
184
193
|
def field_input_block(
|
|
185
|
-
field: EnvironmentFieldDump, enums_by_name: dict[str, EnvironmentEnum]
|
|
186
|
-
) -> tuple[str, str, list[str], str | None]:
|
|
187
|
-
input_id = field.path.replace(".", "-")
|
|
194
|
+
field: EnvironmentFieldDump, input_id: str, enums_by_name: dict[str, EnvironmentEnum]
|
|
195
|
+
) -> tuple[str, str | None, list[str], str | None]:
|
|
188
196
|
if field.field_type == "Boolean":
|
|
189
|
-
return (
|
|
190
|
-
input_id,
|
|
191
|
-
f"environment field {field.path} (bool) — checked overrides the preset value",
|
|
192
|
-
["type: boolean"],
|
|
193
|
-
"default: false",
|
|
194
|
-
)
|
|
197
|
+
return (input_id, None, ["type: boolean"], "default: false")
|
|
195
198
|
|
|
196
199
|
if field.field_type in enums_by_name:
|
|
197
200
|
environment_enum = enums_by_name[field.field_type]
|
|
198
201
|
if environment_enum.flags:
|
|
199
202
|
return (
|
|
200
203
|
input_id,
|
|
201
|
-
(
|
|
202
|
-
f"environment field {field.path} (flags: {', '.join(environment_enum.values)}) — "
|
|
203
|
-
"comma-separated names, empty keeps the preset value"
|
|
204
|
-
),
|
|
204
|
+
f"comma-separated: {', '.join(environment_enum.values)}",
|
|
205
205
|
["type: string"],
|
|
206
206
|
'default: ""',
|
|
207
207
|
)
|
|
208
208
|
return (
|
|
209
209
|
input_id,
|
|
210
|
-
|
|
210
|
+
None,
|
|
211
211
|
[
|
|
212
212
|
"type: choice",
|
|
213
213
|
"options:",
|
|
@@ -217,20 +217,10 @@ def field_input_block(
|
|
|
217
217
|
)
|
|
218
218
|
|
|
219
219
|
if field.field_type == "String":
|
|
220
|
-
return (
|
|
221
|
-
input_id,
|
|
222
|
-
f"environment field {field.path} (string) — empty keeps the preset value",
|
|
223
|
-
["type: string"],
|
|
224
|
-
'default: ""',
|
|
225
|
-
)
|
|
220
|
+
return (input_id, None, ["type: string"], 'default: ""')
|
|
226
221
|
|
|
227
222
|
if field.field_type in NUMERIC_FIELD_TYPES:
|
|
228
|
-
return (
|
|
229
|
-
input_id,
|
|
230
|
-
f"environment field {field.path} ({field.field_type}) — empty keeps the preset value",
|
|
231
|
-
["type: number"],
|
|
232
|
-
None,
|
|
233
|
-
)
|
|
223
|
+
return (input_id, None, ["type: number"], None)
|
|
234
224
|
|
|
235
225
|
raise SystemExit(
|
|
236
226
|
f"Environment field '{field.path}' has type '{field.field_type}' — no dispatch input type maps to it "
|
|
@@ -238,8 +228,7 @@ def field_input_block(
|
|
|
238
228
|
)
|
|
239
229
|
|
|
240
230
|
|
|
241
|
-
def field_transport_line(field: EnvironmentFieldDump) -> str:
|
|
242
|
-
input_id = field.path.replace(".", "-")
|
|
231
|
+
def field_transport_line(field: EnvironmentFieldDump, input_id: str) -> str:
|
|
243
232
|
guard = "" if field.field_type == "Boolean" else " != ''"
|
|
244
233
|
return (
|
|
245
234
|
"${{ inputs['"
|
|
@@ -254,9 +243,12 @@ def field_transport_line(field: EnvironmentFieldDump) -> str:
|
|
|
254
243
|
)
|
|
255
244
|
|
|
256
245
|
|
|
257
|
-
def build_input_block(input_block: tuple[str, str, list[str], str | None]) -> list[str]:
|
|
246
|
+
def build_input_block(input_block: tuple[str, str | None, list[str], str | None]) -> list[str]:
|
|
258
247
|
input_id, description, type_lines, default_line = input_block
|
|
259
|
-
lines = [f"{input_id}:"
|
|
248
|
+
lines = [f"{input_id}:"]
|
|
249
|
+
if description is not None:
|
|
250
|
+
lines.append(f' description: "{description}"')
|
|
251
|
+
lines.extend(f" {line}" for line in type_lines)
|
|
260
252
|
if default_line is not None:
|
|
261
253
|
lines.append(f" {default_line}")
|
|
262
254
|
return lines
|
|
@@ -2,7 +2,7 @@ unity_devkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
unity_devkit/build_unity.py,sha256=iROcoytNTlDnS2NeGxzARvOyNW08tee2PEBuKV54vFA,1536
|
|
3
3
|
unity_devkit/ci_build_unity.py,sha256=XqYX--hUpvwYss7QCL1CNT8Jabiuz-DuEVrqqvK6PTE,3926
|
|
4
4
|
unity_devkit/compile_check_unity.py,sha256=dLo2-c7y28SN88-oDsxQQPGLq3oV-MfFWABw3KB97IQ,1227
|
|
5
|
-
unity_devkit/dispatch_workflow_generator.py,sha256=
|
|
5
|
+
unity_devkit/dispatch_workflow_generator.py,sha256=lPxCJjU16P-hLX_5z3wJKJ3lpDJ3lR8VnI7iR-1iy5Q,9286
|
|
6
6
|
unity_devkit/install.py,sha256=tUzqhobqAL0fI47w4vAMgP3IB69836cuK0iKsoO7btA,5945
|
|
7
7
|
unity_devkit/license.py,sha256=iiMdos8kMk4p5uYYroIWUzxvusXtcMRdPkIDXsYTC9c,1484
|
|
8
8
|
unity_devkit/license_restore.py,sha256=Tbt2Kt1axszqj4H6K5Fx9_nqRL-dpL5XTVnxnmP4PZw,1077
|
|
@@ -12,7 +12,7 @@ unity_devkit/player_build.py,sha256=a3AgpqHk64WfN3TwUMzhF_NuhOOghcbfHhetdhfha8U,
|
|
|
12
12
|
unity_devkit/projects.py,sha256=CBiIhnZUeGOSVznmlTCJ_Ey4P3FraBKSfZsvnVU0pXs,1971
|
|
13
13
|
unity_devkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
unity_devkit/test_unity.py,sha256=ayjoleM4Rnj0vbfVxiL52CofBukf12CBwRSrUvirqEA,1056
|
|
15
|
-
unity_devkit-0.1.
|
|
16
|
-
unity_devkit-0.1.
|
|
17
|
-
unity_devkit-0.1.
|
|
18
|
-
unity_devkit-0.1.
|
|
15
|
+
unity_devkit-0.1.17.dist-info/METADATA,sha256=OnYKknCqRZY-PRT8v5T48AacX4-lqPcfH_Yw6K1BVrE,290
|
|
16
|
+
unity_devkit-0.1.17.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
17
|
+
unity_devkit-0.1.17.dist-info/entry_points.txt,sha256=wdkAD7hjUPC4tDwe1ulAo5a0vWPXPO5sSGX1iN6VvJc,588
|
|
18
|
+
unity_devkit-0.1.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|