From e1a3ce3609bb29d0ad6a0126ad30bb0cb222093d Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Wed, 2 Nov 2016 20:44:08 -0700 Subject: [PATCH] Add yacc generated headers to the include path Test: mmma -j system/tools/aidl Change-Id: I444c7f2b004877e027f67e36e016b528511e1a32 --- cc/compiler.go | 13 +++++++++---- cc/library.go | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cc/compiler.go b/cc/compiler.go index 454be5e3b..a14f39773 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -124,7 +124,7 @@ func (compiler *baseCompiler) compilerDeps(ctx BaseModuleContext, deps Deps) Dep deps.GeneratedSources = append(deps.GeneratedSources, compiler.Properties.Generated_sources...) deps.GeneratedHeaders = append(deps.GeneratedHeaders, compiler.Properties.Generated_headers...) - if compiler.hasProto() { + if compiler.hasSrcExt(".proto") { deps = protoDeps(ctx, deps, &compiler.Proto) } @@ -322,16 +322,21 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag flags.CFlags = append(flags.CFlags, "-DANDROID_STRICT") } - if compiler.hasProto() { + if compiler.hasSrcExt(".proto") { flags = protoFlags(ctx, flags, &compiler.Proto) } + if compiler.hasSrcExt(".y") || compiler.hasSrcExt(".yy") { + flags.GlobalFlags = append(flags.GlobalFlags, + "-I"+android.PathForModuleGen(ctx, "yacc", ctx.ModuleDir()).String()) + } + return flags } -func (compiler *baseCompiler) hasProto() bool { +func (compiler *baseCompiler) hasSrcExt(ext string) bool { for _, src := range compiler.Properties.Srcs { - if filepath.Ext(src) == ".proto" { + if filepath.Ext(src) == ext { return true } } diff --git a/cc/library.go b/cc/library.go index dcfc077d2..73efb9eab 100644 --- a/cc/library.go +++ b/cc/library.go @@ -477,7 +477,7 @@ func (library *libraryDecorator) link(ctx ModuleContext, library.reexportFlags(deps.ReexportedFlags) library.reexportDeps(deps.ReexportedFlagsDeps) - if library.baseCompiler.hasProto() { + if library.baseCompiler.hasSrcExt(".proto") { if library.Properties.Proto.Export_proto_headers { library.reexportFlags([]string{ "-I" + protoSubDir(ctx).String(),