diff options
author | 2020-09-25 16:08:34 -0400 | |
---|---|---|
committer | 2020-09-25 16:15:26 -0400 | |
commit | bc9e421215be5ef92080ae239302c12f8821dcc1 (patch) | |
tree | 8b418e89fc24525c3e988d7e16a50883eafa99bd /rust/bindgen_test.go | |
parent | e0510d7a696b97b2477e82f35df69b5072165060 (diff) |
rust: Allow rust_bindgen to use cc_defaults.
rust_bindgen modules can't inherit properties in cc_defaults that would
be useful for generating bindings (such as cflags). This CL moves these
common properties out into a new struct in cc and adds that struct to
cc_default.
Additionally, Cppflags is added to rust_bindgen to make sure that these
get picked up as well from cc_defaults.
Bug: 163598610
Test: rust_bindgen module uses cflags in cc_defaults.
Test: New Soong test passes
Change-Id: I702442a355244dc01954083f98a2eebbcea12e47
Diffstat (limited to 'rust/bindgen_test.go')
-rw-r--r-- | rust/bindgen_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go index e69bce24d..9cccf13be 100644 --- a/rust/bindgen_test.go +++ b/rust/bindgen_test.go @@ -23,6 +23,7 @@ func TestRustBindgen(t *testing.T) { ctx := testRust(t, ` rust_bindgen { name: "libbindgen", + defaults: ["cc_defaults_flags"], wrapper_src: "src/any.h", crate_name: "bindgen", stem: "libbindgen", @@ -40,6 +41,10 @@ func TestRustBindgen(t *testing.T) { name: "libfoo_static", export_include_dirs: ["static_include"], } + cc_defaults { + name: "cc_defaults_flags", + cflags: ["--default-flag"], + } `) libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs") // Ensure that the flags are present and escaped @@ -55,6 +60,9 @@ func TestRustBindgen(t *testing.T) { if !strings.Contains(libbindgen.Args["cflags"], "-Istatic_include") { t.Errorf("missing static_libs exported includes in rust_bindgen rule: cflags %#v", libbindgen.Args["cflags"]) } + if !strings.Contains(libbindgen.Args["cflags"], "--default-flag") { + t.Errorf("rust_bindgen missing cflags defined in cc_defaults: cflags %#v", libbindgen.Args["cflags"]) + } } func TestRustBindgenCustomBindgen(t *testing.T) { |