Merge "Add proto.canonical_path_from_root" am: 7c695eb797 am: c530837d4c

am: fb408c8e6d

Change-Id: I6bfe260cc2c8d67f73bdbb1eb70ee1df6bf33de4
This commit is contained in:
Dan Willemsen
2018-02-23 21:00:53 +00:00
committed by android-build-merger
10 changed files with 77 additions and 40 deletions

View File

@@ -23,8 +23,7 @@ package android
// generate the source.
func ProtoFlags(ctx ModuleContext, p *ProtoProperties) []string {
// -I . must come first, it affects where protoc places the output files.
protoFlags := []string{"-I ."}
protoFlags := []string{}
if len(p.Proto.Local_include_dirs) > 0 {
localProtoIncludeDirs := PathsForModuleSrc(ctx, p.Proto.Local_include_dirs)
@@ -38,6 +37,13 @@ func ProtoFlags(ctx ModuleContext, p *ProtoProperties) []string {
return protoFlags
}
func ProtoCanonicalPathFromRoot(ctx ModuleContext, p *ProtoProperties) bool {
if p.Proto.Canonical_path_from_root == nil {
return true
}
return *p.Proto.Canonical_path_from_root
}
// ProtoDir returns the module's "gen/proto" directory
func ProtoDir(ctx ModuleContext) ModuleGenPath {
return PathForModuleGen(ctx, "proto")
@@ -59,5 +65,14 @@ type ProtoProperties struct {
// list of directories relative to the bp file that will
// be added to the protoc include paths.
Local_include_dirs []string
// whether to identify the proto files from the root of the
// source tree (the original method in Android, useful for
// android-specific protos), or relative from where they were
// specified (useful for external/third party protos).
//
// This defaults to true today, but is expected to default to
// false in the future.
Canonical_path_from_root *bool
} `android:"arch_variant"`
}