summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorLiz Kammer <eakammer@google.com>2020-08-14 12:14:02 -0700
committerLiz Kammer <eakammer@google.com>2020-08-31 08:16:22 -0700
commit3a55c91f9de31fdb2a7bba2360ddba347c11112e (patch)
tree14d02c73c6211f036c0e1bc6ede2f29a875851b1 /java/java_test.go
parent682c9d7b2538f8f7f2185296b91abf04835912fc (diff)
Remove create_stubs and checkapi from droiddoc
Test: m docs Test: go java tests Bug: 144248501 Bug: 143136634 Change-Id: Ic0da89332f3ed2e5e1bb36d00cb9cbd1f6282b45
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go66
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",