Repository navigation
fix(ohos): build CMake crates with Ninja and ungate the cli sha256 helper - #6989
Open
shenjackyuanjie wants to merge 4 commits into
Open
shenjackyuanjie wants to merge 4 commits into
shenjackyuanjie wants to merge 4 commits into
Conversation
…lper The Windows OpenHarmony cross-build failed twice over. aws-lc-sys drives CMake through the cmake crate, which passes no -G; on Windows CMake then defaults to the Visual Studio generator, which ignores the clang compiler the OHOS toolchain file sets and feeds clang flags to cl.exe (error D8021). scripts/ohos-env.ps1 now exports CMAKE_GENERATOR=Ninja, falling back to the SDK-bundled ninja and failing loudly when neither exists. With that fixed, codewhale-cli for aarch64-unknown-linux-ohos hit E0433: mod update is cfg'd out on OHOS, but three cloud call sites reached for crate::update::sha256_hex without the same gate. Those sites verify downloaded content integrity, so they are not cfg'd out either; the helper and its hex encoder move to an ungated crate::hashing module, matching the shared codewhale_runtime::hashing implementation the TUI already uses. Verified: aws-lc-sys builds in 43.16s (libaws_lc_0_45_0_crypto.a, 5.9 MB); cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli exits 0 and produces a 111 MB ELF64 AArch64 PIE needing only libc.so and libtime_service_ndk.so; cargo check -p codewhale-cli exits 0 on the host target; cargo check -p codewhale-cli --tests exits 0; cargo fmt --all --check exits 0.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes address both build failures while preserving hashing behavior, with no unresolved findings.
0 open findings
What changed in this PR
Fixes Windows OpenHarmony cross-build failures by selecting Ninja and making CLI hashing available on OHOS.
Changes:
- Selects Ninja, with an SDK fallback and an explicit error if unavailable.
- Moves hashing helpers into an ungated module and updates callers without changing digest behavior.
| File | Description |
|---|---|
| scripts/ohos-env.ps1 | Configures Ninja and SDK fallback. |
| crates/cli/src/update.rs | Imports the relocated hashing helper. |
| crates/cli/src/lib.rs | Registers hashing without an OHOS gate. |
| crates/cli/src/hashing.rs | Houses the unchanged hashing helpers. |
| crates/cli/src/cloud/work.rs | Uses ungated hashing for context verification. |
| crates/cli/src/cloud.rs | Updates integrity-check and dispatch-stamp hashing calls. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
added 2 commits
October 15, 2026 10:06
Reconcile original PR codewhale-hq#6989 with main23e9119 while preserving shenjackyuanjie's commit5c6a61ab and unchanged CMake/hash implementation. The existing OHOS job compiled only codewhale-tui, so an ungated CLI call into the target-gated updater escaped it. Include codewhale-cli in the same real-SDK cargo check and trigger it for the PowerShell setup script. Preserve download/context integrity checks on OHOS. Credit the diagnosis and repair on all three release surfaces, and regenerate the TUI changelog. Existing contributor-credit checker: 10 contributors found, all3 surfaces PASS (exact original PR ancestry). Existing changelog sync check PASS; actionlint for changed workflow exit0; byte comparison confirms hashing implementation moved unchanged and all3 cloud callers only change module path. No new dependencies, production logic, test functions or code comments in this follow-up. Original CI38770088645 version gate failed missing website credit; Windows job116543508599 failed composer-readiness acceptance before native tests ran. Preserve that failure. Contributor-reported Windows OHOS release build is a separate self-report; current hosted OHOS success covers only the TUI. New-head CLI target, native, npm and web qualification remain pending before merge. No gate is waived and no release is published. Canonical checkout/index/HEAD remain unchanged. Refs codewhale-hq#6989, codewhale-hq#6988 Signed-off-by: CodeWhale Bot <bot@codewhale.net>
…#6989) The contributor-credit follow-up changed docs/CONTRIBUTORS.md but omitted its generated website snapshot, so exact-head web CI passed772 existing tests then failed check:facts for stale agent docs. Run the unchanged committed deriveAgentDocs owner against all39 exact-head source paths. The26 topics and52 source entries are retained; only the contribution topic source content/hash changes to include @shenjackyuanjie. Captured old snapshot fails derivation equality; regenerated snapshot passes. No native source, workflow, registry, test, or comment changes. Fresh hosted web/native qualification remains pending; no local full npm gate or release publication is claimed. Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Preserve the contributor's original history and integrate main 248634f. This carries authoritative, isolated Runtime fixtures and settlement of stale approval/input requests, plus the earlier macOS LLVM setup and Windows startup diagnostics. The clean merge retains this PR's measured budgets and gate policies. The OHOS Ninja setup, portable SHA helper and contributor credit are unchanged. Main repair validation: 387 existing focused Rust tests passed, 0 failed; npm 1312 passed, 0 failed, 7 skipped; check:web passed. Exact merged-tree review preserved each PR delta and the main repair. This resulting PR head still needs fresh hosted qualification; previous runs remain historical. No provider traffic, deployment or publication. Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Hmbown
pushed a commit
that referenced
this pull request
Oct 15, 2026
Retain the original candidate and contributor histories while qualifying the combined source in parallel with original PRs #6985 and #6989. Both contributor PRs must still land as themselves before this candidate's conditional squash. The source-navigation work in draft PR #6393 is excluded pending its author's scope decision and successful qualification. Include current main 248634f: worker ownership and late completion receipts, stale approval/input settlement, shared mock authority, isolated fixture workspaces, macOS LLVM setup and Windows clipboard launch diagnostics. Carry @henrikdukefoss's Standard Compute descriptor with Unknown billing and @shenjackyuanjie's OHOS Ninja selection and ungated CLI hashing unchanged. Resolve CI/credit/generated-document intersections, synchronize approval documentation with Engine execution IDs and captured input, and narrow the Windows 10 1607 statement to verified dynamic lookup behavior. Verification: object-only merge and authored/generated-document review; 72 feature rows and 26 documentation topics preserved; git diff --check passed. No build or native/npm test was run on this combined source. Prior source receipts remain separate; hosted exact-head qualification is required. Canonical main and its index remain unchanged. No publication is authorized. Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6988.
Two fixes for the OpenHarmony cross-build.
1.
scripts/ohos-env.ps1exportsCMAKE_GENERATOR=Ninjaaws-lc-sysbuilds through thecmakecrate, which passes no-G. On Windows CMake thendefaults to the Visual Studio generator, which ignores the clang compiler that
ohos.toolchain.cmakesets and feeds its clang-only flags tocl.exe(
D8021: invalid numeric argument '/Wa,--noexecstack'). Whenninjais not onPATHthescript falls back to the SDK-bundled
build-tools/cmake/bin/ninja.exeand fails loudly whenneither exists.
2.
sha256_hex/hex_bytesmove to an ungatedcrate::hashingmodule incodewhale-cliWith the generator fixed, the OHOS build reached
codewhale-cliand failed E0433:mod updateis
#[cfg(not(target_env = "ohos"))], butcloud.rs(two sites) andcloud/work.rs(one site)called
crate::update::sha256_hexwithout the same gate. Those sites verify downloaded-contentintegrity and Work task-context digests, so they stay compiled on OHOS; the helper now lives in
an ungated module, matching the shared
codewhale_runtime::hashingimplementation the TUIalready uses.
Verification (Windows, DevEco OpenHarmony native SDK 26.0.0, current main)
aws-lc-sysv0.45.0 builds in about 43 s, producinglibaws_lc_0_45_0_crypto.a(5.9 MB)cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cliexits 0 in28 m 32 s; the binary is an ELF64 AArch64 PIE (116,462,208 bytes) needing only
libc.soandlibtime_service_ndk.socargo check -p codewhale-clion the host target exits 0cargo check -p codewhale-cli --testsexits 0cargo fmt --all -- --checkexits 0中文说明
本 PR 修复 Issue #6988,包含两处改动:
scripts/ohos-env.ps1导出CMAKE_GENERATOR=Ninja。aws-lc-sys通过cmakecrate 构建,该 crate 不传-G;Windows 上 CMake 因此默认选中 Visual Studio 生成器,无视ohos.toolchain.cmake指定的 clang,把只属于 clang 的参数喂给cl.exe(D8021)。PATH 中无ninja时回退 SDK 自带版本,两者皆无则明确失败。sha256_hex/hex_bytes移至codewhale-cli未门控的crate::hashing模块。 生成器修好后 OHOS 构建走到codewhale-cli触发 E0433:mod update带有#[cfg(not(target_env = "ohos"))],而cloud.rs(两处)与cloud/work.rs(一处)未加门控地调用了crate::update::sha256_hex。这些调用承担下载内容完整性与任务上下文摘要校验,OHOS 上必须保留,因此把助手函数搬到未门控模块,与 TUI 已共享的codewhale_runtime::hashing实现保持一致。验证(Windows,DevEco OHOS native SDK 26.0.0,当前最新 main):
aws-lc-sys约 43 秒构建成功并产出libaws_lc_0_45_0_crypto.a(5.9 MB);cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli退出码 0(28 分 32 秒),产物为 116,462,208 字节的 ELF64 AArch64 PIE,仅依赖libc.so与libtime_service_ndk.so;宿主目标cargo check -p codewhale-cli与--tests退出码 0;cargo fmt --all -- --check通过。Maintainer qualification (2026-10-15)
Current head
c59004af508fc4153c40cfb14b33989f1f276e41preserves @shenjackyuanjie's original commit5c6a61ab7f74c466bb65be71addfc8897783bff9and integrates main248634f86842b3fca89ba73b067a363095e755eb. The contributor's six source files are unchanged. Follow-ups add CLI to the real-SDK OHOS check, include PowerShell setup in its triggers, credit the contribution on all three release surfaces and regenerate the owning docs. The clean latest merge carries main's Runtime fixture/authority repair, stale-request settlement, macOS LLVM setup and Windows startup diagnostics.Local workflow lint, contributor-credit and generated-changelog checks passed; the hashing implementation is byte-identical after relocation, and the three cloud call sites only change module path. Generated agent docs retain all 26 topics/52 entries from 39 source paths.
Previous own head
c6874b50passed Linux-hosted OHOS checking for TUI and CLI with SDK 6.1.0.31/API23; its actual checkout tree was verified equal. This is cross-compile checking, not a linked release or device run. The Windows/SDK26 build above remains contributor-reported validation. That head also passed 772 web tests and generated-doc/lint/type/build checks, plus actual runtime and persistence budget gates.Its Ubuntu native suite failed on inherited main Runtime fixtures (19,003 passed, 95 failed, 2 timed out, 34 skipped); Windows stopped before native tests because the clipboard harness timed out waiting for desktop readiness. Failure receipts are retained. The subsequent diagnostic change does not claim that startup cause is fixed. Main's Runtime repair passed 387 focused existing Rust tests, npm 1,312 tests (7 skipped), and check:web; the Windows-specific owner-lifetime branch still requires hosted execution.
Fresh resulting-head CI, OHOS and web qualification are pending. Earlier results do not qualify this new integration. This is candidate source work; 0.10.2 has not shipped.