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
This commit is contained in:
Treehugger Robot
2020-08-21 10:01:58 +00:00
committed by Ivan Lozano
parent 682c9d7b25
commit 588aae727b
6 changed files with 164 additions and 3 deletions

View File

@@ -165,14 +165,16 @@ func (sourceProvider *BaseSourceProvider) AndroidMk(ctx AndroidMkContext, ret *a
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) {