summaryrefslogtreecommitdiff
path: root/rust/bindgen.go
diff options
context:
space:
mode:
Diffstat (limited to 'rust/bindgen.go')
-rw-r--r--rust/bindgen.go21
1 files changed, 9 insertions, 12 deletions
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 9b09e616e..cafdb8bfa 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -21,22 +21,20 @@ import (
"github.com/google/blueprint/proptools"
"android/soong/android"
- ccConfig "android/soong/cc/config"
)
var (
defaultBindgenFlags = []string{""}
// bindgen should specify its own Clang revision so updating Clang isn't potentially blocked on bindgen failures.
- bindgenClangVersion = "clang-r383902c"
- bindgenLibClangSoGit = "11git"
+ bindgenClangVersion = "clang-r383902c"
//TODO(b/160803703) Use a prebuilt bindgen instead of the built bindgen.
_ = pctx.SourcePathVariable("bindgenCmd", "out/host/${config.HostPrebuiltTag}/bin/bindgen")
_ = pctx.SourcePathVariable("bindgenClang",
- "${ccConfig.ClangBase}/${config.HostPrebuiltTag}/"+bindgenClangVersion+"/bin/clang")
+ "${cc_config.ClangBase}/${config.HostPrebuiltTag}/"+bindgenClangVersion+"/bin/clang")
_ = pctx.SourcePathVariable("bindgenLibClang",
- "${ccConfig.ClangBase}/${config.HostPrebuiltTag}/"+bindgenClangVersion+"/lib64/libclang.so."+bindgenLibClangSoGit)
+ "${cc_config.ClangBase}/${config.HostPrebuiltTag}/"+bindgenClangVersion+"/lib64/")
//TODO(ivanlozano) Switch this to RuleBuilder
bindgen = pctx.AndroidStaticRule("bindgen",
@@ -92,24 +90,23 @@ type bindgenDecorator struct {
Properties BindgenProperties
}
-func (b *bindgenDecorator) GenerateSource(ctx android.ModuleContext, deps PathDeps) android.Path {
- ccToolchain := ccConfig.FindToolchain(ctx.Os(), ctx.Arch())
+func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) android.Path {
+ ccToolchain := ctx.RustModule().ccToolchain(ctx)
var cflags []string
var implicits android.Paths
- implicits = append(implicits, deps.depIncludePaths...)
- implicits = append(implicits, deps.depSystemIncludePaths...)
+ implicits = append(implicits, deps.depGeneratedHeaders...)
// Default clang flags
- cflags = append(cflags, "${ccConfig.CommonClangGlobalCflags}")
+ cflags = append(cflags, "${cc_config.CommonClangGlobalCflags}")
if ctx.Device() {
- cflags = append(cflags, "${ccConfig.DeviceClangGlobalCflags}")
+ cflags = append(cflags, "${cc_config.DeviceClangGlobalCflags}")
}
// Toolchain clang flags
cflags = append(cflags, "-target "+ccToolchain.ClangTriple())
- cflags = append(cflags, strings.ReplaceAll(ccToolchain.ToolchainClangCflags(), "${config.", "${ccConfig."))
+ cflags = append(cflags, strings.ReplaceAll(ccToolchain.ToolchainClangCflags(), "${config.", "${cc_config."))
// Dependency clang flags and include paths
cflags = append(cflags, deps.depClangFlags...)