Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binder_ndk_sys: Allow code to build inside a workspace #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ members = [
"tests",
]

exclude = ["target/*"]

[workspace.package]
edition = "2021"
version = "0.2.0"
Expand Down
8 changes: 6 additions & 2 deletions binder_ndk_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ rust-version = "1.67"

[lib]
crate-type = ["cdylib"]

[workspace]
"#;

fn build_stub() -> Result<()> {
Expand All @@ -42,7 +44,7 @@ fn build_stub() -> Result<()> {
f.flush()?;

let target = env::var("TARGET")?;
Command::new("cargo")
let s = Command::new("cargo")
.arg("build")
.arg("--target")
.arg(&target)
Expand All @@ -53,10 +55,12 @@ fn build_stub() -> Result<()> {
.current_dir(&project_path)
.status()?;

assert!(s.success(), "{s:?}");

// we always use debug build for stub due to speed!
println!(
"cargo:rustc-link-search={}",
format!("{}/{}/{}", outdir, target, "debug")
format_args!("{}/{}/{}", outdir, target, "debug")
);
println!("cargo:rustc-link-lib=binder_ndk");

Expand Down