// Copyright 2018 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package java import ( "android/soong/android" "android/soong/java/config" "fmt" "path/filepath" "strings" "github.com/google/blueprint" ) var ( javadoc = pctx.AndroidStaticRule("javadoc", blueprint.RuleParams{ Command: `rm -rf "$outDir" "$srcJarDir" "$stubsDir" && mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` + `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + `${config.JavadocCmd} -encoding UTF-8 @$out.rsp @$srcJarDir/list ` + `$opts $bootclasspathArgs $classpathArgs -sourcepath $sourcepath ` + `-d $outDir -quiet && ` + `${config.SoongZipCmd} -write_if_changed -d -o $docZip -C $outDir -D $outDir && ` + `${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir`, CommandDeps: []string{ "${config.ZipSyncCmd}", "${config.JavadocCmd}", "${config.SoongZipCmd}", "$JsilverJar", "$DoclavaJar", }, Rspfile: "$out.rsp", RspfileContent: "$in", Restat: true, }, "outDir", "srcJarDir", "stubsDir", "srcJars", "opts", "bootclasspathArgs", "classpathArgs", "sourcepath", "docZip", "JsilverJar", "DoclavaJar") ) func init() { android.RegisterModuleType("doc_defaults", DocDefaultsFactory) android.RegisterModuleType("droiddoc", DroiddocFactory) android.RegisterModuleType("droiddoc_host", DroiddocHostFactory) android.RegisterModuleType("droiddoc_template", DroiddocTemplateFactory) android.RegisterModuleType("javadoc", JavadocFactory) android.RegisterModuleType("javadoc_host", JavadocHostFactory) } type JavadocProperties struct { // list of source files used to compile the Java module. May be .java, .logtags, .proto, // or .aidl files. Srcs []string `android:"arch_variant"` // list of directories rooted at the Android.bp file that will // be added to the search paths for finding source files when passing package names. Local_sourcepaths []string // list of source files that should not be used to build the Java module. // This is most useful in the arch/multilib variants to remove non-common files // filegroup or genrule can be included within this property. Exclude_srcs []string `android:"arch_variant"` // list of java libraries that will be in the classpath. Libs []string `android:"arch_variant"` // don't build against the framework libraries (legacy-test, core-junit, // ext, and framework for device targets) No_framework_libs *bool // the java library (in classpath) for documentation that provides java srcs and srcjars. Srcs_lib *string // the base dirs under srcs_lib will be scanned for java srcs. Srcs_lib_whitelist_dirs []string // the sub dirs under srcs_lib_whitelist_dirs will be scanned for java srcs. Srcs_lib_whitelist_pkgs []string // If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true. Installable *bool // if not blank, set to the version of the sdk to compile against Sdk_version *string `android:"arch_variant"` } type DroiddocProperties struct { // directory relative to top of the source tree that contains doc templates files. Custom_template *string // directories relative to top of the source tree which contains html/jd files. Html_dirs []string // set a value in the Clearsilver hdf namespace. Hdf []string // proofread file contains all of the text content of the javadocs concatenated into one file, // suitable for spell-checking and other goodness. Proofread_file *string // a todo file lists the program elements that are missing documentation. // At some point, this might be improved to show more warnings. Todo_file *string // directory under current module source that provide additional resources (images). Resourcesdir *string // resources output directory under out/soong/.intermediates. Resourcesoutdir *string // local files that are used within user customized droiddoc options. Arg_files []string // user customized droiddoc args. // Available variables for substitution: // // $(location