From a3b25001e86f90e69f9bed135031ea17d7d9cb7e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 15 Dec 2017 13:41:30 -0800 Subject: [PATCH] Ensure -I . is the first protoc argument The first include directory affects where protoc places the output files. Ensure -I . is always the first protoc argument. Bug: 70704330 Test: m checkbuild Change-Id: I4992e4074f612409865e6e18dc8993c6f68385fd --- android/proto.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/proto.go b/android/proto.go index 1c70656e2..0cf7c26e1 100644 --- a/android/proto.go +++ b/android/proto.go @@ -23,7 +23,9 @@ package android // generate the source. func ProtoFlags(ctx ModuleContext, p *ProtoProperties) []string { - var protoFlags []string + // -I . must come first, it affects where protoc places the output files. + protoFlags := []string{"-I ."} + if len(p.Proto.Local_include_dirs) > 0 { localProtoIncludeDirs := PathsForModuleSrc(ctx, p.Proto.Local_include_dirs) protoFlags = append(protoFlags, JoinWithPrefix(localProtoIncludeDirs.Strings(), "-I")) @@ -33,8 +35,6 @@ func ProtoFlags(ctx ModuleContext, p *ProtoProperties) []string { protoFlags = append(protoFlags, JoinWithPrefix(rootProtoIncludeDirs.Strings(), "-I")) } - protoFlags = append(protoFlags, "-I .") - return protoFlags }