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
(cherry picked from https://android-review.googlesource.com/q/commit:095819530af067884e1b131d9332c8c4ace31295)
Merged-In: Ifdb260d8e2da9a5767f1e212393de4134b210616
Change-Id: Ifdb260d8e2da9a5767f1e212393de4134b210616
This commit is contained in:
Vinh Tran
2023-05-16 16:03:20 -04:00
committed by Cherrypicker Worker
parent 6d16b8894c
commit 0358fb73e8
7 changed files with 188 additions and 35 deletions

View File

@@ -565,6 +565,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
"-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 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
}
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") {