Add "aidl.flags:" property for cc_/java_ modules

The property can be used to pass additional flags to the AIDL compiler.
For example,

  cc_library {
    ..
    srcs: ["Foo.aidl"],
    aidl: {
      flags: [
        "-Werror",      // warnings as error
        "-Weverything", // turn on all warnings
      ],
    },
  }

Bug: 168028537
Test: soong test
Change-Id: I8120eeae7cd7b1acdd34c554af996a29e760a368
This commit is contained in:
Jooyung Han
2021-01-05 10:33:16 +09:00
parent 591920fcfa
commit e197d8b174
4 changed files with 43 additions and 0 deletions

View File

@@ -123,6 +123,9 @@ type BaseCompilerProperties struct {
// whether to generate traces (for systrace) for this interface
Generate_traces *bool
// list of flags that will be passed to the AIDL compiler
Flags []string
}
Renderscript struct {
@@ -521,6 +524,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
}
if compiler.hasSrcExt(".aidl") {
flags.aidlFlags = append(flags.aidlFlags, compiler.Properties.Aidl.Flags...)
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))