summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2020-08-04 15:43:37 -0400
committer Ivan Lozano <ivanlozano@google.com> 2020-08-05 10:51:43 -0400
commitc564d2d5a46af4c213e424ee5a7ad7ff9cb2ba3a (patch)
treeef2c92477a3ff898e8d534947ef2ac9cfc2ba98d /rust/rust.go
parentb14e14151964df77548e37de84300b433592013e (diff)
Add support for custom bindgen binaries.
In some cases customized logic is required to generate the expected bindgen bindings. This adds support for rust_bindgen modules to define a HostTool module to use instead of bindgen. Bug: 161816141 Test: New Soong tests pass. Test: Local test case shows custom_binary module being used for bindgen generation. Change-Id: Id52aec4f25c38206d7e585d8e662be7836aa1d4b
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 01952477e..7ec2d736b 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -722,10 +722,11 @@ type dependencyTag struct {
}
var (
- rlibDepTag = dependencyTag{name: "rlibTag", library: true}
- dylibDepTag = dependencyTag{name: "dylib", library: true}
- procMacroDepTag = dependencyTag{name: "procMacro", proc_macro: true}
- testPerSrcDepTag = dependencyTag{name: "rust_unit_tests"}
+ customBindgenDepTag = dependencyTag{name: "customBindgenTag"}
+ rlibDepTag = dependencyTag{name: "rlibTag", library: true}
+ dylibDepTag = dependencyTag{name: "dylib", library: true}
+ procMacroDepTag = dependencyTag{name: "procMacro", proc_macro: true}
+ testPerSrcDepTag = dependencyTag{name: "rust_unit_tests"}
)
type autoDep struct {
@@ -1009,6 +1010,13 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
actx.AddVariationDependencies(commonDepVariations, cc.CrtEndDepTag, deps.CrtEnd)
}
+ if mod.sourceProvider != nil {
+ if bindgen, ok := mod.sourceProvider.(*bindgenDecorator); ok &&
+ bindgen.Properties.Custom_bindgen != "" {
+ actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), customBindgenDepTag,
+ bindgen.Properties.Custom_bindgen)
+ }
+ }
// proc_macros are compiler plugins, and so we need the host arch variant as a dependendcy.
actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), procMacroDepTag, deps.ProcMacros...)
}