From c49649c059ffa80433f7789250363728ce1f1608 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 1 Oct 2020 21:25:05 -0700 Subject: Use protobuf-codegen default and add mod_stem.rs * Upgrade to new protobuf-codegen; use its standard default output without local change. * Allow a sourceProvider to have multiple output files. For a stem.proto file, output stem.rs and mod_stem.rs. * New protobuf-codegen option gen_mod_rs always generates output file named "mod.rs". To generate multiple .proto files into the same output directory, we need to rename mod.rs to mod_.rs. * Instead of using the gen_mod_rs option and renaming mod.rs to mod_.rs, we generate the same mod_.rs directly with a simple printf command. Bug: 170256643 Test: atest -c --host --include-subdirs external/crosvm Change-Id: Ia09e41029099a6de4d35c96dbabd9ba5514c9019 --- rust/source_provider.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rust/source_provider.go') diff --git a/rust/source_provider.go b/rust/source_provider.go index 03adf9e6f..436518c70 100644 --- a/rust/source_provider.go +++ b/rust/source_provider.go @@ -30,7 +30,7 @@ type SourceProviderProperties struct { type BaseSourceProvider struct { Properties SourceProviderProperties - OutputFile android.Path + OutputFiles android.Paths subAndroidMkOnce map[SubAndroidMkProvider]bool subName string } @@ -43,11 +43,11 @@ type SourceProvider interface { SourceProviderProps() []interface{} SourceProviderDeps(ctx DepsContext, deps Deps) Deps setSubName(subName string) - setOutputFile(outputFile android.Path) + setOutputFiles(outputFiles android.Paths) } func (sp *BaseSourceProvider) Srcs() android.Paths { - return android.Paths{sp.OutputFile} + return sp.OutputFiles } func (sp *BaseSourceProvider) GenerateSource(ctx ModuleContext, deps PathDeps) android.Path { @@ -97,6 +97,6 @@ func (sp *BaseSourceProvider) setSubName(subName string) { sp.subName = subName } -func (sp *BaseSourceProvider) setOutputFile(outputFile android.Path) { - sp.OutputFile = outputFile +func (sp *BaseSourceProvider) setOutputFiles(outputFiles android.Paths) { + sp.OutputFiles = outputFiles } -- cgit v1.2.3-59-g8ed1b