Add rust_protobuf module.
This adds a new SourceProvider module type to handle protobuf code
generation. See the new test for an example of how to call this.
Bug: 143953733
Test: New soong tests pass.
Test: Replacing genrules in crosvm with rust_protobuf modules.
Change-Id: Ie3117129cde37b8736bc18ee09bf5cde27c01c34
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 10f10d8..edae0e6 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -165,14 +165,16 @@
stem, suffix, _ := android.SplitFileExt(file)
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
+ fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
})
}
func (bindgen *bindgenDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.SubAndroidMk(ret, bindgen.BaseSourceProvider)
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
- })
+}
+
+func (proto *protobufDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
+ ctx.SubAndroidMk(ret, proto.BaseSourceProvider)
}
func (compiler *baseCompiler) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {