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

This commit is contained in:
Jooyung Han
2021-01-07 01:28:47 +00:00
committed by Gerrit Code Review
4 changed files with 43 additions and 0 deletions

View File

@@ -304,6 +304,9 @@ type CompilerDeviceProperties struct {
// whether to generate Binder#GetTransaction name method.
Generate_get_transaction_name *bool
// list of flags that will be passed to the AIDL compiler
Flags []string
}
// If true, export a copy of the module as a -hostdex module for host testing.
@@ -872,6 +875,8 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
var flags []string
var deps android.Paths
flags = append(flags, j.deviceProperties.Aidl.Flags...)
if aidlPreprocess.Valid() {
flags = append(flags, "-p"+aidlPreprocess.String())
deps = append(deps, aidlPreprocess.Path())

View File

@@ -2424,6 +2424,22 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) {
}
}
func TestAidlFlagsArePassedToTheAidlCompiler(t *testing.T) {
ctx, _ := testJava(t, `
java_library {
name: "foo",
srcs: ["aidl/foo/IFoo.aidl"],
aidl: { flags: ["-Werror"], },
}
`)
aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "-Werror"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
}
}
func TestDataNativeBinaries(t *testing.T) {
ctx, config := testJava(t, `
java_test_host {