step A(android): add cc=1 build-dep + compile single trivial hello.c
First incremental variable on the path back to Oboe integration. Changes
are deliberately minimal: add cc = "1" to [build-dependencies] (cargo
build-deps resolve against the host so the line is unconditional), and
on the Android target run a single cc::Build step that compiles
cpp/hello.c — a 6-line file that defines one function (`wzp_hello_stub`)
that is never called from Rust.
Goal: verify that merely introducing a C static library into the .so
via cc::Build does not regress the working build (#17, commit 5309938
= build #6 behaviour: launches, renders home screen, registers on
relay). If this build still works, we know cc::Build pipelines alone
are fine and can move to the next variable.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
// Capture short git hash so the running app can prove which build it is.
|
||||
// Falls back to "unknown" if git isn't available (e.g. when building from
|
||||
// a tarball without a .git dir).
|
||||
// ─── Embedded git hash ─────────────────────────────────────────────────
|
||||
let git_hash = Command::new("git")
|
||||
.args(["rev-parse", "--short", "HEAD"])
|
||||
.output()
|
||||
@@ -14,10 +12,22 @@ fn main() {
|
||||
.unwrap_or_else(|| "unknown".into());
|
||||
|
||||
println!("cargo:rustc-env=WZP_GIT_HASH={git_hash}");
|
||||
// Re-run if the HEAD pointer or its target moves so the embedded hash
|
||||
// tracks reality between builds.
|
||||
println!("cargo:rerun-if-changed=../../.git/HEAD");
|
||||
println!("cargo:rerun-if-changed=../../.git/refs/heads");
|
||||
|
||||
// ─── Step A: single trivial cpp/hello.c compiled via cc::Build ─────────
|
||||
// We deliberately add this on Android only so we can verify that the
|
||||
// cc::Build → static archive → rustc-link pipeline itself does not
|
||||
// regress the working build #17. cpp/hello.c defines `wzp_hello_stub`
|
||||
// which is never called from Rust — if the crash comes back just from
|
||||
// adding a tiny C static lib, we know the build pipeline is the issue.
|
||||
let target = std::env::var("TARGET").unwrap_or_default();
|
||||
if target.contains("android") {
|
||||
println!("cargo:rerun-if-changed=cpp/hello.c");
|
||||
cc::Build::new()
|
||||
.file("cpp/hello.c")
|
||||
.compile("wzp_hello");
|
||||
}
|
||||
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user