Loading rust/bindgen.go +5 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import ( "strings" "github.com/google/blueprint" "github.com/google/blueprint/proptools" "android/soong/android" ccConfig "android/soong/cc/config" Loading Loading @@ -119,15 +120,17 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe cflags = append(cflags, "-isystem "+include.String()) } esc := proptools.NinjaAndShellEscapeList // Module defined clang flags and include paths cflags = append(cflags, b.Properties.Cflags...) cflags = append(cflags, esc(b.Properties.Cflags)...) for _, include := range b.Properties.Local_include_dirs { cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String()) implicits = append(implicits, android.PathForModuleSrc(ctx, include)) } bindgenFlags := defaultBindgenFlags bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Bindgen_flags, " ")) bindgenFlags = append(bindgenFlags, esc(b.Properties.Bindgen_flags)...) wrapperFile := android.OptionalPathForModuleSrc(ctx, b.Properties.Wrapper_src) if !wrapperFile.Valid() { Loading rust/bindgen_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ func TestRustBindgen(t *testing.T) { crate_name: "bindgen", stem: "libbindgen", source_stem: "bindings", bindgen_flags: ["--bindgen-flag"], cflags: ["--clang-flag"], bindgen_flags: ["--bindgen-flag.*"], cflags: ["--clang-flag()"], shared_libs: ["libfoo_shared"], static_libs: ["libfoo_static"], } Loading @@ -42,10 +42,11 @@ func TestRustBindgen(t *testing.T) { } `) libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a").Output("bindings.rs") if !strings.Contains(libbindgen.Args["flags"], "--bindgen-flag") { // Ensure that the flags are present and escaped if !strings.Contains(libbindgen.Args["flags"], "'--bindgen-flag.*'") { t.Errorf("missing bindgen flags in rust_bindgen rule: flags %#v", libbindgen.Args["flags"]) } if !strings.Contains(libbindgen.Args["cflags"], "--clang-flag") { if !strings.Contains(libbindgen.Args["cflags"], "'--clang-flag()'") { t.Errorf("missing clang cflags in rust_bindgen rule: cflags %#v", libbindgen.Args["cflags"]) } if !strings.Contains(libbindgen.Args["cflags"], "-Ishared_include") { Loading Loading
rust/bindgen.go +5 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import ( "strings" "github.com/google/blueprint" "github.com/google/blueprint/proptools" "android/soong/android" ccConfig "android/soong/cc/config" Loading Loading @@ -119,15 +120,17 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe cflags = append(cflags, "-isystem "+include.String()) } esc := proptools.NinjaAndShellEscapeList // Module defined clang flags and include paths cflags = append(cflags, b.Properties.Cflags...) cflags = append(cflags, esc(b.Properties.Cflags)...) for _, include := range b.Properties.Local_include_dirs { cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String()) implicits = append(implicits, android.PathForModuleSrc(ctx, include)) } bindgenFlags := defaultBindgenFlags bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Bindgen_flags, " ")) bindgenFlags = append(bindgenFlags, esc(b.Properties.Bindgen_flags)...) wrapperFile := android.OptionalPathForModuleSrc(ctx, b.Properties.Wrapper_src) if !wrapperFile.Valid() { Loading
rust/bindgen_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ func TestRustBindgen(t *testing.T) { crate_name: "bindgen", stem: "libbindgen", source_stem: "bindings", bindgen_flags: ["--bindgen-flag"], cflags: ["--clang-flag"], bindgen_flags: ["--bindgen-flag.*"], cflags: ["--clang-flag()"], shared_libs: ["libfoo_shared"], static_libs: ["libfoo_static"], } Loading @@ -42,10 +42,11 @@ func TestRustBindgen(t *testing.T) { } `) libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a").Output("bindings.rs") if !strings.Contains(libbindgen.Args["flags"], "--bindgen-flag") { // Ensure that the flags are present and escaped if !strings.Contains(libbindgen.Args["flags"], "'--bindgen-flag.*'") { t.Errorf("missing bindgen flags in rust_bindgen rule: flags %#v", libbindgen.Args["flags"]) } if !strings.Contains(libbindgen.Args["cflags"], "--clang-flag") { if !strings.Contains(libbindgen.Args["cflags"], "'--clang-flag()'") { t.Errorf("missing clang cflags in rust_bindgen rule: cflags %#v", libbindgen.Args["cflags"]) } if !strings.Contains(libbindgen.Args["cflags"], "-Ishared_include") { Loading