Export Rust SourceProvider types and methods

The AIDL compiler now uses SourceProvider to compiler the generated Rust
code from system/tools/aidl/build/aidl_interface.go using its own
SourceProvider object, which needs access to baseSourceProvider and all
methods of SourceProvider.

Test: mmma system/tools/aidl with 1357705 applied
Change-Id: I226609a7fccca2e7e1bfbad5d69d1821d37e43a1
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 2224a9c..8442907 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -86,12 +86,12 @@
 }
 
 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
@@ -134,7 +134,7 @@
 		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 != "" {
@@ -158,12 +158,12 @@
 		},
 	})
 
-	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)
 }
 
@@ -181,27 +181,18 @@
 }
 
 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)
 	}