fix(ohos): generate QuickJS bindings and gate unsupported PTY tools#4470
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves OpenHarmony (OHOS) support by enabling rquickjs bindgen for target_env = "ohos" and ensuring OHOS builds don’t pull in unsupported PTY-related dependencies, while documenting the resulting capability differences.
Changes:
- Configure OHOS environment setup scripts to locate the SDK
libclangand provide bindgen/clang sysroot args forrquickjs-sysbinding generation. - Enable
rquickjsbindgenfeature specifically forcfg(target_env = "ohos"). - Gate PTY-backed
terminal/*tools off on OHOS while keeping the non-PTYexec_shelltool path available, and document this behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/ohos-env.sh | Adds SDK libclang discovery and exports bindgen-related environment variables for OHOS builds. |
| scripts/ohos-env.ps1 | Ensures Windows OHOS setup validates libclang.dll and exports bindgen-related environment variables. |
| docs/HarmonyOS.md | Documents bindgen/libclang setup and the OHOS PTY tool availability difference. |
| crates/workflow-js/Cargo.toml | Enables rquickjs bindgen specifically on target_env = "ohos" for generated bindings. |
| crates/tui/src/tools/registry.rs | Disables registration of persistent PTY terminal tools on OHOS via cfg(target_env = "ohos"). |
| crates/tui/src/tools/mod.rs | Excludes the terminal_session module from OHOS builds to keep PTY dependencies out of the graph. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bbc26e7 to
0dfce7f
Compare
Extend check-ohos-deps.sh with a cargo-tree feature-graph assertion that the OHOS target activates rquickjs's bindgen feature (forwarded to rquickjs-sys) for codewhale-workflow-js — the only reason the crate compiles for a target with no pre-generated QuickJS bindings. Pure metadata: no SDK or target toolchain required. Positive path verified against current main (bindgen landed in Hmbown#4470); negative path verified against a non-OHOS target. Carried over from the Hmbown#4459 review lane; the OHOS bindgen approach was pioneered by @shenyongqing in Hmbown#4384. Signed-off-by: Hunter B <hmbown@gmail.com>
After Hmbown#4471 and Hmbown#4470 merged, the v0.9.1 contributor set grows to include @nightt5879 (Solarized Light fix) and @shenjackyuanjie (HarmonyOS workflow-js), with @AiurArtanis for the Solarized regression report and @shenyongqing for the original HarmonyOS bindgen approach. CHANGELOG.md, docs/CONTRIBUTORS.md, and web/lib/release-credits.ts are updated together so the exact-parity website contract test keeps passing (73/73). Signed-off-by: Hunter B <hmbown@gmail.com>
Point Cargo's Windows OHOS linker at a repository-local cmd launcher that delegates to the existing PowerShell clang wrapper. This keeps the target triple, SDK sysroot, and MUSL define on the final Rust link while preserving Cargo's arguments and the native linker exit status. Extend the no-SDK release gate and documentation to protect the full linker and rquickjs bindgen contract. Follow-up evidence from @shenjackyuanjie's PR #4470 completes the Windows linker path alongside @shenyongqing's original bindgen approach in PR #4384. Co-authored-by: shenjackyuanjie <54507071+shenjackyuanjie@users.noreply.github.com> Signed-off-by: Hunter B <hmbown@gmail.com>
|
Follow-up from @shenjackyuanjie’s OHOS findings is now merged on public |
Summary
rquickjsbindgen fortarget_env = "ohos"and configure the OpenHarmony SDK libclang/sysroot in both environment setup scriptsportable-ptyout of the OHOS dependency graph by omitting persistentterminal/*tools while retaining the non-PTYexec_shellpathVerification
cargo fmt --all -- --checkcargo check -p codewhale-tui --bin codewhale-tui --target aarch64-unknown-linux-ohos --lockedcargo test -p codewhale-tui --bin codewhale-tui --locked terminal_sessioncargo build --release -p codewhale-cli -p codewhale-tui --target aarch64-unknown-linux-ohos --locked/lib/ld-musl-aarch64.so.1