Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 1 | // Copyright 2018 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package java |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | "android/soong/java/config" |
| 20 | "fmt" |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 21 | "path/filepath" |
Nan Zhang | 4613097 | 2018-06-04 11:28:01 -0700 | [diff] [blame] | 22 | "runtime" |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 23 | "strings" |
| 24 | |
| 25 | "github.com/google/blueprint" |
| 26 | ) |
| 27 | |
| 28 | var ( |
| 29 | javadoc = pctx.AndroidStaticRule("javadoc", |
| 30 | blueprint.RuleParams{ |
| 31 | Command: `rm -rf "$outDir" "$srcJarDir" "$stubsDir" && mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` + |
Colin Cross | 436b765 | 2018-03-15 16:24:10 -0700 | [diff] [blame] | 32 | `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 33 | `${config.JavadocCmd} -encoding UTF-8 @$out.rsp @$srcJarDir/list ` + |
| 34 | `$opts $bootclasspathArgs $classpathArgs -sourcepath $sourcepath ` + |
| 35 | `-d $outDir -quiet && ` + |
| 36 | `${config.SoongZipCmd} -write_if_changed -d -o $docZip -C $outDir -D $outDir && ` + |
| 37 | `${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir`, |
| 38 | CommandDeps: []string{ |
Colin Cross | 436b765 | 2018-03-15 16:24:10 -0700 | [diff] [blame] | 39 | "${config.ZipSyncCmd}", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 40 | "${config.JavadocCmd}", |
| 41 | "${config.SoongZipCmd}", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 42 | }, |
| 43 | Rspfile: "$out.rsp", |
| 44 | RspfileContent: "$in", |
| 45 | Restat: true, |
| 46 | }, |
| 47 | "outDir", "srcJarDir", "stubsDir", "srcJars", "opts", |
Nan Zhang | 3096374 | 2018-04-23 09:59:14 -0700 | [diff] [blame] | 48 | "bootclasspathArgs", "classpathArgs", "sourcepath", "docZip") |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 49 | |
| 50 | apiCheck = pctx.AndroidStaticRule("apiCheck", |
| 51 | blueprint.RuleParams{ |
| 52 | Command: `( ${config.ApiCheckCmd} -JXmx1024m -J"classpath $classpath" $opts ` + |
| 53 | `$apiFile $apiFileToCheck $removedApiFile $removedApiFileToCheck ` + |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 54 | `&& touch $out ) || (echo -e "$msg" ; exit 38)`, |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 55 | CommandDeps: []string{ |
| 56 | "${config.ApiCheckCmd}", |
| 57 | }, |
| 58 | }, |
| 59 | "classpath", "opts", "apiFile", "apiFileToCheck", "removedApiFile", "removedApiFileToCheck", "msg") |
| 60 | |
| 61 | updateApi = pctx.AndroidStaticRule("updateApi", |
| 62 | blueprint.RuleParams{ |
| 63 | Command: `( ( cp -f $apiFileToCheck $apiFile && cp -f $removedApiFileToCheck $removedApiFile ) ` + |
| 64 | `&& touch $out ) || (echo failed to update public API ; exit 38)`, |
| 65 | }, |
| 66 | "apiFile", "apiFileToCheck", "removedApiFile", "removedApiFileToCheck") |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 67 | |
| 68 | metalava = pctx.AndroidStaticRule("metalava", |
| 69 | blueprint.RuleParams{ |
| 70 | Command: `rm -rf "$outDir" "$srcJarDir" "$stubsDir" && mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` + |
| 71 | `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + |
| 72 | `${config.JavaCmd} -jar ${config.MetalavaJar} -encoding UTF-8 -source 1.8 @$out.rsp @$srcJarDir/list ` + |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 73 | `$bootclasspathArgs $classpathArgs -sourcepath $sourcepath --no-banner --color --quiet ` + |
| 74 | `--stubs $stubsDir $opts && ` + |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 75 | `${config.SoongZipCmd} -write_if_changed -d -o $docZip -C $outDir -D $outDir && ` + |
| 76 | `${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir`, |
| 77 | CommandDeps: []string{ |
| 78 | "${config.ZipSyncCmd}", |
| 79 | "${config.JavaCmd}", |
| 80 | "${config.MetalavaJar}", |
| 81 | "${config.JavadocCmd}", |
| 82 | "${config.SoongZipCmd}", |
| 83 | }, |
| 84 | Rspfile: "$out.rsp", |
| 85 | RspfileContent: "$in", |
| 86 | Restat: true, |
| 87 | }, |
| 88 | "outDir", "srcJarDir", "stubsDir", "srcJars", "bootclasspathArgs", "classpathArgs", "sourcepath", "opts", "docZip") |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 89 | ) |
| 90 | |
| 91 | func init() { |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 92 | android.RegisterModuleType("doc_defaults", DocDefaultsFactory) |
| 93 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 94 | android.RegisterModuleType("droiddoc", DroiddocFactory) |
| 95 | android.RegisterModuleType("droiddoc_host", DroiddocHostFactory) |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 96 | android.RegisterModuleType("droiddoc_template", DroiddocTemplateFactory) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 97 | android.RegisterModuleType("javadoc", JavadocFactory) |
| 98 | android.RegisterModuleType("javadoc_host", JavadocHostFactory) |
| 99 | } |
| 100 | |
| 101 | type JavadocProperties struct { |
| 102 | // list of source files used to compile the Java module. May be .java, .logtags, .proto, |
| 103 | // or .aidl files. |
| 104 | Srcs []string `android:"arch_variant"` |
| 105 | |
| 106 | // list of directories rooted at the Android.bp file that will |
| 107 | // be added to the search paths for finding source files when passing package names. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 108 | Local_sourcepaths []string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 109 | |
| 110 | // list of source files that should not be used to build the Java module. |
| 111 | // This is most useful in the arch/multilib variants to remove non-common files |
| 112 | // filegroup or genrule can be included within this property. |
| 113 | Exclude_srcs []string `android:"arch_variant"` |
| 114 | |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 115 | // list of java libraries that will be in the classpath. |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 116 | Libs []string `android:"arch_variant"` |
| 117 | |
Nan Zhang | e66c727 | 2018-03-06 12:59:27 -0800 | [diff] [blame] | 118 | // don't build against the framework libraries (legacy-test, core-junit, |
| 119 | // ext, and framework for device targets) |
| 120 | No_framework_libs *bool |
| 121 | |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 122 | // the java library (in classpath) for documentation that provides java srcs and srcjars. |
| 123 | Srcs_lib *string |
| 124 | |
| 125 | // the base dirs under srcs_lib will be scanned for java srcs. |
| 126 | Srcs_lib_whitelist_dirs []string |
| 127 | |
| 128 | // the sub dirs under srcs_lib_whitelist_dirs will be scanned for java srcs. |
| 129 | Srcs_lib_whitelist_pkgs []string |
| 130 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 131 | // If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 132 | Installable *bool |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 133 | |
| 134 | // if not blank, set to the version of the sdk to compile against |
| 135 | Sdk_version *string `android:"arch_variant"` |
Jiyong Park | 1e44068 | 2018-05-23 18:42:04 +0900 | [diff] [blame] | 136 | |
| 137 | Aidl struct { |
| 138 | // Top level directories to pass to aidl tool |
| 139 | Include_dirs []string |
| 140 | |
| 141 | // Directories rooted at the Android.bp file to pass to aidl tool |
| 142 | Local_include_dirs []string |
| 143 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 144 | } |
| 145 | |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 146 | type ApiToCheck struct { |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 147 | // path to the API txt file that the new API extracted from source code is checked |
| 148 | // against. The path can be local to the module or from other module (via :module syntax). |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 149 | Api_file *string |
| 150 | |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 151 | // path to the API txt file that the new @removed API extractd from source code is |
| 152 | // checked against. The path can be local to the module or from other module (via |
| 153 | // :module syntax). |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 154 | Removed_api_file *string |
| 155 | |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 156 | // Arguments to the apicheck tool. |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 157 | Args *string |
| 158 | } |
| 159 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 160 | type DroiddocProperties struct { |
| 161 | // directory relative to top of the source tree that contains doc templates files. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 162 | Custom_template *string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 163 | |
| 164 | // directories relative to top of the source tree which contains html/jd files. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 165 | Html_dirs []string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 166 | |
| 167 | // set a value in the Clearsilver hdf namespace. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 168 | Hdf []string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 169 | |
| 170 | // proofread file contains all of the text content of the javadocs concatenated into one file, |
| 171 | // suitable for spell-checking and other goodness. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 172 | Proofread_file *string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 173 | |
| 174 | // a todo file lists the program elements that are missing documentation. |
| 175 | // At some point, this might be improved to show more warnings. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 176 | Todo_file *string |
| 177 | |
| 178 | // directory under current module source that provide additional resources (images). |
| 179 | Resourcesdir *string |
| 180 | |
| 181 | // resources output directory under out/soong/.intermediates. |
| 182 | Resourcesoutdir *string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 183 | |
| 184 | // local files that are used within user customized droiddoc options. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 185 | Arg_files []string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 186 | |
| 187 | // user customized droiddoc args. |
| 188 | // Available variables for substitution: |
| 189 | // |
| 190 | // $(location <label>): the path to the arg_files with name <label> |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 191 | Args *string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 192 | |
| 193 | // names of the output files used in args that will be generated |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 194 | Out []string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 195 | |
| 196 | // a list of files under current module source dir which contains known tags in Java sources. |
| 197 | // filegroup or genrule can be included within this property. |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 198 | Knowntags []string |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 199 | |
| 200 | // the tag name used to distinguish if the API files belong to public/system/test. |
| 201 | Api_tag_name *string |
| 202 | |
| 203 | // the generated public API filename by Doclava. |
| 204 | Api_filename *string |
| 205 | |
David Brazdil | fbe4cc3 | 2018-05-31 13:56:46 +0100 | [diff] [blame] | 206 | // the generated public Dex API filename by Doclava. |
| 207 | Dex_api_filename *string |
| 208 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 209 | // the generated private API filename by Doclava. |
| 210 | Private_api_filename *string |
| 211 | |
| 212 | // the generated private Dex API filename by Doclava. |
| 213 | Private_dex_api_filename *string |
| 214 | |
| 215 | // the generated removed API filename by Doclava. |
| 216 | Removed_api_filename *string |
| 217 | |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 218 | // the generated removed Dex API filename by Doclava. |
| 219 | Removed_dex_api_filename *string |
| 220 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 221 | // the generated exact API filename by Doclava. |
| 222 | Exact_api_filename *string |
Nan Zhang | 853f420 | 2018-04-12 16:55:56 -0700 | [diff] [blame] | 223 | |
| 224 | // if set to false, don't allow droiddoc to generate stubs source files. Defaults to true. |
| 225 | Create_stubs *bool |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 226 | |
| 227 | Check_api struct { |
| 228 | Last_released ApiToCheck |
| 229 | |
| 230 | Current ApiToCheck |
| 231 | } |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 232 | |
| 233 | // if set to true, create stubs through Metalava instead of Doclava. Javadoc/Doclava is |
| 234 | // currently still used for documentation generation, and will be replaced by Dokka soon. |
| 235 | Metalava_enabled *bool |
| 236 | |
| 237 | // user can specify the version of previous released API file in order to do compatibility check. |
| 238 | Metalava_previous_api *string |
| 239 | |
| 240 | // is set to true, Metalava will allow framework SDK to contain annotations. |
| 241 | Metalava_annotations_enabled *bool |
| 242 | |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 243 | // a top level directory contains XML files set to merge annotations. |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 244 | Metalava_merge_annotations_dir *string |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | type Javadoc struct { |
| 248 | android.ModuleBase |
| 249 | android.DefaultableModuleBase |
| 250 | |
| 251 | properties JavadocProperties |
| 252 | |
| 253 | srcJars android.Paths |
| 254 | srcFiles android.Paths |
| 255 | sourcepaths android.Paths |
| 256 | |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 257 | docZip android.WritablePath |
| 258 | stubsSrcJar android.WritablePath |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 259 | } |
| 260 | |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 261 | func (j *Javadoc) Srcs() android.Paths { |
| 262 | return android.Paths{j.stubsSrcJar} |
| 263 | } |
| 264 | |
| 265 | var _ android.SourceFileProducer = (*Javadoc)(nil) |
| 266 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 267 | type Droiddoc struct { |
| 268 | Javadoc |
| 269 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 270 | properties DroiddocProperties |
| 271 | apiFile android.WritablePath |
David Brazdil | fbe4cc3 | 2018-05-31 13:56:46 +0100 | [diff] [blame] | 272 | dexApiFile android.WritablePath |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 273 | privateApiFile android.WritablePath |
| 274 | privateDexApiFile android.WritablePath |
| 275 | removedApiFile android.WritablePath |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 276 | removedDexApiFile android.WritablePath |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 277 | exactApiFile android.WritablePath |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 278 | |
| 279 | checkCurrentApiTimestamp android.WritablePath |
| 280 | updateCurrentApiTimestamp android.WritablePath |
| 281 | checkLastReleasedApiTimestamp android.WritablePath |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | func InitDroiddocModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { |
| 285 | android.InitAndroidArchModule(module, hod, android.MultilibCommon) |
| 286 | android.InitDefaultableModule(module) |
| 287 | } |
| 288 | |
| 289 | func JavadocFactory() android.Module { |
| 290 | module := &Javadoc{} |
| 291 | |
| 292 | module.AddProperties(&module.properties) |
| 293 | |
| 294 | InitDroiddocModule(module, android.HostAndDeviceSupported) |
| 295 | return module |
| 296 | } |
| 297 | |
| 298 | func JavadocHostFactory() android.Module { |
| 299 | module := &Javadoc{} |
| 300 | |
| 301 | module.AddProperties(&module.properties) |
| 302 | |
| 303 | InitDroiddocModule(module, android.HostSupported) |
| 304 | return module |
| 305 | } |
| 306 | |
| 307 | func DroiddocFactory() android.Module { |
| 308 | module := &Droiddoc{} |
| 309 | |
| 310 | module.AddProperties(&module.properties, |
| 311 | &module.Javadoc.properties) |
| 312 | |
| 313 | InitDroiddocModule(module, android.HostAndDeviceSupported) |
| 314 | return module |
| 315 | } |
| 316 | |
| 317 | func DroiddocHostFactory() android.Module { |
| 318 | module := &Droiddoc{} |
| 319 | |
| 320 | module.AddProperties(&module.properties, |
| 321 | &module.Javadoc.properties) |
| 322 | |
| 323 | InitDroiddocModule(module, android.HostSupported) |
| 324 | return module |
| 325 | } |
| 326 | |
| 327 | func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { |
| 328 | if ctx.Device() { |
| 329 | sdkDep := decodeSdkDep(ctx, String(j.properties.Sdk_version)) |
| 330 | if sdkDep.useDefaultLibs { |
| 331 | ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...) |
Nan Zhang | 9cbe677 | 2018-03-21 17:56:39 -0700 | [diff] [blame] | 332 | if !Bool(j.properties.No_framework_libs) { |
Nan Zhang | e66c727 | 2018-03-06 12:59:27 -0800 | [diff] [blame] | 333 | ctx.AddDependency(ctx.Module(), libTag, []string{"ext", "framework"}...) |
| 334 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 335 | } else if sdkDep.useModule { |
Colin Cross | 86a60ae | 2018-05-29 14:44:55 -0700 | [diff] [blame] | 336 | ctx.AddDependency(ctx.Module(), bootClasspathTag, sdkDep.modules...) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 337 | } |
| 338 | } |
| 339 | |
| 340 | ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...) |
| 341 | |
| 342 | android.ExtractSourcesDeps(ctx, j.properties.Srcs) |
| 343 | |
| 344 | // exclude_srcs may contain filegroup or genrule. |
| 345 | android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs) |
| 346 | } |
| 347 | |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 348 | func (j *Javadoc) genWhitelistPathPrefixes(whitelistPathPrefixes map[string]bool) { |
| 349 | for _, dir := range j.properties.Srcs_lib_whitelist_dirs { |
| 350 | for _, pkg := range j.properties.Srcs_lib_whitelist_pkgs { |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 351 | // convert foo.bar.baz to foo/bar/baz |
| 352 | pkgAsPath := filepath.Join(strings.Split(pkg, ".")...) |
| 353 | prefix := filepath.Join(dir, pkgAsPath) |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 354 | if _, found := whitelistPathPrefixes[prefix]; !found { |
| 355 | whitelistPathPrefixes[prefix] = true |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
Jiyong Park | 1e44068 | 2018-05-23 18:42:04 +0900 | [diff] [blame] | 361 | func (j *Javadoc) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaBuilderFlags { |
| 362 | var flags javaBuilderFlags |
| 363 | |
| 364 | // aidl flags. |
| 365 | aidlFlags := j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs) |
| 366 | if len(aidlFlags) > 0 { |
| 367 | // optimization. |
| 368 | ctx.Variable(pctx, "aidlFlags", strings.Join(aidlFlags, " ")) |
| 369 | flags.aidlFlags = "$aidlFlags" |
| 370 | } |
| 371 | |
| 372 | return flags |
| 373 | } |
| 374 | |
| 375 | func (j *Javadoc) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath, |
| 376 | aidlIncludeDirs android.Paths) []string { |
| 377 | |
| 378 | aidlIncludes := android.PathsForModuleSrc(ctx, j.properties.Aidl.Local_include_dirs) |
| 379 | aidlIncludes = append(aidlIncludes, android.PathsForSource(ctx, j.properties.Aidl.Include_dirs)...) |
| 380 | |
| 381 | var flags []string |
| 382 | if aidlPreprocess.Valid() { |
| 383 | flags = append(flags, "-p"+aidlPreprocess.String()) |
| 384 | } else { |
| 385 | flags = append(flags, android.JoinWithPrefix(aidlIncludeDirs.Strings(), "-I")) |
| 386 | } |
| 387 | |
| 388 | flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I")) |
| 389 | flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String()) |
| 390 | if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() { |
| 391 | flags = append(flags, "-I"+src.String()) |
| 392 | } |
| 393 | |
| 394 | return flags |
| 395 | } |
| 396 | |
| 397 | func (j *Javadoc) genSources(ctx android.ModuleContext, srcFiles android.Paths, |
| 398 | flags javaBuilderFlags) android.Paths { |
| 399 | |
| 400 | outSrcFiles := make(android.Paths, 0, len(srcFiles)) |
| 401 | |
| 402 | for _, srcFile := range srcFiles { |
| 403 | switch srcFile.Ext() { |
| 404 | case ".aidl": |
| 405 | javaFile := genAidl(ctx, srcFile, flags.aidlFlags) |
| 406 | outSrcFiles = append(outSrcFiles, javaFile) |
| 407 | default: |
| 408 | outSrcFiles = append(outSrcFiles, srcFile) |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | return outSrcFiles |
| 413 | } |
| 414 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 415 | func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { |
| 416 | var deps deps |
| 417 | |
| 418 | sdkDep := decodeSdkDep(ctx, String(j.properties.Sdk_version)) |
| 419 | if sdkDep.invalidVersion { |
Colin Cross | 86a60ae | 2018-05-29 14:44:55 -0700 | [diff] [blame] | 420 | ctx.AddMissingDependencies(sdkDep.modules) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 421 | } else if sdkDep.useFiles { |
Colin Cross | 86a60ae | 2018-05-29 14:44:55 -0700 | [diff] [blame] | 422 | deps.bootClasspath = append(deps.bootClasspath, sdkDep.jars...) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | ctx.VisitDirectDeps(func(module android.Module) { |
| 426 | otherName := ctx.OtherModuleName(module) |
| 427 | tag := ctx.OtherModuleDependencyTag(module) |
| 428 | |
Colin Cross | 2d24c1b | 2018-05-23 10:59:18 -0700 | [diff] [blame] | 429 | switch tag { |
| 430 | case bootClasspathTag: |
| 431 | if dep, ok := module.(Dependency); ok { |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 432 | deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars()...) |
Colin Cross | 2d24c1b | 2018-05-23 10:59:18 -0700 | [diff] [blame] | 433 | } else { |
| 434 | panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName())) |
| 435 | } |
| 436 | case libTag: |
| 437 | switch dep := module.(type) { |
| 438 | case Dependency: |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 439 | deps.classpath = append(deps.classpath, dep.ImplementationJars()...) |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 440 | if otherName == String(j.properties.Srcs_lib) { |
| 441 | srcs := dep.(SrcDependency).CompiledSrcs() |
| 442 | whitelistPathPrefixes := make(map[string]bool) |
| 443 | j.genWhitelistPathPrefixes(whitelistPathPrefixes) |
| 444 | for _, src := range srcs { |
| 445 | if _, ok := src.(android.WritablePath); ok { // generated sources |
| 446 | deps.srcs = append(deps.srcs, src) |
| 447 | } else { // select source path for documentation based on whitelist path prefixs. |
| 448 | for k, _ := range whitelistPathPrefixes { |
| 449 | if strings.HasPrefix(src.Rel(), k) { |
| 450 | deps.srcs = append(deps.srcs, src) |
| 451 | break |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | } |
| 456 | deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...) |
| 457 | } |
Colin Cross | 2d24c1b | 2018-05-23 10:59:18 -0700 | [diff] [blame] | 458 | case SdkLibraryDependency: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 459 | sdkVersion := String(j.properties.Sdk_version) |
| 460 | linkType := javaSdk |
| 461 | if strings.HasPrefix(sdkVersion, "system_") || strings.HasPrefix(sdkVersion, "test_") { |
| 462 | linkType = javaSystem |
| 463 | } else if sdkVersion == "" { |
| 464 | linkType = javaPlatform |
| 465 | } |
| 466 | deps.classpath = append(deps.classpath, dep.HeaderJars(linkType)...) |
Colin Cross | 2d24c1b | 2018-05-23 10:59:18 -0700 | [diff] [blame] | 467 | case android.SourceFileProducer: |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 468 | checkProducesJars(ctx, dep) |
| 469 | deps.classpath = append(deps.classpath, dep.Srcs()...) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 470 | default: |
| 471 | ctx.ModuleErrorf("depends on non-java module %q", otherName) |
| 472 | } |
| 473 | } |
| 474 | }) |
| 475 | // do not pass exclude_srcs directly when expanding srcFiles since exclude_srcs |
| 476 | // may contain filegroup or genrule. |
| 477 | srcFiles := ctx.ExpandSources(j.properties.Srcs, j.properties.Exclude_srcs) |
Jiyong Park | 1e44068 | 2018-05-23 18:42:04 +0900 | [diff] [blame] | 478 | flags := j.collectBuilderFlags(ctx, deps) |
| 479 | srcFiles = j.genSources(ctx, srcFiles, flags) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 480 | |
| 481 | // srcs may depend on some genrule output. |
| 482 | j.srcJars = srcFiles.FilterByExt(".srcjar") |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 483 | j.srcJars = append(j.srcJars, deps.srcJars...) |
| 484 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 485 | j.srcFiles = srcFiles.FilterOutByExt(".srcjar") |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 486 | j.srcFiles = append(j.srcFiles, deps.srcs...) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 487 | |
| 488 | j.docZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"docs.zip") |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 489 | j.stubsSrcJar = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"stubs.srcjar") |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 490 | |
| 491 | if j.properties.Local_sourcepaths == nil { |
| 492 | j.properties.Local_sourcepaths = append(j.properties.Local_sourcepaths, ".") |
| 493 | } |
| 494 | j.sourcepaths = android.PathsForModuleSrc(ctx, j.properties.Local_sourcepaths) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 495 | |
| 496 | return deps |
| 497 | } |
| 498 | |
| 499 | func (j *Javadoc) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 500 | j.addDeps(ctx) |
| 501 | } |
| 502 | |
| 503 | func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 504 | deps := j.collectDeps(ctx) |
| 505 | |
| 506 | var implicits android.Paths |
| 507 | implicits = append(implicits, deps.bootClasspath...) |
| 508 | implicits = append(implicits, deps.classpath...) |
| 509 | |
| 510 | var bootClasspathArgs, classpathArgs string |
| 511 | if ctx.Config().UseOpenJDK9() { |
| 512 | if len(deps.bootClasspath) > 0 { |
| 513 | // For OpenJDK 9 we use --patch-module to define the core libraries code. |
| 514 | // TODO(tobiast): Reorganize this when adding proper support for OpenJDK 9 |
| 515 | // modules. Here we treat all code in core libraries as being in java.base |
| 516 | // to work around the OpenJDK 9 module system. http://b/62049770 |
| 517 | bootClasspathArgs = "--patch-module=java.base=" + strings.Join(deps.bootClasspath.Strings(), ":") |
| 518 | } |
| 519 | } else { |
| 520 | if len(deps.bootClasspath.Strings()) > 0 { |
| 521 | // For OpenJDK 8 we can use -bootclasspath to define the core libraries code. |
| 522 | bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath") |
| 523 | } |
| 524 | } |
| 525 | if len(deps.classpath.Strings()) > 0 { |
| 526 | classpathArgs = "-classpath " + strings.Join(deps.classpath.Strings(), ":") |
| 527 | } |
| 528 | |
| 529 | implicits = append(implicits, j.srcJars...) |
| 530 | |
| 531 | opts := "-J-Xmx1024m -XDignore.symbol.file -Xdoclint:none" |
| 532 | |
| 533 | ctx.Build(pctx, android.BuildParams{ |
| 534 | Rule: javadoc, |
| 535 | Description: "Javadoc", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 536 | Output: j.stubsSrcJar, |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 537 | ImplicitOutput: j.docZip, |
| 538 | Inputs: j.srcFiles, |
| 539 | Implicits: implicits, |
| 540 | Args: map[string]string{ |
| 541 | "outDir": android.PathForModuleOut(ctx, "docs", "out").String(), |
| 542 | "srcJarDir": android.PathForModuleOut(ctx, "docs", "srcjars").String(), |
| 543 | "stubsDir": android.PathForModuleOut(ctx, "docs", "stubsDir").String(), |
| 544 | "srcJars": strings.Join(j.srcJars.Strings(), " "), |
| 545 | "opts": opts, |
Nan Zhang | 853f420 | 2018-04-12 16:55:56 -0700 | [diff] [blame] | 546 | "bootclasspathArgs": bootClasspathArgs, |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 547 | "classpathArgs": classpathArgs, |
| 548 | "sourcepath": strings.Join(j.sourcepaths.Strings(), ":"), |
| 549 | "docZip": j.docZip.String(), |
| 550 | }, |
| 551 | }) |
| 552 | } |
| 553 | |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 554 | func (d *Droiddoc) checkCurrentApi() bool { |
| 555 | if String(d.properties.Check_api.Current.Api_file) != "" && |
| 556 | String(d.properties.Check_api.Current.Removed_api_file) != "" { |
| 557 | return true |
| 558 | } else if String(d.properties.Check_api.Current.Api_file) != "" { |
| 559 | panic("check_api.current.removed_api_file: has to be non empty!") |
| 560 | } else if String(d.properties.Check_api.Current.Removed_api_file) != "" { |
| 561 | panic("check_api.current.api_file: has to be non empty!") |
| 562 | } |
| 563 | |
| 564 | return false |
| 565 | } |
| 566 | |
| 567 | func (d *Droiddoc) checkLastReleasedApi() bool { |
| 568 | if String(d.properties.Check_api.Last_released.Api_file) != "" && |
| 569 | String(d.properties.Check_api.Last_released.Removed_api_file) != "" { |
| 570 | return true |
| 571 | } else if String(d.properties.Check_api.Last_released.Api_file) != "" { |
| 572 | panic("check_api.last_released.removed_api_file: has to be non empty!") |
| 573 | } else if String(d.properties.Check_api.Last_released.Removed_api_file) != "" { |
| 574 | panic("check_api.last_released.api_file: has to be non empty!") |
| 575 | } |
| 576 | |
| 577 | return false |
| 578 | } |
| 579 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 580 | func (d *Droiddoc) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 581 | d.Javadoc.addDeps(ctx) |
| 582 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 583 | if String(d.properties.Custom_template) != "" { |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 584 | ctx.AddDependency(ctx.Module(), droiddocTemplateTag, String(d.properties.Custom_template)) |
| 585 | } |
| 586 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 587 | // extra_arg_files may contains filegroup or genrule. |
| 588 | android.ExtractSourcesDeps(ctx, d.properties.Arg_files) |
| 589 | |
| 590 | // knowntags may contain filegroup or genrule. |
| 591 | android.ExtractSourcesDeps(ctx, d.properties.Knowntags) |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 592 | |
| 593 | if d.checkCurrentApi() { |
| 594 | android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Api_file) |
| 595 | android.ExtractSourceDeps(ctx, d.properties.Check_api.Current.Removed_api_file) |
| 596 | } |
| 597 | |
| 598 | if d.checkLastReleasedApi() { |
| 599 | android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Api_file) |
| 600 | android.ExtractSourceDeps(ctx, d.properties.Check_api.Last_released.Removed_api_file) |
| 601 | } |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 602 | |
| 603 | if String(d.properties.Metalava_previous_api) != "" { |
| 604 | android.ExtractSourceDeps(ctx, d.properties.Metalava_previous_api) |
| 605 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 609 | deps := d.Javadoc.collectDeps(ctx) |
| 610 | |
| 611 | var implicits android.Paths |
| 612 | implicits = append(implicits, deps.bootClasspath...) |
| 613 | implicits = append(implicits, deps.classpath...) |
| 614 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 615 | bootClasspathArgs := deps.bootClasspath.FormJavaClassPath("-bootclasspath") |
| 616 | classpathArgs := deps.classpath.FormJavaClassPath("-classpath") |
| 617 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 618 | argFiles := ctx.ExpandSources(d.properties.Arg_files, nil) |
| 619 | argFilesMap := map[string]android.Path{} |
| 620 | |
| 621 | for _, f := range argFiles { |
| 622 | implicits = append(implicits, f) |
| 623 | if _, exists := argFilesMap[f.Rel()]; !exists { |
| 624 | argFilesMap[f.Rel()] = f |
| 625 | } else { |
| 626 | ctx.ModuleErrorf("multiple arg_files for %q, %q and %q", |
| 627 | f, argFilesMap[f.Rel()], f.Rel()) |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | args, err := android.Expand(String(d.properties.Args), func(name string) (string, error) { |
| 632 | if strings.HasPrefix(name, "location ") { |
| 633 | label := strings.TrimSpace(strings.TrimPrefix(name, "location ")) |
| 634 | if f, ok := argFilesMap[label]; ok { |
| 635 | return f.String(), nil |
| 636 | } else { |
| 637 | return "", fmt.Errorf("unknown location label %q", label) |
| 638 | } |
| 639 | } else if name == "genDir" { |
| 640 | return android.PathForModuleGen(ctx).String(), nil |
| 641 | } |
| 642 | return "", fmt.Errorf("unknown variable '$(%s)'", name) |
| 643 | }) |
| 644 | |
| 645 | if err != nil { |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 646 | ctx.PropertyErrorf("args", "%s", err.Error()) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 647 | return |
| 648 | } |
| 649 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 650 | genDocsForMetalava := false |
| 651 | var metalavaArgs string |
| 652 | if Bool(d.properties.Metalava_enabled) { |
| 653 | if strings.Contains(args, "--generate-documentation") { |
| 654 | if !strings.Contains(args, "-nodocs") { |
| 655 | genDocsForMetalava = true |
| 656 | } |
| 657 | // TODO(nanzhang): Add a Soong property to handle documentation args. |
| 658 | metalavaArgs = strings.Split(args, "--generate-documentation")[0] |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 659 | } else { |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 660 | metalavaArgs = args |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 661 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 662 | } |
| 663 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 664 | var templateDir, htmlDirArgs, htmlDir2Args string |
| 665 | if !Bool(d.properties.Metalava_enabled) || genDocsForMetalava { |
| 666 | if String(d.properties.Custom_template) == "" { |
| 667 | // TODO: This is almost always droiddoc-templates-sdk |
| 668 | ctx.PropertyErrorf("custom_template", "must specify a template") |
| 669 | } |
| 670 | |
| 671 | ctx.VisitDirectDepsWithTag(droiddocTemplateTag, func(m android.Module) { |
| 672 | if t, ok := m.(*DroiddocTemplate); ok { |
| 673 | implicits = append(implicits, t.deps...) |
| 674 | templateDir = t.dir.String() |
| 675 | } else { |
| 676 | ctx.PropertyErrorf("custom_template", "module %q is not a droiddoc_template", ctx.OtherModuleName(m)) |
| 677 | } |
| 678 | }) |
| 679 | |
| 680 | if len(d.properties.Html_dirs) > 0 { |
| 681 | htmlDir := android.PathForModuleSrc(ctx, d.properties.Html_dirs[0]) |
| 682 | implicits = append(implicits, ctx.Glob(htmlDir.Join(ctx, "**/*").String(), nil)...) |
| 683 | htmlDirArgs = "-htmldir " + htmlDir.String() |
| 684 | } |
| 685 | |
| 686 | if len(d.properties.Html_dirs) > 1 { |
| 687 | htmlDir2 := android.PathForModuleSrc(ctx, d.properties.Html_dirs[1]) |
| 688 | implicits = append(implicits, ctx.Glob(htmlDir2.Join(ctx, "**/*").String(), nil)...) |
| 689 | htmlDir2Args = "-htmldir2 " + htmlDir2.String() |
| 690 | } |
| 691 | |
| 692 | if len(d.properties.Html_dirs) > 2 { |
| 693 | ctx.PropertyErrorf("html_dirs", "Droiddoc only supports up to 2 html dirs") |
| 694 | } |
| 695 | |
| 696 | knownTags := ctx.ExpandSources(d.properties.Knowntags, nil) |
| 697 | implicits = append(implicits, knownTags...) |
| 698 | |
| 699 | for _, kt := range knownTags { |
| 700 | args = args + " -knowntags " + kt.String() |
| 701 | } |
| 702 | |
| 703 | for _, hdf := range d.properties.Hdf { |
| 704 | args = args + " -hdf " + hdf |
| 705 | } |
| 706 | |
| 707 | if String(d.properties.Proofread_file) != "" { |
| 708 | proofreadFile := android.PathForModuleOut(ctx, String(d.properties.Proofread_file)) |
| 709 | args = args + " -proofread " + proofreadFile.String() |
| 710 | } |
| 711 | |
| 712 | if String(d.properties.Todo_file) != "" { |
| 713 | // tricky part: |
| 714 | // we should not compute full path for todo_file through PathForModuleOut(). |
| 715 | // the non-standard doclet will get the full path relative to "-o". |
| 716 | args = args + " -todo " + String(d.properties.Todo_file) |
| 717 | } |
| 718 | |
| 719 | if String(d.properties.Resourcesdir) != "" { |
| 720 | // TODO: should we add files under resourcesDir to the implicits? It seems that |
| 721 | // resourcesDir is one sub dir of htmlDir |
| 722 | resourcesDir := android.PathForModuleSrc(ctx, String(d.properties.Resourcesdir)) |
| 723 | args = args + " -resourcesdir " + resourcesDir.String() |
| 724 | } |
| 725 | |
| 726 | if String(d.properties.Resourcesoutdir) != "" { |
| 727 | // TODO: it seems -resourceoutdir reference/android/images/ didn't get generated anywhere. |
| 728 | args = args + " -resourcesoutdir " + String(d.properties.Resourcesoutdir) |
| 729 | } |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 730 | } |
| 731 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 732 | var docArgsForMetalava string |
| 733 | if Bool(d.properties.Metalava_enabled) && genDocsForMetalava { |
| 734 | docArgsForMetalava = strings.Split(args, "--generate-documentation")[1] |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 735 | } |
| 736 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 737 | var implicitOutputs android.WritablePaths |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 738 | |
| 739 | if d.checkCurrentApi() || d.checkLastReleasedApi() || String(d.properties.Api_filename) != "" { |
| 740 | d.apiFile = android.PathForModuleOut(ctx, ctx.ModuleName()+"_api.txt") |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 741 | args = args + " -api " + d.apiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 742 | metalavaArgs = metalavaArgs + " --api " + d.apiFile.String() |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 743 | implicitOutputs = append(implicitOutputs, d.apiFile) |
| 744 | } |
| 745 | |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 746 | if d.checkCurrentApi() || d.checkLastReleasedApi() || String(d.properties.Removed_api_filename) != "" { |
| 747 | d.removedApiFile = android.PathForModuleOut(ctx, ctx.ModuleName()+"_removed.txt") |
| 748 | args = args + " -removedApi " + d.removedApiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 749 | metalavaArgs = metalavaArgs + " --removed-api " + d.removedApiFile.String() |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 750 | implicitOutputs = append(implicitOutputs, d.removedApiFile) |
| 751 | } |
| 752 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 753 | if String(d.properties.Private_api_filename) != "" { |
| 754 | d.privateApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_api_filename)) |
| 755 | args = args + " -privateApi " + d.privateApiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 756 | metalavaArgs = metalavaArgs + " --private-api " + d.privateApiFile.String() |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 757 | implicitOutputs = append(implicitOutputs, d.privateApiFile) |
| 758 | } |
| 759 | |
David Brazdil | fbe4cc3 | 2018-05-31 13:56:46 +0100 | [diff] [blame] | 760 | if String(d.properties.Dex_api_filename) != "" { |
| 761 | d.dexApiFile = android.PathForModuleOut(ctx, String(d.properties.Dex_api_filename)) |
| 762 | args = args + " -dexApi " + d.dexApiFile.String() |
| 763 | implicitOutputs = append(implicitOutputs, d.dexApiFile) |
| 764 | } |
| 765 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 766 | if String(d.properties.Private_dex_api_filename) != "" { |
| 767 | d.privateDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Private_dex_api_filename)) |
| 768 | args = args + " -privateDexApi " + d.privateDexApiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 769 | metalavaArgs = metalavaArgs + " --private-dex-api " + d.privateDexApiFile.String() |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 770 | implicitOutputs = append(implicitOutputs, d.privateDexApiFile) |
| 771 | } |
| 772 | |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 773 | if String(d.properties.Removed_dex_api_filename) != "" { |
| 774 | d.removedDexApiFile = android.PathForModuleOut(ctx, String(d.properties.Removed_dex_api_filename)) |
| 775 | args = args + " -removedDexApi " + d.removedDexApiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 776 | metalavaArgs = metalavaArgs + " --removed-dex-api " + d.removedDexApiFile.String() |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 777 | implicitOutputs = append(implicitOutputs, d.removedDexApiFile) |
| 778 | } |
| 779 | |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 780 | if String(d.properties.Exact_api_filename) != "" { |
| 781 | d.exactApiFile = android.PathForModuleOut(ctx, String(d.properties.Exact_api_filename)) |
| 782 | args = args + " -exactApi " + d.exactApiFile.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 783 | metalavaArgs = metalavaArgs + " --exact-api " + d.exactApiFile.String() |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 784 | implicitOutputs = append(implicitOutputs, d.exactApiFile) |
| 785 | } |
| 786 | |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 787 | implicits = append(implicits, d.Javadoc.srcJars...) |
| 788 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 789 | implicitOutputs = append(implicitOutputs, d.Javadoc.docZip) |
| 790 | for _, o := range d.properties.Out { |
| 791 | implicitOutputs = append(implicitOutputs, android.PathForModuleGen(ctx, o)) |
| 792 | } |
| 793 | |
Nan Zhang | 3096374 | 2018-04-23 09:59:14 -0700 | [diff] [blame] | 794 | jsilver := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "framework", "jsilver.jar") |
| 795 | doclava := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "framework", "doclava.jar") |
Nan Zhang | 3096374 | 2018-04-23 09:59:14 -0700 | [diff] [blame] | 796 | |
Nan Zhang | 4613097 | 2018-06-04 11:28:01 -0700 | [diff] [blame] | 797 | var date string |
| 798 | if runtime.GOOS == "darwin" { |
| 799 | date = `date -r` |
| 800 | } else { |
| 801 | date = `date -d` |
| 802 | } |
| 803 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 804 | doclavaOpts := "-source 1.8 -J-Xmx1600m -J-XX:-OmitStackTraceInFastThrow -XDignore.symbol.file " + |
Nan Zhang | 3096374 | 2018-04-23 09:59:14 -0700 | [diff] [blame] | 805 | "-doclet com.google.doclava.Doclava -docletpath " + jsilver.String() + ":" + doclava.String() + " " + |
Colin Cross | 480cd76 | 2018-02-22 14:39:17 -0800 | [diff] [blame] | 806 | "-templatedir " + templateDir + " " + htmlDirArgs + " " + htmlDir2Args + " " + |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 807 | "-hdf page.build " + ctx.Config().BuildId() + "-" + ctx.Config().BuildNumberFromFile() + " " + |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 808 | `-hdf page.now "$$(` + date + ` @$$(cat ` + ctx.Config().Getenv("BUILD_DATETIME_FILE") + `) "+%d %b %Y %k:%M")" ` |
Nan Zhang | 4613097 | 2018-06-04 11:28:01 -0700 | [diff] [blame] | 809 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 810 | if !Bool(d.properties.Metalava_enabled) { |
| 811 | opts := doclavaOpts + args |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 812 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 813 | implicits = append(implicits, jsilver) |
| 814 | implicits = append(implicits, doclava) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 815 | |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 816 | if BoolDefault(d.properties.Create_stubs, true) { |
| 817 | opts += " -stubs " + android.PathForModuleOut(ctx, "docs", "stubsDir").String() |
| 818 | } |
| 819 | |
| 820 | ctx.Build(pctx, android.BuildParams{ |
| 821 | Rule: javadoc, |
| 822 | Description: "Droiddoc", |
| 823 | Output: d.Javadoc.stubsSrcJar, |
| 824 | Inputs: d.Javadoc.srcFiles, |
| 825 | Implicits: implicits, |
| 826 | ImplicitOutputs: implicitOutputs, |
| 827 | Args: map[string]string{ |
| 828 | "outDir": android.PathForModuleOut(ctx, "docs", "out").String(), |
| 829 | "srcJarDir": android.PathForModuleOut(ctx, "docs", "srcjars").String(), |
| 830 | "stubsDir": android.PathForModuleOut(ctx, "docs", "stubsDir").String(), |
| 831 | "srcJars": strings.Join(d.Javadoc.srcJars.Strings(), " "), |
| 832 | "opts": opts, |
| 833 | "bootclasspathArgs": bootClasspathArgs, |
| 834 | "classpathArgs": classpathArgs, |
| 835 | "sourcepath": strings.Join(d.Javadoc.sourcepaths.Strings(), ":"), |
| 836 | "docZip": d.Javadoc.docZip.String(), |
| 837 | }, |
| 838 | }) |
| 839 | } else { |
| 840 | opts := metalavaArgs |
| 841 | |
| 842 | buildArgs := map[string]string{ |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 843 | "outDir": android.PathForModuleOut(ctx, "docs", "out").String(), |
| 844 | "srcJarDir": android.PathForModuleOut(ctx, "docs", "srcjars").String(), |
| 845 | "stubsDir": android.PathForModuleOut(ctx, "docs", "stubsDir").String(), |
| 846 | "srcJars": strings.Join(d.Javadoc.srcJars.Strings(), " "), |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 847 | "bootclasspathArgs": bootClasspathArgs, |
| 848 | "classpathArgs": classpathArgs, |
| 849 | "sourcepath": strings.Join(d.Javadoc.sourcepaths.Strings(), ":"), |
| 850 | "docZip": d.Javadoc.docZip.String(), |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 851 | } |
| 852 | |
| 853 | var previousApi android.Path |
| 854 | if String(d.properties.Metalava_previous_api) != "" { |
| 855 | previousApi = ctx.ExpandSource(String(d.properties.Metalava_previous_api), |
| 856 | "metalava_previous_api") |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 857 | opts += " --previous-api " + previousApi.String() |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 858 | implicits = append(implicits, previousApi) |
| 859 | } |
| 860 | |
| 861 | if Bool(d.properties.Metalava_annotations_enabled) { |
| 862 | if String(d.properties.Metalava_previous_api) == "" { |
| 863 | ctx.PropertyErrorf("metalava_previous_api", |
| 864 | "has to be non-empty if annotations was enabled!") |
| 865 | } |
| 866 | opts += " --include-annotations --migrate-nullness" |
| 867 | |
| 868 | annotationsZip := android.PathForModuleOut(ctx, ctx.ModuleName()+"_annotations.zip") |
| 869 | implicitOutputs = append(implicitOutputs, annotationsZip) |
| 870 | |
| 871 | if String(d.properties.Metalava_merge_annotations_dir) == "" { |
| 872 | ctx.PropertyErrorf("metalava_merge_annotations", |
| 873 | "has to be non-empty if annotations was enabled!") |
| 874 | } |
| 875 | |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 876 | mergeAnnotationsDir := android.PathForSource(ctx, String(d.properties.Metalava_merge_annotations_dir)) |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 877 | |
| 878 | opts += " --extract-annotations " + annotationsZip.String() + " --merge-annotations " + mergeAnnotationsDir.String() |
| 879 | // TODO(tnorbye): find owners to fix these warnings when annotation was enabled. |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 880 | opts += " --hide HiddenTypedefConstant --hide SuperfluousPrefix --hide AnnotationExtraction" |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | if genDocsForMetalava { |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 884 | opts += " --doc-stubs " + android.PathForModuleOut(ctx, "docs", "docStubsDir").String() + |
| 885 | " --write-doc-stubs-source-list $outDir/doc_stubs_src_list " + |
| 886 | " --generate-documentation ${config.JavadocCmd} -encoding UTF-8 DOC_STUBS_SOURCE_LIST " + |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 887 | doclavaOpts + docArgsForMetalava + bootClasspathArgs + " " + classpathArgs + " " + " -sourcepath " + |
Nan Zhang | 16c0a31 | 2018-06-13 17:42:48 -0700 | [diff] [blame^] | 888 | android.PathForModuleOut(ctx, "docs", "docStubsDir").String() + " -quiet -d $outDir " |
Nan Zhang | 79614d1 | 2018-04-19 18:03:39 -0700 | [diff] [blame] | 889 | implicits = append(implicits, jsilver) |
| 890 | implicits = append(implicits, doclava) |
| 891 | } |
| 892 | |
| 893 | buildArgs["opts"] = opts |
| 894 | ctx.Build(pctx, android.BuildParams{ |
| 895 | Rule: metalava, |
| 896 | Description: "Metalava", |
| 897 | Output: d.Javadoc.stubsSrcJar, |
| 898 | Inputs: d.Javadoc.srcFiles, |
| 899 | Implicits: implicits, |
| 900 | ImplicitOutputs: implicitOutputs, |
| 901 | Args: buildArgs, |
| 902 | }) |
| 903 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 904 | |
| 905 | java8Home := ctx.Config().Getenv("ANDROID_JAVA8_HOME") |
| 906 | |
| 907 | checkApiClasspath := classpath{jsilver, doclava, android.PathForSource(ctx, java8Home, "lib/tools.jar")} |
| 908 | |
| 909 | if d.checkCurrentApi() && !ctx.Config().IsPdkBuild() { |
| 910 | d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp") |
| 911 | |
| 912 | apiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Api_file), |
| 913 | "check_api.current.api_file") |
| 914 | removedApiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Removed_api_file), |
| 915 | "check_api.current_removed_api_file") |
| 916 | |
| 917 | ctx.Build(pctx, android.BuildParams{ |
| 918 | Rule: apiCheck, |
| 919 | Description: "Current API check", |
| 920 | Output: d.checkCurrentApiTimestamp, |
| 921 | Inputs: nil, |
| 922 | Implicits: append(android.Paths{apiFile, removedApiFile, d.apiFile, d.removedApiFile}, |
| 923 | checkApiClasspath...), |
| 924 | Args: map[string]string{ |
| 925 | "classpath": checkApiClasspath.FormJavaClassPath(""), |
| 926 | "opts": String(d.properties.Check_api.Current.Args), |
| 927 | "apiFile": apiFile.String(), |
| 928 | "apiFileToCheck": d.apiFile.String(), |
| 929 | "removedApiFile": removedApiFile.String(), |
| 930 | "removedApiFileToCheck": d.removedApiFile.String(), |
| 931 | "msg": fmt.Sprintf(`\n******************************\n`+ |
| 932 | `You have tried to change the API from what has been previously approved.\n\n`+ |
| 933 | `To make these errors go away, you have two choices:\n`+ |
| 934 | ` 1. You can add '@hide' javadoc comments to the methods, etc. listed in the\n`+ |
| 935 | ` errors above.\n\n`+ |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 936 | ` 2. You can update current.txt by executing the following command:\n`+ |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 937 | ` make %s-update-current-api\n\n`+ |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 938 | ` To submit the revised current.txt to the main Android repository,\n`+ |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 939 | ` you will need approval.\n`+ |
| 940 | `******************************\n`, ctx.ModuleName()), |
| 941 | }, |
| 942 | }) |
| 943 | |
| 944 | d.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, "update_current_api.timestamp") |
| 945 | |
| 946 | ctx.Build(pctx, android.BuildParams{ |
| 947 | Rule: updateApi, |
| 948 | Description: "update current API", |
| 949 | Output: d.updateCurrentApiTimestamp, |
| 950 | Implicits: append(android.Paths{}, apiFile, removedApiFile, d.apiFile, d.removedApiFile), |
| 951 | Args: map[string]string{ |
| 952 | "apiFile": apiFile.String(), |
| 953 | "apiFileToCheck": d.apiFile.String(), |
| 954 | "removedApiFile": removedApiFile.String(), |
| 955 | "removedApiFileToCheck": d.removedApiFile.String(), |
| 956 | }, |
| 957 | }) |
| 958 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 959 | if d.checkLastReleasedApi() && !ctx.Config().IsPdkBuild() { |
| 960 | d.checkLastReleasedApiTimestamp = android.PathForModuleOut(ctx, "check_last_released_api.timestamp") |
| 961 | |
| 962 | apiFile := ctx.ExpandSource(String(d.properties.Check_api.Last_released.Api_file), |
| 963 | "check_api.last_released.api_file") |
| 964 | removedApiFile := ctx.ExpandSource(String(d.properties.Check_api.Last_released.Removed_api_file), |
| 965 | "check_api.last_released.removed_api_file") |
| 966 | |
| 967 | ctx.Build(pctx, android.BuildParams{ |
| 968 | Rule: apiCheck, |
| 969 | Description: "Last Released API check", |
| 970 | Output: d.checkLastReleasedApiTimestamp, |
| 971 | Inputs: nil, |
| 972 | Implicits: append(android.Paths{apiFile, removedApiFile, d.apiFile, d.removedApiFile}, |
| 973 | checkApiClasspath...), |
| 974 | Args: map[string]string{ |
| 975 | "classpath": checkApiClasspath.FormJavaClassPath(""), |
| 976 | "opts": String(d.properties.Check_api.Last_released.Args), |
| 977 | "apiFile": apiFile.String(), |
| 978 | "apiFileToCheck": d.apiFile.String(), |
| 979 | "removedApiFile": removedApiFile.String(), |
| 980 | "removedApiFileToCheck": d.removedApiFile.String(), |
| 981 | "msg": `\n******************************\n` + |
| 982 | `You have tried to change the API from what has been previously released in\n` + |
| 983 | `an SDK. Please fix the errors listed above.\n` + |
| 984 | `******************************\n`, |
| 985 | }, |
| 986 | }) |
| 987 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 988 | } |
Dan Willemsen | cc09097 | 2018-02-26 14:33:31 -0800 | [diff] [blame] | 989 | |
| 990 | var droiddocTemplateTag = dependencyTag{name: "droiddoc-template"} |
| 991 | |
| 992 | type DroiddocTemplateProperties struct { |
| 993 | // path to the directory containing the droiddoc templates. |
| 994 | Path *string |
| 995 | } |
| 996 | |
| 997 | type DroiddocTemplate struct { |
| 998 | android.ModuleBase |
| 999 | |
| 1000 | properties DroiddocTemplateProperties |
| 1001 | |
| 1002 | deps android.Paths |
| 1003 | dir android.Path |
| 1004 | } |
| 1005 | |
| 1006 | func DroiddocTemplateFactory() android.Module { |
| 1007 | module := &DroiddocTemplate{} |
| 1008 | module.AddProperties(&module.properties) |
| 1009 | android.InitAndroidModule(module) |
| 1010 | return module |
| 1011 | } |
| 1012 | |
| 1013 | func (d *DroiddocTemplate) DepsMutator(android.BottomUpMutatorContext) {} |
| 1014 | |
| 1015 | func (d *DroiddocTemplate) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 1016 | path := android.PathForModuleSrc(ctx, String(d.properties.Path)) |
| 1017 | d.dir = path |
| 1018 | d.deps = ctx.Glob(path.Join(ctx, "**/*").String(), nil) |
| 1019 | } |
Nan Zhang | b2b33de | 2018-02-23 11:18:47 -0800 | [diff] [blame] | 1020 | |
| 1021 | // |
| 1022 | // Defaults |
| 1023 | // |
| 1024 | type DocDefaults struct { |
| 1025 | android.ModuleBase |
| 1026 | android.DefaultsModuleBase |
| 1027 | } |
| 1028 | |
| 1029 | func (*DocDefaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 1030 | } |
| 1031 | |
| 1032 | func (d *DocDefaults) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 1033 | } |
| 1034 | |
| 1035 | func DocDefaultsFactory() android.Module { |
| 1036 | module := &DocDefaults{} |
| 1037 | |
| 1038 | module.AddProperties( |
| 1039 | &JavadocProperties{}, |
| 1040 | &DroiddocProperties{}, |
| 1041 | ) |
| 1042 | |
| 1043 | android.InitDefaultsModule(module) |
| 1044 | |
| 1045 | return module |
| 1046 | } |