diff options
author | Jiyong Park <jiyong@google.com> | 2019-07-07 16:27:47 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-07-19 11:31:31 +0900 |
commit | 2907459e430f0cba0257badcc038817a73d570f3 (patch) | |
tree | a54297396cd29e7a46fce4a4b545c51ea20bfe47 /java/java_test.go | |
parent | 216e315a34cd4b7b727ed12afa437bd09e825731 (diff) |
filegroup.path is used to specify the include path for aidl files
filegroup {
name: "foo",
srcs: ["srcs/aidl/com/android/**/*.aidl"],
path: "srcs/aidl",
}
cc_library { // or java_library, etc.
name: "bar",
srcs: [":foo"],
}
automatically adds "-Ipath/to/foo/srcs/aidl" when compiling the aidl
files from foo for bar. This allows us to omit aidl include path
when using sources in other places via file group.
Bug: 135922046
Test: m (unit tests added)
Change-Id: I9b42f316f2858fb6da72c2f58a314f391416e809
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/java/java_test.go b/java/java_test.go index 5942afe00..4c85bed99 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -192,6 +192,7 @@ func testContext(bp string, fs map[string][]byte) *android.TestContext { "bar-doc/a.java": nil, "bar-doc/b.java": nil, "bar-doc/IFoo.aidl": nil, + "bar-doc/IBar.aidl": nil, "bar-doc/known_oj_tags.txt": nil, "external/doclava/templates-sdk": nil, @@ -754,11 +755,17 @@ func TestDroiddoc(t *testing.T) { name: "droiddoc-templates-sdk", path: ".", } + filegroup { + name: "bar-doc-aidl-srcs", + srcs: ["bar-doc/IBar.aidl"], + path: "bar-doc", + } droiddoc { name: "bar-doc", srcs: [ "bar-doc/*.java", "bar-doc/IFoo.aidl", + ":bar-doc-aidl-srcs", ], exclude_srcs: [ "bar-doc/b.java" @@ -786,8 +793,14 @@ func TestDroiddoc(t *testing.T) { for _, i := range inputs { javaSrcs = append(javaSrcs, i.Base()) } - if len(javaSrcs) != 2 || javaSrcs[0] != "a.java" || javaSrcs[1] != "IFoo.java" { - t.Errorf("inputs of bar-doc must be []string{\"a.java\", \"IFoo.java\", but was %#v.", javaSrcs) + if len(javaSrcs) != 3 || javaSrcs[0] != "a.java" || javaSrcs[1] != "IFoo.java" || javaSrcs[2] != "IBar.java" { + t.Errorf("inputs of bar-doc must be []string{\"a.java\", \"IFoo.java\", \"IBar.java\", but was %#v.", javaSrcs) + } + + aidlRule := ctx.ModuleForTests("bar-doc", "android_common").Output(inputs[2].String()) + aidlFlags := aidlRule.Args["aidlFlags"] + if !strings.Contains(aidlFlags, "-Ibar-doc") { + t.Errorf("aidl flags for IBar.aidl should contain \"-Ibar-doc\", but was %q", aidlFlags) } } |