Revert "Revert "Remove create_stubs and checkapi from droiddoc""
This reverts commit 3666c7023f129fa4c38a11918e6e9e9a3a554b31.
Reason for revert: This was originally reverted because it caused a breakage (b/167405890) in a branch that is no longer relevant.
Change-Id: I81063cd47b816b5b3c0ab8427432730d6b881a3f
diff --git a/java/java_test.go b/java/java_test.go
index 0e93611..d75be18 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1082,16 +1082,26 @@
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 @@
"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())
- }
- if len(javaSrcs) != 1 || javaSrcs[0] != "a.java" {
- t.Errorf("inputs of bar-doc must be []string{\"a.java\"}, but was %#v.", javaSrcs)
+ 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)
}
- aidl := barDocModule.Rule("aidl")
- if g, w := barDoc.Implicits.Strings(), aidl.Output.String(); !inList(w, g) {
+ 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 := 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 @@
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",