Skip to content

fix(ohos): build CMake crates with Ninja and ungate the cli sha256 helper - #6989

Open
shenjackyuanjie wants to merge 4 commits into
codewhale-hq:mainfrom
shenjackyuanjie:fix/ohos-windows-cmake-ninja
Open

shenjackyuanjie wants to merge 4 commits into
codewhale-hq:mainfrom
shenjackyuanjie:fix/ohos-windows-cmake-ninja

Conversation

@shenjackyuanjie

@shenjackyuanjie shenjackyuanjie commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6988.

Two fixes for the OpenHarmony cross-build.

1. scripts/ohos-env.ps1 exports CMAKE_GENERATOR=Ninja

aws-lc-sys builds through the cmake crate, which passes no -G. On Windows CMake then
defaults to the Visual Studio generator, which ignores the clang compiler that
ohos.toolchain.cmake sets and feeds its clang-only flags to cl.exe
(D8021: invalid numeric argument '/Wa,--noexecstack'). When ninja is not on PATH the
script falls back to the SDK-bundled build-tools/cmake/bin/ninja.exe and fails loudly when
neither exists.

2. sha256_hex/hex_bytes move to an ungated crate::hashing module in codewhale-cli

With the generator fixed, the OHOS build reached codewhale-cli and failed E0433: mod update
is #[cfg(not(target_env = "ohos"))], but cloud.rs (two sites) and cloud/work.rs (one site)
called crate::update::sha256_hex without the same gate. Those sites verify downloaded-content
integrity and Work task-context digests, so they stay compiled on OHOS; the helper now lives in
an ungated module, matching the shared codewhale_runtime::hashing implementation the TUI
already uses.

Verification (Windows, DevEco OpenHarmony native SDK 26.0.0, current main)

  • aws-lc-sys v0.45.0 builds in about 43 s, producing libaws_lc_0_45_0_crypto.a (5.9 MB)
  • cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli exits 0 in
    28 m 32 s; the binary is an ELF64 AArch64 PIE (116,462,208 bytes) needing only libc.so and
    libtime_service_ndk.so
  • cargo check -p codewhale-cli on the host target exits 0
  • cargo check -p codewhale-cli --tests exits 0
  • cargo fmt --all -- --check exits 0

中文说明

本 PR 修复 Issue #6988,包含两处改动:

  1. scripts/ohos-env.ps1 导出 CMAKE_GENERATOR=Ninja。 aws-lc-sys 通过 cmake crate 构建,该 crate 不传 -G;Windows 上 CMake 因此默认选中 Visual Studio 生成器,无视 ohos.toolchain.cmake 指定的 clang,把只属于 clang 的参数喂给 cl.exe(D8021)。PATH 中无 ninja 时回退 SDK 自带版本,两者皆无则明确失败。

  2. 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 c59004af508fc4153c40cfb14b33989f1f276e41 preserves @shenjackyuanjie's original commit 5c6a61ab7f74c466bb65be71addfc8897783bff9 and integrates main 248634f86842b3fca89ba73b067a363095e755eb. 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 c6874b50 passed 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.

…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.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:34

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

CodeWhale Bot 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OHOS cross-build fails on Windows (aws-lc-sys CMake uses the Visual Studio generator) and codewhale-cli then fails E0433

2 participants