Sandbox inputs to aidl rule in cc
Bug: 279960133
Test: go test
Test: Remove hdrs prop from IDropBoxManagerService_aidl && run BUILD_BROKEN_DISABLE_BAZEL=true m libservices && Expect an error from aidl
Change-Id: Ifdb260d8e2da9a5767f1e212393de4134b210616
diff --git a/cc/compiler.go b/cc/compiler.go
index 5da745e..16f4a6e 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -565,6 +565,11 @@
"-I"+android.PathForModuleGen(ctx, "yacc", ctx.ModuleDir()).String())
}
+ if len(compiler.Properties.Aidl.Libs) > 0 &&
+ (len(compiler.Properties.Aidl.Include_dirs) > 0 || len(compiler.Properties.Aidl.Local_include_dirs) > 0) {
+ ctx.ModuleErrorf("aidl.libs and (aidl.include_dirs or aidl.local_include_dirs) can't be set at the same time. For aidl headers, please only use aidl.libs prop")
+ }
+
if compiler.hasAidl(deps) {
flags.aidlFlags = append(flags.aidlFlags, compiler.Properties.Aidl.Flags...)
if len(compiler.Properties.Aidl.Local_include_dirs) > 0 {
@@ -594,8 +599,14 @@
}
flags.aidlFlags = append(flags.aidlFlags, "--min_sdk_version="+aidlMinSdkVersion)
- flags.Local.CommonFlags = append(flags.Local.CommonFlags,
- "-I"+android.PathForModuleGen(ctx, "aidl").String())
+ if compiler.hasSrcExt(".aidl") {
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags,
+ "-I"+android.PathForModuleGen(ctx, "aidl").String())
+ }
+ if len(deps.AidlLibraryInfos) > 0 {
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags,
+ "-I"+android.PathForModuleGen(ctx, "aidl_library").String())
+ }
}
if compiler.hasSrcExt(".rscript") || compiler.hasSrcExt(".fs") {