Shard aidl compiles into srcjars

Group aidl files into groups of 50 and compile them together into a
srcjar.

Bug: 124333557
Test: m checkbuild
Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
This commit is contained in:
Colin Cross
2019-06-14 18:51:47 -07:00
parent 9516a6c3f2
commit c080617c8b
4 changed files with 95 additions and 41 deletions

View File

@@ -18,6 +18,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"testing"
@@ -811,19 +812,22 @@ func TestDroiddoc(t *testing.T) {
}
`)
inputs := ctx.ModuleForTests("bar-doc", "android_common").Rule("javadoc").Inputs
barDoc := ctx.ModuleForTests("bar-doc", "android_common").Rule("javadoc")
var javaSrcs []string
for _, i := range inputs {
for _, i := range barDoc.Inputs {
javaSrcs = append(javaSrcs, i.Base())
}
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)
if len(javaSrcs) != 1 || javaSrcs[0] != "a.java" {
t.Errorf("inputs of bar-doc must be []string{\"a.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)
aidl := ctx.ModuleForTests("bar-doc", "android_common").Rule("aidl")
if g, w := barDoc.Implicits.Strings(), aidl.Output.String(); !inList(w, g) {
t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
}
if g, w := aidl.Implicits.Strings(), []string{"bar-doc/IBar.aidl", "bar-doc/IFoo.aidl"}; !reflect.DeepEqual(w, g) {
t.Errorf("aidl inputs must be %q, but was %q", w, g)
}
}