Support aidl cpp generation

Ideally we'd calculate the headers that are written here too, but I'll
add that in a later change that actually enforces the generated header
list.

Test: mmma -j system/tools/aidl
Change-Id: Ifd2e8e8ff444b0f67270fb5156e7bf7bceddb6be
diff --git a/cc/compiler.go b/cc/compiler.go
index 04f536f..99f56b7 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -87,6 +87,15 @@
 	// if set to false, use -std=c++* instead of -std=gnu++*
 	Gnu_extensions *bool
 
+	Aidl struct {
+		// list of directories that will be added to the aidl include paths.
+		Include_dirs []string
+
+		// list of directories relative to the Blueprints file that will
+		// be added to the aidl include paths.
+		Local_include_dirs []string
+	}
+
 	Debug, Release struct {
 		// list of module-specific flags that will be used for C and C++ compiles in debug or
 		// release builds
@@ -341,6 +350,20 @@
 			"-I"+android.PathForModuleGen(ctx, "yacc", ctx.ModuleDir()).String())
 	}
 
+	if compiler.hasSrcExt(".aidl") {
+		if len(compiler.Properties.Aidl.Local_include_dirs) > 0 {
+			localAidlIncludeDirs := android.PathsForModuleSrc(ctx, compiler.Properties.Aidl.Local_include_dirs)
+			flags.aidlFlags = append(flags.aidlFlags, includeDirsToFlags(localAidlIncludeDirs))
+		}
+		if len(compiler.Properties.Aidl.Include_dirs) > 0 {
+			rootAidlIncludeDirs := android.PathsForSource(ctx, compiler.Properties.Aidl.Include_dirs)
+			flags.aidlFlags = append(flags.aidlFlags, includeDirsToFlags(rootAidlIncludeDirs))
+		}
+
+		flags.GlobalFlags = append(flags.GlobalFlags,
+			"-I"+android.PathForModuleGen(ctx, "aidl").String())
+	}
+
 	return flags
 }