mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
fix(codegen): drop grpcio-tools, stop committing generated code
The codegen only ever needed a protoc binary, but every entry point installed
grpcio-tools to get one. That drags in the grpcio C extension, which has no
Windows/ARM64 wheel and falls back to building from source there, so the ARM64
job died with "Failed building wheel for grpcio" -> "protoc not found".
tools/codegen_toolchain.py resolves the toolchain instead: protoc from $PROTOC,
PATH, a cache, grpc_tools when already installed, or a pinned checksum-verified
protoc release unpacked into .codegen-tools/; protobuf and pyyaml from the
calling interpreter or a cached virtualenv it re-execs into (distro Pythons
refuse `pip install` under PEP 668). All four build scripts and all three CI
jobs are now just `python tools/run_codegen.py`, with no pip lines around it.
tools/config_metadata_pb2.py was the one generated file checked into git. The
orca.* option extensions are now read out of the descriptor set, which already
carries config_metadata.proto via --include_imports, so nothing is generated
into the tree -- and the protobuf>=6.33.5,<7 CI pin goes away with it, since it
only existed to satisfy gencode's hard ValidateProtobufRuntimeVersion check.
Generated C++ verified byte-identical under upb and the pure-Python protobuf
runtime (what win/arm64 installs), and under both grpc_tools' and standalone
protoc.
Also fixed:
- build_release_macos.sh still passed -DPython3_EXECUTABLE=<codegen venv>,
pointing the bundled *embed* interpreter at the codegen environment -- the
same confusion fae4b124 fixed on the CMake side.
- Tab.cpp #includes TabLayout_generated.cpp but had no dependency on
codegen_config, so an incremental build after a .proto edit could compile it
while the file was being rewritten. libslic3r already had this guard.
- ConfigCodegen.cmake now probes with `codegen_toolchain.py --check` (which
never downloads or installs), prefers a host interpreter over the embed one,
and lets a fresh clone generate at configure time instead of erroring out.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
32
.github/workflows/build_orca.yml
vendored
32
.github/workflows/build_orca.yml
vendored
@@ -57,34 +57,18 @@ jobs:
|
||||
useLocalCache: true # <--= Use the local cache (default is 'false').
|
||||
useCloudCache: true
|
||||
|
||||
- name: Install codegen tools and generate config sources
|
||||
# grpcio-tools has no Windows/ARM64 wheel for current Python and fails to build its
|
||||
# grpcio C-extension from source there. The codegen only needs a protoc binary plus the
|
||||
# protobuf runtime and pyyaml, so install those directly (works on x64 and arm64 Windows;
|
||||
# the x64 protoc runs under emulation on arm64). protobuf must be >= the version the
|
||||
# committed config_metadata_pb2.py was generated with (see its runtime-version check).
|
||||
run: |
|
||||
pip install "protobuf>=6.33.5,<7" pyyaml
|
||||
$protocVer = "28.3"
|
||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/v$protocVer/protoc-$protocVer-win64.zip"
|
||||
Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\protoc.zip"
|
||||
Expand-Archive -Path "$env:RUNNER_TEMP\protoc.zip" -DestinationPath "$env:RUNNER_TEMP\protoc" -Force
|
||||
$env:PATH = "$env:RUNNER_TEMP\protoc\bin;$env:PATH"
|
||||
python tools/run_codegen.py
|
||||
# run_codegen.py resolves its own toolchain (a pinned protoc plus protobuf/pyyaml in a
|
||||
# cached virtualenv), so nothing has to be pip-installed around it. That is what makes it
|
||||
# work on windows-11-arm, where `pip install grpcio-tools` has no wheel and fails building
|
||||
# the grpcio C extension from source.
|
||||
- name: Generate config sources
|
||||
if: runner.os == 'Windows'
|
||||
run: python tools/run_codegen.py
|
||||
shell: pwsh
|
||||
|
||||
- name: Install codegen tools and generate config sources
|
||||
run: |
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
pip3 install grpcio-tools pyyaml
|
||||
python3 tools/run_codegen.py
|
||||
else
|
||||
python3 -m venv /tmp/codegen_venv
|
||||
/tmp/codegen_venv/bin/pip install grpcio-tools pyyaml -q
|
||||
/tmp/codegen_venv/bin/python tools/run_codegen.py
|
||||
fi
|
||||
- name: Generate config sources
|
||||
if: runner.os != 'Windows'
|
||||
run: python3 tools/run_codegen.py
|
||||
shell: bash
|
||||
- name: Install CMake 3.31.x (Windows ARM64)
|
||||
# windows-11-arm ships CMake 4.x, which removed pre-3.5 policy
|
||||
|
||||
Reference in New Issue
Block a user