summaryrefslogtreecommitdiff
path: root/rust/bindgen.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2020-08-10 12:11:16 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-08-10 12:11:16 +0000
commita57e56a684cb0d250a4f9060c59f7cc5ae607ec3 (patch)
treebd7c1233a53267286ffac914d711625ab3e0105a /rust/bindgen.go
parent95647739aa7a7d926d1379e51a5311746e4c7ae8 (diff)
parentc7767922e06fd6513e0b1e6846a21dfe44df8823 (diff)
Merge "Export Rust SourceProvider types and methods"
Diffstat (limited to 'rust/bindgen.go')
-rw-r--r--rust/bindgen.go29
1 files changed, 10 insertions, 19 deletions
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 74b2777c3..9b09e616e 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -87,12 +87,12 @@ type BindgenProperties struct {
}
type bindgenDecorator struct {
- *baseSourceProvider
+ *BaseSourceProvider
Properties BindgenProperties
}
-func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDeps) android.Path {
+func (b *bindgenDecorator) GenerateSource(ctx android.ModuleContext, deps PathDeps) android.Path {
ccToolchain := ccConfig.FindToolchain(ctx.Os(), ctx.Arch())
var cflags []string
@@ -137,7 +137,7 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe
ctx.PropertyErrorf("wrapper_src", "invalid path to wrapper source")
}
- outputFile := android.PathForModuleOut(ctx, b.baseSourceProvider.getStem(ctx)+".rs")
+ outputFile := android.PathForModuleOut(ctx, b.BaseSourceProvider.getStem(ctx)+".rs")
var cmd, cmdDesc string
if b.Properties.Custom_bindgen != "" {
@@ -161,12 +161,12 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe
},
})
- b.baseSourceProvider.outputFile = outputFile
+ b.BaseSourceProvider.OutputFile = outputFile
return outputFile
}
-func (b *bindgenDecorator) sourceProviderProps() []interface{} {
- return append(b.baseSourceProvider.sourceProviderProps(),
+func (b *bindgenDecorator) SourceProviderProps() []interface{} {
+ return append(b.BaseSourceProvider.SourceProviderProps(),
&b.Properties)
}
@@ -184,27 +184,18 @@ func RustBindgenHostFactory() android.Module {
}
func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorator) {
- module := newModule(hod, android.MultilibBoth)
-
bindgen := &bindgenDecorator{
- baseSourceProvider: NewSourceProvider(),
+ BaseSourceProvider: NewSourceProvider(),
Properties: BindgenProperties{},
}
- _, library := NewRustLibrary(hod)
- library.BuildOnlyRust()
- library.setNoLint()
- library.sourceProvider = bindgen
-
- module.sourceProvider = bindgen
- module.compiler = library
- module.setClippy(false)
+ module := NewSourceProviderModule(hod, bindgen, false)
return module, bindgen
}
-func (b *bindgenDecorator) sourceProviderDeps(ctx DepsContext, deps Deps) Deps {
- deps = b.baseSourceProvider.sourceProviderDeps(ctx, deps)
+func (b *bindgenDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) Deps {
+ deps = b.BaseSourceProvider.SourceProviderDeps(ctx, deps)
if ctx.toolchain().Bionic() {
deps = bionicDeps(deps)
}