unity-devkit 0.3.2__py3-none-any.whl → 0.3.3__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.
@@ -43,6 +43,11 @@ DOTNET_SDK_VERSION = "8.0.421"
43
43
  # are discovered.
44
44
  QUIET_FAILURE_SIGNATURES = ("An error occurred while resolving packages:",)
45
45
 
46
+ COMPILE_ERROR_PATTERN = re.compile(
47
+ r"^(?P<file>.+?)\((?P<line>\d+),(?P<column>\d+)\): error (?P<code>CS\d+): (?P<message>.+)$"
48
+ )
49
+ ANNOTATION_LIMIT = 10
50
+
46
51
 
47
52
  def run_unity_batchmode(
48
53
  project_path: Path,
@@ -100,14 +105,52 @@ def run_unity_batchmode(
100
105
  break
101
106
 
102
107
  if failure_block is not None:
108
+ report_compile_errors(lines)
103
109
  raise SystemExit(f"Unity reported a silent failure (exit code {returncode}):\n{failure_block}")
104
110
  if returncode != 0 and strict_exit:
111
+ report_compile_errors(lines)
105
112
  raise SystemExit(f"Unity exited {returncode}; full editor log at {log_path}")
106
113
  if returncode != 0:
107
114
  print(f" WARNING: Unity exited {returncode}; no package-manager failure found — full editor log at {log_path}")
108
115
  return log_path
109
116
 
110
117
 
118
+ def report_compile_errors(lines: list[str]) -> None:
119
+ counts: dict[tuple[str, int, str, str], int] = {}
120
+ for line in lines:
121
+ if line.startswith("[Script Updater]"):
122
+ continue
123
+ match = COMPILE_ERROR_PATTERN.match(line)
124
+ if match is None:
125
+ continue
126
+ key = (match["file"], int(match["line"]), match["code"], match["message"].strip())
127
+ counts[key] = counts.get(key, 0) + 1
128
+ if not counts:
129
+ return
130
+
131
+ print(f"Unity compile errors ({len(counts)} distinct):", file=sys.stderr)
132
+ for (file, line_number, code, message), count in counts.items():
133
+ print(f" {code} x{count} {file}:{line_number} {message}", file=sys.stderr)
134
+
135
+ if os.environ.get("GITHUB_ACTIONS") != "true":
136
+ return
137
+ for (file, line_number, code, message), count in list(counts.items())[:ANNOTATION_LIMIT]:
138
+ title = escape_annotation_property(f"{code} x{count}")
139
+ body = escape_annotation_data(f"{code}: {message}")
140
+ print(f"::error file={escape_annotation_property(file)},line={line_number},title={title}::{body}")
141
+ beyond_limit = len(counts) - ANNOTATION_LIMIT
142
+ if beyond_limit > 0:
143
+ print(f"::error::{escape_annotation_data(f'...and {beyond_limit} more distinct compile errors')}")
144
+
145
+
146
+ def escape_annotation_data(value: str) -> str:
147
+ return value.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
148
+
149
+
150
+ def escape_annotation_property(value: str) -> str:
151
+ return escape_annotation_data(value).replace(":", "%3A").replace(",", "%2C")
152
+
153
+
111
154
  def read_editor_version(project_path: Path) -> str:
112
155
  version_file = project_path / "ProjectSettings" / "ProjectVersion.txt"
113
156
  version = editor_version(project_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: unity-devkit
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Unity build, license, and CI tooling
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: bashrun>=0.1.0
@@ -7,12 +7,12 @@ unity_devkit/license.py,sha256=ESst2YYj2h2JWMqcQs07jIZkS9FfG4_g2HEwhZyVssE,813
7
7
  unity_devkit/license_restore.py,sha256=tMRxGkn_I0cCKBV8Sg_2NPFS97JJhctAsmRhJ5mcz_0,2417
8
8
  unity_devkit/lock_unity.py,sha256=-1d-mHva5XUOlki8LSO5qwABR52q7jzc7FTJnnTH9f8,1012
9
9
  unity_devkit/matrix.py,sha256=URDN-UJ-Q9SaU_qBhl-Koc2lEeIJkE6IpwyKnfsxlMw,2336
10
- unity_devkit/player_build.py,sha256=F7z41qybrE6mIV7YSCHSxuSS_wtbKv0jyubiIVdb0nU,11482
10
+ unity_devkit/player_build.py,sha256=YXHolDPjU4w4H-fquchhrWhSuxN56ewfM2KjyLbI1UI,13248
11
11
  unity_devkit/projects.py,sha256=PO5plIj-mn8KkKOUhGRRIL_sDdd6ohl12neS2poILhs,2665
12
12
  unity_devkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  unity_devkit/test_unity.py,sha256=SpeWnV2hpdZBaGsstL8RTO50C2HEAcvantzBQYeaTpE,1075
14
14
  unity_devkit/upm_cache.py,sha256=s4-Op9aIebcjk5pFTciSomHfAAR8KDp2nMzIZlC5icg,1158
15
- unity_devkit-0.3.2.dist-info/METADATA,sha256=u3Ole3TTTUTxECDwjl6TB_8jpXwJPfezEzbgQT9cIuU,308
16
- unity_devkit-0.3.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
17
- unity_devkit-0.3.2.dist-info/entry_points.txt,sha256=_GfnlOh8IWYzCh2Z8QVXMiJqppcNx8_sj0MX1d_Vky0,471
18
- unity_devkit-0.3.2.dist-info/RECORD,,
15
+ unity_devkit-0.3.3.dist-info/METADATA,sha256=rzh0ATIyBDHnruQXMJchqbHzQxDHwS-tKiCyFMRme5I,308
16
+ unity_devkit-0.3.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
17
+ unity_devkit-0.3.3.dist-info/entry_points.txt,sha256=_GfnlOh8IWYzCh2Z8QVXMiJqppcNx8_sj0MX1d_Vky0,471
18
+ unity_devkit-0.3.3.dist-info/RECORD,,