summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Nan Zhang <nanzhang@google.com> 2018-01-10 16:06:12 -0800
committer Nan Zhang <nanzhang@google.com> 2018-02-22 11:14:13 -0800
commit581fd21e9111138359d1685c3fea59e3466b2b58 (patch)
tree65b5fe896f3aa618a79ad2ed5b8dee4deed3f2dc /java/java_test.go
parent50b8682dcac9757783231ac23a3ae796d8f0f0ca (diff)
Droiddoc Support in Soong
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet based droiddoc compilation output is a "real" stubs.jar instead of a directory of java files and a timestamp file. The std doclet based javadoc compilation output is a "empty" stubs.jar instead of a timestamp file. The stubs.jar will be exported to out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar A $(LOCAL_MODULE).zip file will be generated also, and is exported to out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set to false. Bug: b/70351683 Test: unittest + convert libcore docs Android.mk to Soong manually. Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f (cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 19c5f21bc..eda229ba7 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -79,6 +79,8 @@ func testContext(config android.Config, bp string,
ctx.RegisterModuleType("java_genrule", android.ModuleFactoryAdaptor(genRuleFactory))
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(genrule.FileGroupFactory))
ctx.RegisterModuleType("genrule", android.ModuleFactoryAdaptor(genrule.GenRuleFactory))
+ ctx.RegisterModuleType("droiddoc", android.ModuleFactoryAdaptor(DroiddocFactory))
+ ctx.RegisterModuleType("droiddoc_host", android.ModuleFactoryAdaptor(DroiddocHostFactory))
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
@@ -168,6 +170,11 @@ func testContext(config android.Config, bp string,
"jdk8/jre/lib/jce.jar": nil,
"jdk8/jre/lib/rt.jar": nil,
+
+ "bar-doc/a.java": nil,
+ "bar-doc/b.java": nil,
+ "bar-doc/known_oj_tags.txt": nil,
+ "external/doclava/templates-sdk": nil,
}
for k, v := range fs {
@@ -856,6 +863,36 @@ func TestSharding(t *testing.T) {
}
}
+func TestDroiddoc(t *testing.T) {
+ ctx := testJava(t, `
+ droiddoc {
+ name: "bar-doc",
+ srcs: [
+ "bar-doc/*.java",
+ ],
+ exclude_srcs: [
+ "bar-doc/b.java"
+ ],
+ custom_template_dir: "external/doclava/templates-sdk",
+ hdf: [
+ "android.whichdoc offline",
+ ],
+ knowntags: [
+ "bar-doc/known_oj_tags.txt",
+ ],
+ proofread_file: "libcore-proofread.txt",
+ todo_file: "libcore-docs-todo.html",
+ args: "-offlinemode -title \"libcore\"",
+ }
+ `)
+
+ stubsJar := filepath.Join(buildDir, ".intermediates", "bar-doc", "android_common", "bar-doc-stubs.jar")
+ barDoc := ctx.ModuleForTests("bar-doc", "android_common").Output("bar-doc-stubs.jar")
+ if stubsJar != barDoc.Output.String() {
+ t.Errorf("expected stubs Jar [%q], got %q", stubsJar, barDoc.Output.String())
+ }
+}
+
func TestJarGenrules(t *testing.T) {
ctx := testJava(t, `
java_library {