diff options
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/java/java_test.go b/java/java_test.go index 0e936118c..d75be1817 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1082,16 +1082,26 @@ func TestDroiddoc(t *testing.T) { srcs: ["bar-doc/IBar.aidl"], path: "bar-doc", } - droiddoc { - name: "bar-doc", + droidstubs { + name: "bar-stubs", srcs: [ "bar-doc/a.java", - "bar-doc/IFoo.aidl", - ":bar-doc-aidl-srcs", ], exclude_srcs: [ "bar-doc/b.java" ], + api_levels_annotations_dirs: [ + "droiddoc-templates-sdk", + ], + api_levels_annotations_enabled: true, + } + droiddoc { + name: "bar-doc", + srcs: [ + ":bar-stubs", + "bar-doc/IFoo.aidl", + ":bar-doc-aidl-srcs", + ], custom_template: "droiddoc-templates-sdk", hdf: [ "android.whichdoc offline", @@ -1108,23 +1118,29 @@ func TestDroiddoc(t *testing.T) { "bar-doc/a.java": nil, "bar-doc/b.java": nil, }) - barDocModule := ctx.ModuleForTests("bar-doc", "android_common") - barDoc := barDocModule.Rule("javadoc") - notExpected := " -stubs " - if strings.Contains(barDoc.RuleParams.Command, notExpected) { - t.Errorf("bar-doc command contains flag %q to create stubs, but should not", notExpected) + barStubs := ctx.ModuleForTests("bar-stubs", "android_common") + barStubsOutputs, err := barStubs.Module().(*Droidstubs).OutputFiles("") + if err != nil { + t.Errorf("Unexpected error %q retrieving \"bar-stubs\" output file", err) + } + if len(barStubsOutputs) != 1 { + t.Errorf("Expected one output from \"bar-stubs\" got %s", barStubsOutputs) } - var javaSrcs []string - for _, i := range barDoc.Inputs { - javaSrcs = append(javaSrcs, i.Base()) + barStubsOutput := barStubsOutputs[0] + barDoc := ctx.ModuleForTests("bar-doc", "android_common") + javaDoc := barDoc.Rule("javadoc") + if g, w := javaDoc.Implicits.Strings(), barStubsOutput.String(); !inList(w, g) { + t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g) } - if len(javaSrcs) != 1 || javaSrcs[0] != "a.java" { - t.Errorf("inputs of bar-doc must be []string{\"a.java\"}, but was %#v.", javaSrcs) + + expected := "-sourcepath " + buildDir + "/.intermediates/bar-doc/android_common/srcjars " + if !strings.Contains(javaDoc.RuleParams.Command, expected) { + t.Errorf("bar-doc command does not contain flag %q, but should\n%q", expected, javaDoc.RuleParams.Command) } - aidl := barDocModule.Rule("aidl") - if g, w := barDoc.Implicits.Strings(), aidl.Output.String(); !inList(w, g) { + aidl := barDoc.Rule("aidl") + if g, w := javaDoc.Implicits.Strings(), aidl.Output.String(); !inList(w, g) { t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g) } @@ -1144,16 +1160,26 @@ func TestDroiddocArgsAndFlagsCausesError(t *testing.T) { srcs: ["bar-doc/IBar.aidl"], path: "bar-doc", } - droiddoc { - name: "bar-doc", + droidstubs { + name: "bar-stubs", srcs: [ "bar-doc/a.java", - "bar-doc/IFoo.aidl", - ":bar-doc-aidl-srcs", ], exclude_srcs: [ "bar-doc/b.java" ], + api_levels_annotations_dirs: [ + "droiddoc-templates-sdk", + ], + api_levels_annotations_enabled: true, + } + droiddoc { + name: "bar-doc", + srcs: [ + ":bar-stubs", + "bar-doc/IFoo.aidl", + ":bar-doc-aidl-srcs", + ], custom_template: "droiddoc-templates-sdk", hdf: [ "android.whichdoc offline", |