ndk: expose libc++_shared.so and source.properties as labels #63
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 350 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.351
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #63"
general
weight: 0.35
AttilaTheFun
Expose the NDK sysroot's
libc++_shared.soandsource.propertiesas labelsWhy
@androidndkis great for C/C++ consumers: you register@androidndk//:alland the legacy crosstool
cc_toolchainis host-resolved through toolchainresolution. But a consumer that is not a
cc_rule can't go through thatpath. The motivating case is a Swift -> Android cross-compilation toolchain
(rules_swift):
swiftcneeds the NDK sysroot path directly at compile time(
swiftc -sdk <sysroot>) so its built-in clang importer can find the Androidsystem headers, and the resulting JNI
.soneeds the NDK'slibc++_shared.sopackaged into the APK (Swift links the C++ runtime).Today neither of those is reachable as a label:
libc++_shared.solives in the sysroot subpackage but the generated sysrootBUILD(from rules_android_ndk'sBUILD.ndk_sysroot.tpl) only exposes thestatic runtime libs (
static_runtime_lib_); the shared library is reachableonly through the coarse
all_filesglob, with no clean target.source.properties(the NDK version manifest at the repo root) isn't exported,so a consumer can't resolve it to discover the NDK root / per-host sysroot
directory.
Host resolution stays on the consumer side: you can't host-select a plain
file label out of
@androidndkviaselect()(aselect()resolves against thetarget platform, not the exec/host), so a consumer that needs a host artifact
resolves the per-host
@androidndk_<host>repo itself at repo-rule time. Thesetwo small additions are all it needs.
What
1.
ndk/BUILD.ndk_sysroot.tpl- a hermetic-owned copy of rules_android_ndk'ssysroot template, extended with a
libcxx_shared_<target_system>filegroup perAndroid target triple (pointing at
usr/lib/<triple>/libc++_shared.so). Theper-host repo rule now renders this template instead of
@rules_android_ndk//:BUILD.ndk_sysroot.tpl. Everything else in the templateis byte-for-byte the upstream behavior.
2.
ndk/BUILD.androidndk.bazel-exports_files(["source.properties"])so aconsumer can
rctx.path(Label("@androidndk_<host>//:source.properties")).dirnameto locate the NDK root and derive the sysroot directory.
No change to the cc-toolchain path or any existing target; this is strictly
additive. Validated by building the
basic_appexample (the sysroot template isrendered and consumed by the registered cc toolchain).
Consumer sketch (rules_swift)