2018-01-11 01:06:12 +01:00
|
|
|
// 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 (
|
|
|
|
"fmt"
|
2018-02-23 20:18:47 +01:00
|
|
|
"path/filepath"
|
2018-01-11 01:06:12 +01:00
|
|
|
"strings"
|
|
|
|
|
2019-06-25 09:26:18 +02:00
|
|
|
"github.com/google/blueprint/proptools"
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/java/config"
|
2018-01-11 01:06:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2019-12-19 11:21:09 +01:00
|
|
|
RegisterDocsBuildComponents(android.InitRegistrationContext)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2019-12-19 11:21:09 +01:00
|
|
|
func RegisterDocsBuildComponents(ctx android.RegistrationContext) {
|
|
|
|
ctx.RegisterModuleType("doc_defaults", DocDefaultsFactory)
|
|
|
|
|
|
|
|
ctx.RegisterModuleType("droiddoc", DroiddocFactory)
|
|
|
|
ctx.RegisterModuleType("droiddoc_host", DroiddocHostFactory)
|
|
|
|
ctx.RegisterModuleType("droiddoc_exported_dir", ExportedDroiddocDirFactory)
|
|
|
|
ctx.RegisterModuleType("javadoc", JavadocFactory)
|
|
|
|
ctx.RegisterModuleType("javadoc_host", JavadocHostFactory)
|
|
|
|
}
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
type JavadocProperties struct {
|
|
|
|
// list of source files used to compile the Java module. May be .java, .logtags, .proto,
|
|
|
|
// or .aidl files.
|
2019-03-05 07:35:41 +01:00
|
|
|
Srcs []string `android:"path,arch_variant"`
|
2018-01-11 01:06:12 +01:00
|
|
|
|
|
|
|
// 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.
|
2019-03-05 07:35:41 +01:00
|
|
|
Exclude_srcs []string `android:"path,arch_variant"`
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-09-13 13:56:14 +02:00
|
|
|
// list of package names that should actually be used. If this property is left unspecified,
|
|
|
|
// all the sources from the srcs property is used.
|
|
|
|
Filter_packages []string
|
|
|
|
|
2018-02-23 20:18:47 +01:00
|
|
|
// list of java libraries that will be in the classpath.
|
2018-01-11 01:06:12 +01:00
|
|
|
Libs []string `android:"arch_variant"`
|
|
|
|
|
|
|
|
// If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true.
|
2018-02-23 20:18:47 +01:00
|
|
|
Installable *bool
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-10-11 14:50:28 +02:00
|
|
|
// if not blank, set to the version of the sdk to compile against.
|
|
|
|
// Defaults to compiling against the current platform.
|
2018-01-11 01:06:12 +01:00
|
|
|
Sdk_version *string `android:"arch_variant"`
|
2018-05-23 11:42:04 +02:00
|
|
|
|
2019-10-11 14:50:28 +02:00
|
|
|
// When targeting 1.9 and above, override the modules to use with --system,
|
|
|
|
// otherwise provides defaults libraries to add to the bootclasspath.
|
|
|
|
// Defaults to "none"
|
|
|
|
System_modules *string
|
|
|
|
|
2018-05-23 11:42:04 +02:00
|
|
|
Aidl struct {
|
|
|
|
// Top level directories to pass to aidl tool
|
|
|
|
Include_dirs []string
|
|
|
|
|
|
|
|
// Directories rooted at the Android.bp file to pass to aidl tool
|
|
|
|
Local_include_dirs []string
|
|
|
|
}
|
2018-04-18 02:38:36 +02:00
|
|
|
|
|
|
|
// If not blank, set the java version passed to javadoc as -source
|
|
|
|
Java_version *string
|
2018-09-05 02:14:32 +02:00
|
|
|
|
|
|
|
// local files that are used within user customized droiddoc options.
|
2019-03-05 07:35:41 +01:00
|
|
|
Arg_files []string `android:"path"`
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2020-07-06 18:12:57 +02:00
|
|
|
// user customized droiddoc args. Deprecated, use flags instead.
|
2018-09-05 02:14:32 +02:00
|
|
|
// Available variables for substitution:
|
|
|
|
//
|
|
|
|
// $(location <label>): the path to the arg_files with name <label>
|
2019-05-28 19:17:14 +02:00
|
|
|
// $$: a literal $
|
2018-09-05 02:14:32 +02:00
|
|
|
Args *string
|
|
|
|
|
2020-07-06 18:12:57 +02:00
|
|
|
// user customized droiddoc args. Not compatible with property args.
|
|
|
|
// Available variables for substitution:
|
|
|
|
//
|
|
|
|
// $(location <label>): the path to the arg_files with name <label>
|
|
|
|
// $$: a literal $
|
|
|
|
Flags []string
|
|
|
|
|
2018-09-05 02:14:32 +02:00
|
|
|
// names of the output files used in args that will be generated
|
|
|
|
Out []string
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2018-05-05 03:49:16 +02:00
|
|
|
type ApiToCheck struct {
|
2018-05-12 15:21:20 +02:00
|
|
|
// path to the API txt file that the new API extracted from source code is checked
|
|
|
|
// against. The path can be local to the module or from other module (via :module syntax).
|
2019-03-05 07:35:41 +01:00
|
|
|
Api_file *string `android:"path"`
|
2018-05-05 03:49:16 +02:00
|
|
|
|
2018-05-12 15:21:20 +02:00
|
|
|
// path to the API txt file that the new @removed API extractd from source code is
|
|
|
|
// checked against. The path can be local to the module or from other module (via
|
|
|
|
// :module syntax).
|
2019-03-05 07:35:41 +01:00
|
|
|
Removed_api_file *string `android:"path"`
|
2018-05-05 03:49:16 +02:00
|
|
|
|
2019-08-12 17:54:09 +02:00
|
|
|
// If not blank, path to the baseline txt file for approved API check violations.
|
|
|
|
Baseline_file *string `android:"path"`
|
|
|
|
|
2018-05-12 15:21:20 +02:00
|
|
|
// Arguments to the apicheck tool.
|
2018-05-05 03:49:16 +02:00
|
|
|
Args *string
|
|
|
|
}
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
type DroiddocProperties struct {
|
|
|
|
// directory relative to top of the source tree that contains doc templates files.
|
2018-02-23 20:18:47 +01:00
|
|
|
Custom_template *string
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
// directories under current module source which contains html/jd files.
|
2018-02-23 20:18:47 +01:00
|
|
|
Html_dirs []string
|
2018-01-11 01:06:12 +01:00
|
|
|
|
|
|
|
// set a value in the Clearsilver hdf namespace.
|
2018-02-23 20:18:47 +01:00
|
|
|
Hdf []string
|
2018-01-11 01:06:12 +01:00
|
|
|
|
|
|
|
// proofread file contains all of the text content of the javadocs concatenated into one file,
|
|
|
|
// suitable for spell-checking and other goodness.
|
2019-07-16 01:13:59 +02:00
|
|
|
Proofread_file *string
|
2018-01-11 01:06:12 +01:00
|
|
|
|
|
|
|
// a todo file lists the program elements that are missing documentation.
|
|
|
|
// At some point, this might be improved to show more warnings.
|
2019-03-05 07:35:41 +01:00
|
|
|
Todo_file *string `android:"path"`
|
2018-02-23 20:18:47 +01:00
|
|
|
|
|
|
|
// directory under current module source that provide additional resources (images).
|
|
|
|
Resourcesdir *string
|
|
|
|
|
|
|
|
// resources output directory under out/soong/.intermediates.
|
|
|
|
Resourcesoutdir *string
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2018-07-12 00:16:55 +02:00
|
|
|
// index.html under current module will be copied to docs out dir, if not null.
|
2019-03-05 07:35:41 +01:00
|
|
|
Static_doc_index_redirect *string `android:"path"`
|
2018-07-12 00:16:55 +02:00
|
|
|
|
|
|
|
// source.properties under current module will be copied to docs out dir, if not null.
|
2019-03-05 07:35:41 +01:00
|
|
|
Static_doc_properties *string `android:"path"`
|
2018-07-12 00:16:55 +02:00
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
// a list of files under current module source dir which contains known tags in Java sources.
|
|
|
|
// filegroup or genrule can be included within this property.
|
2019-03-05 07:35:41 +01:00
|
|
|
Knowntags []string `android:"path"`
|
2018-03-14 00:17:01 +01:00
|
|
|
|
2018-09-05 02:14:32 +02:00
|
|
|
// if set to true, generate docs through Dokka instead of Doclava.
|
|
|
|
Dokka_enabled *bool
|
2019-12-19 15:27:08 +01:00
|
|
|
|
|
|
|
// Compat config XML. Generates compat change documentation if set.
|
|
|
|
Compat_config *string `android:"path"`
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
// Common flags passed down to build rule
|
|
|
|
type droiddocBuilderFlags struct {
|
2018-08-10 00:33:27 +02:00
|
|
|
bootClasspathArgs string
|
|
|
|
classpathArgs string
|
2018-09-05 02:14:32 +02:00
|
|
|
sourcepathArgs string
|
2018-08-10 00:33:27 +02:00
|
|
|
dokkaClasspathArgs string
|
|
|
|
aidlFlags string
|
2019-04-18 19:56:44 +02:00
|
|
|
aidlDeps android.Paths
|
2018-08-01 21:48:00 +02:00
|
|
|
|
|
|
|
doclavaStubsFlags string
|
2018-08-10 00:33:27 +02:00
|
|
|
doclavaDocsFlags string
|
2018-08-01 21:48:00 +02:00
|
|
|
postDoclavaCmds string
|
|
|
|
}
|
|
|
|
|
|
|
|
func InitDroiddocModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) {
|
|
|
|
android.InitAndroidArchModule(module, hod, android.MultilibCommon)
|
|
|
|
android.InitDefaultableModule(module)
|
|
|
|
}
|
|
|
|
|
2019-09-01 21:49:45 +02:00
|
|
|
func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersionTag string) bool {
|
|
|
|
if ctx.Config().IsEnvTrue("WITHOUT_CHECK_API") {
|
|
|
|
return false
|
|
|
|
} else if String(apiToCheck.Api_file) != "" && String(apiToCheck.Removed_api_file) != "" {
|
2018-09-05 02:14:32 +02:00
|
|
|
return true
|
|
|
|
} else if String(apiToCheck.Api_file) != "" {
|
|
|
|
panic("for " + apiVersionTag + " removed_api_file has to be non-empty!")
|
|
|
|
} else if String(apiToCheck.Removed_api_file) != "" {
|
|
|
|
panic("for " + apiVersionTag + " api_file has to be non-empty!")
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
// Javadoc
|
2018-01-11 01:06:12 +01:00
|
|
|
type Javadoc struct {
|
|
|
|
android.ModuleBase
|
|
|
|
android.DefaultableModuleBase
|
|
|
|
|
|
|
|
properties JavadocProperties
|
|
|
|
|
|
|
|
srcJars android.Paths
|
|
|
|
srcFiles android.Paths
|
|
|
|
sourcepaths android.Paths
|
2020-04-30 09:08:37 +02:00
|
|
|
implicits android.Paths
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2018-03-09 02:26:16 +01:00
|
|
|
docZip android.WritablePath
|
|
|
|
stubsSrcJar android.WritablePath
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2019-05-29 23:40:35 +02:00
|
|
|
func (j *Javadoc) OutputFiles(tag string) (android.Paths, error) {
|
|
|
|
switch tag {
|
|
|
|
case "":
|
|
|
|
return android.Paths{j.stubsSrcJar}, nil
|
2019-08-12 22:11:40 +02:00
|
|
|
case ".docs.zip":
|
|
|
|
return android.Paths{j.docZip}, nil
|
2019-05-29 23:40:35 +02:00
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
|
|
|
}
|
2018-02-23 20:18:47 +01:00
|
|
|
}
|
|
|
|
|
2019-07-09 01:48:04 +02:00
|
|
|
// javadoc converts .java source files to documentation using javadoc.
|
2018-01-11 01:06:12 +01:00
|
|
|
func JavadocFactory() android.Module {
|
|
|
|
module := &Javadoc{}
|
|
|
|
|
|
|
|
module.AddProperties(&module.properties)
|
|
|
|
|
|
|
|
InitDroiddocModule(module, android.HostAndDeviceSupported)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2019-07-09 01:48:04 +02:00
|
|
|
// javadoc_host converts .java source files to documentation using javadoc.
|
2018-01-11 01:06:12 +01:00
|
|
|
func JavadocHostFactory() android.Module {
|
|
|
|
module := &Javadoc{}
|
|
|
|
|
|
|
|
module.AddProperties(&module.properties)
|
|
|
|
|
|
|
|
InitDroiddocModule(module, android.HostSupported)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2019-05-29 23:40:35 +02:00
|
|
|
var _ android.OutputFileProducer = (*Javadoc)(nil)
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2021-04-02 01:45:46 +02:00
|
|
|
func (j *Javadoc) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
|
|
|
return android.SdkSpecFrom(ctx, String(j.properties.Sdk_version))
|
2018-06-26 00:48:06 +02:00
|
|
|
}
|
|
|
|
|
2021-03-29 13:11:58 +02:00
|
|
|
func (j *Javadoc) SystemModules() string {
|
2019-10-11 14:50:28 +02:00
|
|
|
return proptools.String(j.properties.System_modules)
|
|
|
|
}
|
|
|
|
|
2023-03-03 22:20:36 +01:00
|
|
|
func (j *Javadoc) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
|
|
|
return j.SdkVersion(ctx).ApiLevel
|
2018-06-26 00:48:06 +02:00
|
|
|
}
|
|
|
|
|
2022-05-17 22:21:50 +02:00
|
|
|
func (j *Javadoc) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
|
|
|
|
return j.SdkVersion(ctx)
|
|
|
|
}
|
|
|
|
|
2023-03-02 00:38:49 +01:00
|
|
|
func (j *Javadoc) TargetSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
|
|
|
return j.SdkVersion(ctx).ApiLevel
|
2018-10-31 23:28:47 +01:00
|
|
|
}
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
|
|
|
|
if ctx.Device() {
|
2021-03-29 13:11:58 +02:00
|
|
|
sdkDep := decodeSdkDep(ctx, android.SdkContext(j))
|
Remove the concept of useDefaultLibs from Soong.
This field in the java/sdk structure was used in two of the many
possible configurations, so it wasn't really a "default". It also
meant that, to understand those configurations, the reader had to know
what was considered the default, which was only possibly by reading
the code in java.go and droiddoc.go which implemented special code
paths when useDefaultLibs was true. By eliminating that setting and
explicitly setting the required values, the code is simpler and easier
to understand.
This change is a straight refactoring, in the sense that the output of
the build should be unchanged.
Regarding the changes to the proguardRaiseTag dependency in java.go:
- This is a noop for anything which had sdkDep.useModule = true prior
to this change, because they all had the same value for
hasFrameworkLibs() and hasStandardLibs().
- This is a noop for anything which had sdkDep.useDefaultLibs = true
prior to this change, because they do not use proguard settings.
- Therefore, it is a noop overall.
- Nevertheless, it is required to make sdkCorePlatform work. Without
this change, such modules would pick up a dependency on framework
libs via the (unused) proguardRaiseTag, which creates a circular
dependency, because this is the sdk_version used when building
framework libs themselves.
Bug: 157640067
Test: m java docs droid
Change-Id: I3a83b5edc1bd48c16b55f6f77e3e710fc8fbd8fa
2020-06-29 12:28:51 +02:00
|
|
|
if sdkDep.useModule {
|
2019-10-17 23:23:50 +02:00
|
|
|
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...)
|
2019-10-11 14:50:28 +02:00
|
|
|
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
|
2019-10-17 23:23:50 +02:00
|
|
|
ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
|
2022-09-23 22:50:56 +02:00
|
|
|
ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-29 23:10:52 +02:00
|
|
|
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
func (j *Javadoc) collectAidlFlags(ctx android.ModuleContext, deps deps) droiddocBuilderFlags {
|
|
|
|
var flags droiddocBuilderFlags
|
2018-05-23 11:42:04 +02:00
|
|
|
|
2019-04-18 19:56:44 +02:00
|
|
|
flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
|
2018-05-23 11:42:04 +02:00
|
|
|
|
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (j *Javadoc) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
|
2019-04-18 19:56:44 +02:00
|
|
|
aidlIncludeDirs android.Paths) (string, android.Paths) {
|
2018-05-23 11:42:04 +02:00
|
|
|
|
|
|
|
aidlIncludes := android.PathsForModuleSrc(ctx, j.properties.Aidl.Local_include_dirs)
|
|
|
|
aidlIncludes = append(aidlIncludes, android.PathsForSource(ctx, j.properties.Aidl.Include_dirs)...)
|
|
|
|
|
|
|
|
var flags []string
|
2019-04-18 19:56:44 +02:00
|
|
|
var deps android.Paths
|
|
|
|
|
2018-05-23 11:42:04 +02:00
|
|
|
if aidlPreprocess.Valid() {
|
|
|
|
flags = append(flags, "-p"+aidlPreprocess.String())
|
2019-04-18 19:56:44 +02:00
|
|
|
deps = append(deps, aidlPreprocess.Path())
|
2018-05-23 11:42:04 +02:00
|
|
|
} else {
|
|
|
|
flags = append(flags, android.JoinWithPrefix(aidlIncludeDirs.Strings(), "-I"))
|
|
|
|
}
|
|
|
|
|
|
|
|
flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I"))
|
|
|
|
flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
|
|
|
|
if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() {
|
|
|
|
flags = append(flags, "-I"+src.String())
|
|
|
|
}
|
|
|
|
|
2023-03-03 22:20:36 +01:00
|
|
|
minSdkVersion := j.MinSdkVersion(ctx).FinalOrFutureInt()
|
2022-11-17 05:29:59 +01:00
|
|
|
flags = append(flags, fmt.Sprintf("--min_sdk_version=%v", minSdkVersion))
|
|
|
|
|
2019-04-18 19:56:44 +02:00
|
|
|
return strings.Join(flags, " "), deps
|
2018-05-23 11:42:04 +02:00
|
|
|
}
|
|
|
|
|
2019-08-20 15:49:19 +02:00
|
|
|
// TODO: remove the duplication between this and the one in gen.go
|
2018-05-23 11:42:04 +02:00
|
|
|
func (j *Javadoc) genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
2018-08-01 21:48:00 +02:00
|
|
|
flags droiddocBuilderFlags) android.Paths {
|
2018-05-23 11:42:04 +02:00
|
|
|
|
|
|
|
outSrcFiles := make(android.Paths, 0, len(srcFiles))
|
2019-06-15 03:51:47 +02:00
|
|
|
var aidlSrcs android.Paths
|
2018-05-23 11:42:04 +02:00
|
|
|
|
2022-05-24 19:10:02 +02:00
|
|
|
aidlIncludeFlags := genAidlIncludeFlags(ctx, srcFiles, android.Paths{})
|
2019-08-16 14:12:10 +02:00
|
|
|
|
2018-05-23 11:42:04 +02:00
|
|
|
for _, srcFile := range srcFiles {
|
|
|
|
switch srcFile.Ext() {
|
|
|
|
case ".aidl":
|
2019-06-15 03:51:47 +02:00
|
|
|
aidlSrcs = append(aidlSrcs, srcFile)
|
2019-08-20 15:49:19 +02:00
|
|
|
case ".logtags":
|
|
|
|
javaFile := genLogtags(ctx, srcFile)
|
|
|
|
outSrcFiles = append(outSrcFiles, javaFile)
|
2018-05-23 11:42:04 +02:00
|
|
|
default:
|
|
|
|
outSrcFiles = append(outSrcFiles, srcFile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-15 03:51:47 +02:00
|
|
|
// Process all aidl files together to support sharding them into one or more rules that produce srcjars.
|
|
|
|
if len(aidlSrcs) > 0 {
|
2022-02-10 05:41:46 +01:00
|
|
|
srcJarFiles := genAidl(ctx, aidlSrcs, flags.aidlFlags+aidlIncludeFlags, nil, flags.aidlDeps)
|
2019-06-15 03:51:47 +02:00
|
|
|
outSrcFiles = append(outSrcFiles, srcJarFiles...)
|
|
|
|
}
|
|
|
|
|
2018-05-23 11:42:04 +02:00
|
|
|
return outSrcFiles
|
|
|
|
}
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|
|
|
var deps deps
|
|
|
|
|
2021-03-29 13:11:58 +02:00
|
|
|
sdkDep := decodeSdkDep(ctx, android.SdkContext(j))
|
2018-01-11 01:06:12 +01:00
|
|
|
if sdkDep.invalidVersion {
|
2019-10-17 23:23:50 +02:00
|
|
|
ctx.AddMissingDependencies(sdkDep.bootclasspath)
|
|
|
|
ctx.AddMissingDependencies(sdkDep.java9Classpath)
|
2018-01-11 01:06:12 +01:00
|
|
|
} else if sdkDep.useFiles {
|
2018-05-29 23:44:55 +02:00
|
|
|
deps.bootClasspath = append(deps.bootClasspath, sdkDep.jars...)
|
2020-02-08 21:26:29 +01:00
|
|
|
deps.aidlPreprocess = sdkDep.aidl
|
|
|
|
} else {
|
|
|
|
deps.aidlPreprocess = sdkDep.aidl
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ctx.VisitDirectDeps(func(module android.Module) {
|
|
|
|
otherName := ctx.OtherModuleName(module)
|
|
|
|
tag := ctx.OtherModuleDependencyTag(module)
|
|
|
|
|
2018-05-23 19:59:18 +02:00
|
|
|
switch tag {
|
|
|
|
case bootClasspathTag:
|
2021-02-01 22:59:03 +01:00
|
|
|
if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
|
|
|
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
|
|
deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars...)
|
2019-11-19 20:44:10 +01:00
|
|
|
} else if sm, ok := module.(SystemModulesProvider); ok {
|
2019-10-11 14:50:28 +02:00
|
|
|
// A system modules dependency has been added to the bootclasspath
|
|
|
|
// so add its libs to the bootclasspath.
|
2019-11-19 20:44:10 +01:00
|
|
|
deps.bootClasspath = append(deps.bootClasspath, sm.HeaderJars()...)
|
2018-05-23 19:59:18 +02:00
|
|
|
} else {
|
|
|
|
panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
|
|
|
|
}
|
2022-09-23 22:50:56 +02:00
|
|
|
case libTag, sdkLibTag:
|
2021-02-01 22:59:03 +01:00
|
|
|
if dep, ok := module.(SdkLibraryDependency); ok {
|
2021-04-02 01:45:46 +02:00
|
|
|
deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.SdkVersion(ctx))...)
|
2021-02-01 22:59:03 +01:00
|
|
|
} else if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
|
|
|
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
|
|
deps.classpath = append(deps.classpath, dep.HeaderJars...)
|
|
|
|
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
|
|
|
|
} else if dep, ok := module.(android.SourceFileProducer); ok {
|
2018-01-11 01:06:12 +01:00
|
|
|
checkProducesJars(ctx, dep)
|
|
|
|
deps.classpath = append(deps.classpath, dep.Srcs()...)
|
2021-02-01 22:59:03 +01:00
|
|
|
} else {
|
2018-01-11 01:06:12 +01:00
|
|
|
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
|
|
|
}
|
2019-10-17 23:23:50 +02:00
|
|
|
case java9LibTag:
|
2021-02-01 22:59:03 +01:00
|
|
|
if ctx.OtherModuleHasProvider(module, JavaInfoProvider) {
|
|
|
|
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
|
|
|
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
|
|
|
|
} else {
|
2019-10-17 23:23:50 +02:00
|
|
|
ctx.ModuleErrorf("depends on non-java module %q", otherName)
|
|
|
|
}
|
2018-04-18 02:38:36 +02:00
|
|
|
case systemModulesTag:
|
|
|
|
if deps.systemModules != nil {
|
|
|
|
panic("Found two system module dependencies")
|
|
|
|
}
|
2019-11-19 20:44:10 +01:00
|
|
|
sm := module.(SystemModulesProvider)
|
|
|
|
outputDir, outputDeps := sm.OutputDirAndDeps()
|
|
|
|
deps.systemModules = &systemModules{outputDir, outputDeps}
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
// do not pass exclude_srcs directly when expanding srcFiles since exclude_srcs
|
|
|
|
// may contain filegroup or genrule.
|
2019-03-06 07:25:09 +01:00
|
|
|
srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
|
2020-04-30 09:08:37 +02:00
|
|
|
j.implicits = append(j.implicits, srcFiles...)
|
2019-09-13 13:56:14 +02:00
|
|
|
|
|
|
|
filterByPackage := func(srcs []android.Path, filterPackages []string) []android.Path {
|
|
|
|
if filterPackages == nil {
|
|
|
|
return srcs
|
|
|
|
}
|
|
|
|
filtered := []android.Path{}
|
|
|
|
for _, src := range srcs {
|
|
|
|
if src.Ext() != ".java" {
|
|
|
|
// Don't filter-out non-Java (=generated sources) by package names. This is not ideal,
|
|
|
|
// but otherwise metalava emits stub sources having references to the generated AIDL classes
|
|
|
|
// in filtered-out pacages (e.g. com.android.internal.*).
|
|
|
|
// TODO(b/141149570) We need to fix this by introducing default private constructors or
|
|
|
|
// fixing metalava to not emit constructors having references to unknown classes.
|
|
|
|
filtered = append(filtered, src)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
packageName := strings.ReplaceAll(filepath.Dir(src.Rel()), "/", ".")
|
2020-02-11 16:54:35 +01:00
|
|
|
if android.HasAnyPrefix(packageName, filterPackages) {
|
|
|
|
filtered = append(filtered, src)
|
2019-09-13 13:56:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return filtered
|
|
|
|
}
|
|
|
|
srcFiles = filterByPackage(srcFiles, j.properties.Filter_packages)
|
|
|
|
|
2020-07-06 18:12:57 +02:00
|
|
|
aidlFlags := j.collectAidlFlags(ctx, deps)
|
|
|
|
srcFiles = j.genSources(ctx, srcFiles, aidlFlags)
|
2018-01-11 01:06:12 +01:00
|
|
|
|
|
|
|
// srcs may depend on some genrule output.
|
|
|
|
j.srcJars = srcFiles.FilterByExt(".srcjar")
|
2018-02-23 20:18:47 +01:00
|
|
|
j.srcJars = append(j.srcJars, deps.srcJars...)
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
j.srcFiles = srcFiles.FilterOutByExt(".srcjar")
|
2018-02-23 20:18:47 +01:00
|
|
|
j.srcFiles = append(j.srcFiles, deps.srcs...)
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2020-09-10 17:29:25 +02:00
|
|
|
if len(j.srcFiles) > 0 {
|
|
|
|
j.sourcepaths = android.PathsForModuleSrc(ctx, []string{"."})
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2021-03-26 02:33:16 +01:00
|
|
|
return deps
|
|
|
|
}
|
|
|
|
|
|
|
|
func (j *Javadoc) expandArgs(ctx android.ModuleContext, cmd *android.RuleBuilderCommand) {
|
|
|
|
var argFiles android.Paths
|
2019-02-11 16:38:42 +01:00
|
|
|
argFilesMap := map[string]string{}
|
|
|
|
argFileLabels := []string{}
|
|
|
|
|
|
|
|
for _, label := range j.properties.Arg_files {
|
2019-03-06 07:25:09 +01:00
|
|
|
var paths = android.PathsForModuleSrc(ctx, []string{label})
|
2019-02-11 16:38:42 +01:00
|
|
|
if _, exists := argFilesMap[label]; !exists {
|
2021-03-26 02:33:16 +01:00
|
|
|
argFilesMap[label] = strings.Join(cmd.PathsForInputs(paths), " ")
|
2019-02-11 16:38:42 +01:00
|
|
|
argFileLabels = append(argFileLabels, label)
|
2021-03-26 02:33:16 +01:00
|
|
|
argFiles = append(argFiles, paths...)
|
2018-09-05 02:14:32 +02:00
|
|
|
} else {
|
|
|
|
ctx.ModuleErrorf("multiple arg_files for %q, %q and %q",
|
2019-02-11 16:38:42 +01:00
|
|
|
label, argFilesMap[label], paths)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-06 18:12:57 +02:00
|
|
|
var argsPropertyName string
|
|
|
|
flags := make([]string, 0)
|
|
|
|
if j.properties.Args != nil && j.properties.Flags != nil {
|
|
|
|
ctx.PropertyErrorf("args", "flags is set. Cannot set args")
|
|
|
|
} else if args := proptools.String(j.properties.Args); args != "" {
|
|
|
|
flags = append(flags, args)
|
|
|
|
argsPropertyName = "args"
|
|
|
|
} else {
|
|
|
|
flags = append(flags, j.properties.Flags...)
|
|
|
|
argsPropertyName = "flags"
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, flag := range flags {
|
2021-03-26 02:33:16 +01:00
|
|
|
expanded, err := android.Expand(flag, func(name string) (string, error) {
|
2020-07-06 18:12:57 +02:00
|
|
|
if strings.HasPrefix(name, "location ") {
|
|
|
|
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
|
|
|
if paths, ok := argFilesMap[label]; ok {
|
|
|
|
return paths, nil
|
|
|
|
} else {
|
|
|
|
return "", fmt.Errorf("unknown location label %q, expecting one of %q",
|
|
|
|
label, strings.Join(argFileLabels, ", "))
|
|
|
|
}
|
|
|
|
} else if name == "genDir" {
|
|
|
|
return android.PathForModuleGen(ctx).String(), nil
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
2020-07-06 18:12:57 +02:00
|
|
|
return "", fmt.Errorf("unknown variable '$(%s)'", name)
|
|
|
|
})
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2020-07-06 18:12:57 +02:00
|
|
|
if err != nil {
|
|
|
|
ctx.PropertyErrorf(argsPropertyName, "%s", err.Error())
|
|
|
|
}
|
2021-03-26 02:33:16 +01:00
|
|
|
cmd.Flag(expanded)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2021-03-26 02:33:16 +01:00
|
|
|
cmd.Implicits(argFiles)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (j *Javadoc) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|
|
|
j.addDeps(ctx)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|
|
|
deps := j.collectDeps(ctx)
|
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
j.docZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"docs.zip")
|
|
|
|
|
|
|
|
outDir := android.PathForModuleOut(ctx, "out")
|
|
|
|
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
j.stubsSrcJar = nil
|
|
|
|
|
2020-11-17 02:32:30 +01:00
|
|
|
rule := android.NewRuleBuilder(pctx, ctx)
|
2019-07-16 07:53:46 +02:00
|
|
|
|
|
|
|
rule.Command().Text("rm -rf").Text(outDir.String())
|
|
|
|
rule.Command().Text("mkdir -p").Text(outDir.String())
|
|
|
|
|
|
|
|
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, j.srcJars)
|
2018-04-18 02:38:36 +02:00
|
|
|
|
2021-03-29 13:11:58 +02:00
|
|
|
javaVersion := getJavaVersion(ctx, String(j.properties.Java_version), android.SdkContext(j))
|
2019-07-16 07:53:46 +02:00
|
|
|
|
|
|
|
cmd := javadocSystemModulesCmd(ctx, rule, j.srcFiles, outDir, srcJarDir, srcJarList,
|
|
|
|
deps.systemModules, deps.classpath, j.sourcepaths)
|
|
|
|
|
2019-10-28 19:37:20 +01:00
|
|
|
cmd.FlagWithArg("-source ", javaVersion.String()).
|
2019-07-16 07:53:46 +02:00
|
|
|
Flag("-J-Xmx1024m").
|
|
|
|
Flag("-XDignore.symbol.file").
|
|
|
|
Flag("-Xdoclint:none")
|
|
|
|
|
2021-03-26 02:33:16 +01:00
|
|
|
j.expandArgs(ctx, cmd)
|
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
rule.Command().
|
2020-11-17 02:32:30 +01:00
|
|
|
BuiltTool("soong_zip").
|
2019-07-16 07:53:46 +02:00
|
|
|
Flag("-write_if_changed").
|
|
|
|
Flag("-d").
|
|
|
|
FlagWithOutput("-o ", j.docZip).
|
|
|
|
FlagWithArg("-C ", outDir.String()).
|
|
|
|
FlagWithArg("-D ", outDir.String())
|
|
|
|
|
|
|
|
rule.Restat()
|
|
|
|
|
|
|
|
zipSyncCleanupCmd(rule, srcJarDir)
|
|
|
|
|
2020-11-17 02:32:30 +01:00
|
|
|
rule.Build("javadoc", "javadoc")
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
// Droiddoc
|
|
|
|
type Droiddoc struct {
|
|
|
|
Javadoc
|
|
|
|
|
2020-09-10 17:29:25 +02:00
|
|
|
properties DroiddocProperties
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
|
|
|
|
2019-07-09 01:48:04 +02:00
|
|
|
// droiddoc converts .java source files to documentation using doclava or dokka.
|
2018-08-01 21:48:00 +02:00
|
|
|
func DroiddocFactory() android.Module {
|
|
|
|
module := &Droiddoc{}
|
|
|
|
|
|
|
|
module.AddProperties(&module.properties,
|
|
|
|
&module.Javadoc.properties)
|
|
|
|
|
|
|
|
InitDroiddocModule(module, android.HostAndDeviceSupported)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2019-07-09 01:48:04 +02:00
|
|
|
// droiddoc_host converts .java source files to documentation using doclava or dokka.
|
2018-08-01 21:48:00 +02:00
|
|
|
func DroiddocHostFactory() android.Module {
|
|
|
|
module := &Droiddoc{}
|
|
|
|
|
|
|
|
module.AddProperties(&module.properties,
|
|
|
|
&module.Javadoc.properties)
|
|
|
|
|
|
|
|
InitDroiddocModule(module, android.HostSupported)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2020-09-10 17:29:25 +02:00
|
|
|
func (d *Droiddoc) OutputFiles(tag string) (android.Paths, error) {
|
|
|
|
switch tag {
|
|
|
|
case "", ".docs.zip":
|
|
|
|
return android.Paths{d.Javadoc.docZip}, nil
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
|
|
|
}
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 01:06:12 +01:00
|
|
|
func (d *Droiddoc) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|
|
|
d.Javadoc.addDeps(ctx)
|
|
|
|
|
2018-04-20 03:03:39 +02:00
|
|
|
if String(d.properties.Custom_template) != "" {
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
ctx.AddDependency(ctx.Module(), droiddocTemplateTag, String(d.properties.Custom_template))
|
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
func (d *Droiddoc) doclavaDocsFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, docletPath classpath) {
|
2020-02-22 01:55:46 +01:00
|
|
|
buildNumberFile := ctx.Config().BuildNumberFile(ctx)
|
2018-08-21 05:58:28 +02:00
|
|
|
// Droiddoc always gets "-source 1.8" because it doesn't support 1.9 sources. For modules with 1.9
|
|
|
|
// sources, droiddoc will get sources produced by metalava which will have already stripped out the
|
|
|
|
// 1.9 language features.
|
2022-12-22 22:26:06 +01:00
|
|
|
cmd.FlagWithArg("-source ", getStubsJavaVersion().String()).
|
2019-07-16 01:13:59 +02:00
|
|
|
Flag("-J-Xmx1600m").
|
|
|
|
Flag("-J-XX:-OmitStackTraceInFastThrow").
|
|
|
|
Flag("-XDignore.symbol.file").
|
2022-10-24 16:10:25 +02:00
|
|
|
Flag("--ignore-source-errors").
|
2023-03-01 09:47:42 +01:00
|
|
|
FlagWithArg("-doclet ", "com.google.doclava.Doclava").
|
2019-07-16 01:13:59 +02:00
|
|
|
FlagWithInputList("-docletpath ", docletPath.Paths(), ":").
|
2023-03-01 09:47:42 +01:00
|
|
|
FlagWithArg("-Xmaxerrs ", "10").
|
|
|
|
FlagWithArg("-Xmaxwarns ", "10").
|
2022-10-24 16:10:25 +02:00
|
|
|
Flag("-J--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.formats.html=ALL-UNNAMED").
|
|
|
|
Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED").
|
2020-02-22 01:55:46 +01:00
|
|
|
FlagWithArg("-hdf page.build ", ctx.Config().BuildId()+"-$(cat "+buildNumberFile.String()+")").OrderOnly(buildNumberFile).
|
2019-09-13 00:05:13 +02:00
|
|
|
FlagWithArg("-hdf page.now ", `"$(date -d @$(cat `+ctx.Config().Getenv("BUILD_DATETIME_FILE")+`) "+%d %b %Y %k:%M")" `)
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Custom_template) == "" {
|
|
|
|
// TODO: This is almost always droiddoc-templates-sdk
|
|
|
|
ctx.PropertyErrorf("custom_template", "must specify a template")
|
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
ctx.VisitDirectDepsWithTag(droiddocTemplateTag, func(m android.Module) {
|
2018-08-02 00:00:28 +02:00
|
|
|
if t, ok := m.(*ExportedDroiddocDir); ok {
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagWithArg("-templatedir ", t.dir.String()).Implicits(t.deps)
|
2018-08-01 21:48:00 +02:00
|
|
|
} else {
|
2019-12-19 11:21:09 +01:00
|
|
|
ctx.PropertyErrorf("custom_template", "module %q is not a droiddoc_exported_dir", ctx.OtherModuleName(m))
|
2018-04-20 03:03:39 +02:00
|
|
|
}
|
2018-08-01 21:48:00 +02:00
|
|
|
})
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if len(d.properties.Html_dirs) > 0 {
|
2019-07-16 01:13:59 +02:00
|
|
|
htmlDir := android.PathForModuleSrc(ctx, d.properties.Html_dirs[0])
|
|
|
|
cmd.FlagWithArg("-htmldir ", htmlDir.String()).
|
|
|
|
Implicits(android.PathsForModuleSrc(ctx, []string{filepath.Join(d.properties.Html_dirs[0], "**/*")}))
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if len(d.properties.Html_dirs) > 1 {
|
2019-07-16 01:13:59 +02:00
|
|
|
htmlDir2 := android.PathForModuleSrc(ctx, d.properties.Html_dirs[1])
|
|
|
|
cmd.FlagWithArg("-htmldir2 ", htmlDir2.String()).
|
|
|
|
Implicits(android.PathsForModuleSrc(ctx, []string{filepath.Join(d.properties.Html_dirs[1], "**/*")}))
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
2018-02-23 20:18:47 +01:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if len(d.properties.Html_dirs) > 2 {
|
|
|
|
ctx.PropertyErrorf("html_dirs", "Droiddoc only supports up to 2 html dirs")
|
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-03-06 07:25:09 +01:00
|
|
|
knownTags := android.PathsForModuleSrc(ctx, d.properties.Knowntags)
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagForEachInput("-knowntags ", knownTags)
|
2018-04-20 03:03:39 +02:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagForEachArg("-hdf ", d.properties.Hdf)
|
2018-04-20 03:03:39 +02:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Proofread_file) != "" {
|
|
|
|
proofreadFile := android.PathForModuleOut(ctx, String(d.properties.Proofread_file))
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagWithOutput("-proofread ", proofreadFile)
|
2018-02-23 20:18:47 +01:00
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Todo_file) != "" {
|
|
|
|
// tricky part:
|
|
|
|
// we should not compute full path for todo_file through PathForModuleOut().
|
|
|
|
// the non-standard doclet will get the full path relative to "-o".
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagWithArg("-todo ", String(d.properties.Todo_file)).
|
|
|
|
ImplicitOutput(android.PathForModuleOut(ctx, String(d.properties.Todo_file)))
|
2018-02-23 20:18:47 +01:00
|
|
|
}
|
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Resourcesdir) != "" {
|
|
|
|
// TODO: should we add files under resourcesDir to the implicits? It seems that
|
|
|
|
// resourcesDir is one sub dir of htmlDir
|
|
|
|
resourcesDir := android.PathForModuleSrc(ctx, String(d.properties.Resourcesdir))
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagWithArg("-resourcesdir ", resourcesDir.String())
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
2018-05-05 03:49:16 +02:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Resourcesoutdir) != "" {
|
|
|
|
// TODO: it seems -resourceoutdir reference/android/images/ didn't get generated anywhere.
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd.FlagWithArg("-resourcesoutdir ", String(d.properties.Resourcesoutdir))
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
func (d *Droiddoc) postDoclavaCmds(ctx android.ModuleContext, rule *android.RuleBuilder) {
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Static_doc_index_redirect) != "" {
|
2019-07-16 01:13:59 +02:00
|
|
|
staticDocIndexRedirect := android.PathForModuleSrc(ctx, String(d.properties.Static_doc_index_redirect))
|
|
|
|
rule.Command().Text("cp").
|
|
|
|
Input(staticDocIndexRedirect).
|
|
|
|
Output(android.PathForModuleOut(ctx, "out", "index.html"))
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
2018-04-23 18:59:14 +02:00
|
|
|
|
2018-08-01 21:48:00 +02:00
|
|
|
if String(d.properties.Static_doc_properties) != "" {
|
2019-07-16 01:13:59 +02:00
|
|
|
staticDocProperties := android.PathForModuleSrc(ctx, String(d.properties.Static_doc_properties))
|
|
|
|
rule.Command().Text("cp").
|
|
|
|
Input(staticDocProperties).
|
|
|
|
Output(android.PathForModuleOut(ctx, "out", "source.properties"))
|
2018-06-04 20:28:01 +02:00
|
|
|
}
|
2018-08-01 21:48:00 +02:00
|
|
|
}
|
2018-06-04 20:28:01 +02:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
func javadocCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs android.Paths,
|
2019-07-16 07:53:46 +02:00
|
|
|
outDir, srcJarDir, srcJarList android.Path, sourcepaths android.Paths) *android.RuleBuilderCommand {
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
cmd := rule.Command().
|
2022-10-24 16:10:25 +02:00
|
|
|
BuiltTool("soong_javac_wrapper").Tool(config.JavadocCmd(ctx)).
|
2019-07-16 01:13:59 +02:00
|
|
|
Flag(config.JavacVmFlags).
|
|
|
|
FlagWithArg("-encoding ", "UTF-8").
|
2021-03-13 02:48:14 +01:00
|
|
|
FlagWithRspFileInputList("@", android.PathForModuleOut(ctx, "javadoc.rsp"), srcs).
|
2019-07-16 01:13:59 +02:00
|
|
|
FlagWithInput("@", srcJarList)
|
|
|
|
|
|
|
|
// TODO(ccross): Remove this if- statement once we finish migration for all Doclava
|
|
|
|
// based stubs generation.
|
|
|
|
// In the future, all the docs generation depends on Metalava stubs (droidstubs) srcjar
|
|
|
|
// dir. We need add the srcjar dir to -sourcepath arg, so that Javadoc can figure out
|
|
|
|
// the correct package name base path.
|
|
|
|
if len(sourcepaths) > 0 {
|
|
|
|
cmd.FlagWithList("-sourcepath ", sourcepaths.Strings(), ":")
|
|
|
|
} else {
|
|
|
|
cmd.FlagWithArg("-sourcepath ", srcJarDir.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.FlagWithArg("-d ", outDir.String()).
|
|
|
|
Flag("-quiet")
|
|
|
|
|
|
|
|
return cmd
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
func javadocSystemModulesCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs android.Paths,
|
|
|
|
outDir, srcJarDir, srcJarList android.Path, systemModules *systemModules,
|
|
|
|
classpath classpath, sourcepaths android.Paths) *android.RuleBuilderCommand {
|
|
|
|
|
|
|
|
cmd := javadocCmd(ctx, rule, srcs, outDir, srcJarDir, srcJarList, sourcepaths)
|
|
|
|
|
|
|
|
flag, deps := systemModules.FormJavaSystemModulesPath(ctx.Device())
|
|
|
|
cmd.Flag(flag).Implicits(deps)
|
|
|
|
|
|
|
|
cmd.FlagWithArg("--patch-module ", "java.base=.")
|
|
|
|
|
|
|
|
if len(classpath) > 0 {
|
|
|
|
cmd.FlagWithInputList("-classpath ", classpath.Paths(), ":")
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
func javadocBootclasspathCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs android.Paths,
|
|
|
|
outDir, srcJarDir, srcJarList android.Path, bootclasspath, classpath classpath,
|
|
|
|
sourcepaths android.Paths) *android.RuleBuilderCommand {
|
|
|
|
|
|
|
|
cmd := javadocCmd(ctx, rule, srcs, outDir, srcJarDir, srcJarList, sourcepaths)
|
|
|
|
|
|
|
|
if len(bootclasspath) == 0 && ctx.Device() {
|
|
|
|
// explicitly specify -bootclasspath "" if the bootclasspath is empty to
|
|
|
|
// ensure java does not fall back to the default bootclasspath.
|
|
|
|
cmd.FlagWithArg("-bootclasspath ", `""`)
|
|
|
|
} else if len(bootclasspath) > 0 {
|
|
|
|
cmd.FlagWithInputList("-bootclasspath ", bootclasspath.Paths(), ":")
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(classpath) > 0 {
|
|
|
|
cmd.FlagWithInputList("-classpath ", classpath.Paths(), ":")
|
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
func dokkaCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
|
|
|
outDir, srcJarDir android.Path, bootclasspath, classpath classpath) *android.RuleBuilderCommand {
|
|
|
|
|
|
|
|
// Dokka doesn't support bootClasspath, so combine these two classpath vars for Dokka.
|
|
|
|
dokkaClasspath := append(bootclasspath.Paths(), classpath.Paths()...)
|
|
|
|
|
|
|
|
return rule.Command().
|
2020-11-17 02:32:30 +01:00
|
|
|
BuiltTool("dokka").
|
2019-07-16 01:13:59 +02:00
|
|
|
Flag(config.JavacVmFlags).
|
2022-09-08 17:48:01 +02:00
|
|
|
Flag("-J--add-opens=java.base/java.lang=ALL-UNNAMED").
|
2019-07-16 01:13:59 +02:00
|
|
|
Flag(srcJarDir.String()).
|
|
|
|
FlagWithInputList("-classpath ", dokkaClasspath, ":").
|
|
|
|
FlagWithArg("-format ", "dac").
|
|
|
|
FlagWithArg("-dacRoot ", "/reference/kotlin").
|
|
|
|
FlagWithArg("-output ", outDir.String())
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|
|
|
deps := d.Javadoc.collectDeps(ctx)
|
|
|
|
|
2019-07-16 07:53:46 +02:00
|
|
|
d.Javadoc.docZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"docs.zip")
|
|
|
|
|
2021-11-03 21:31:22 +01:00
|
|
|
jsilver := ctx.Config().HostJavaToolPath(ctx, "jsilver.jar")
|
|
|
|
doclava := ctx.Config().HostJavaToolPath(ctx, "doclava.jar")
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
outDir := android.PathForModuleOut(ctx, "out")
|
|
|
|
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2020-11-17 02:32:30 +01:00
|
|
|
rule := android.NewRuleBuilder(pctx, ctx)
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, d.Javadoc.srcJars)
|
|
|
|
|
|
|
|
var cmd *android.RuleBuilderCommand
|
|
|
|
if Bool(d.properties.Dokka_enabled) {
|
|
|
|
cmd = dokkaCmd(ctx, rule, outDir, srcJarDir, deps.bootClasspath, deps.classpath)
|
|
|
|
} else {
|
2019-07-16 07:53:46 +02:00
|
|
|
cmd = javadocBootclasspathCmd(ctx, rule, d.Javadoc.srcFiles, outDir, srcJarDir, srcJarList,
|
2019-07-16 01:13:59 +02:00
|
|
|
deps.bootClasspath, deps.classpath, d.Javadoc.sourcepaths)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2021-03-26 02:33:16 +01:00
|
|
|
d.expandArgs(ctx, cmd)
|
2019-07-16 01:13:59 +02:00
|
|
|
|
2019-12-19 15:27:08 +01:00
|
|
|
if d.properties.Compat_config != nil {
|
|
|
|
compatConfig := android.PathForModuleSrc(ctx, String(d.properties.Compat_config))
|
|
|
|
cmd.FlagWithInput("-compatconfig ", compatConfig)
|
|
|
|
}
|
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
var desc string
|
2018-09-05 02:14:32 +02:00
|
|
|
if Bool(d.properties.Dokka_enabled) {
|
2019-07-16 01:13:59 +02:00
|
|
|
desc = "dokka"
|
2018-09-05 02:14:32 +02:00
|
|
|
} else {
|
2023-03-01 09:47:42 +01:00
|
|
|
d.doclavaDocsFlags(ctx, cmd, classpath{jsilver, doclava})
|
2019-07-16 01:13:59 +02:00
|
|
|
|
|
|
|
for _, o := range d.Javadoc.properties.Out {
|
|
|
|
cmd.ImplicitOutput(android.PathForModuleGen(ctx, o))
|
|
|
|
}
|
|
|
|
|
|
|
|
d.postDoclavaCmds(ctx, rule)
|
|
|
|
desc = "doclava"
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2019-07-16 01:13:59 +02:00
|
|
|
rule.Command().
|
2020-11-17 02:32:30 +01:00
|
|
|
BuiltTool("soong_zip").
|
2019-07-16 01:13:59 +02:00
|
|
|
Flag("-write_if_changed").
|
|
|
|
Flag("-d").
|
|
|
|
FlagWithOutput("-o ", d.docZip).
|
|
|
|
FlagWithArg("-C ", outDir.String()).
|
|
|
|
FlagWithArg("-D ", outDir.String())
|
|
|
|
|
2023-03-01 09:47:42 +01:00
|
|
|
rule.Restat()
|
2019-07-16 01:13:59 +02:00
|
|
|
|
2023-03-01 09:47:42 +01:00
|
|
|
zipSyncCleanupCmd(rule, srcJarDir)
|
2019-07-16 01:13:59 +02:00
|
|
|
|
2020-11-17 02:32:30 +01:00
|
|
|
rule.Build("javadoc", desc)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
// Exported Droiddoc Directory
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
var droiddocTemplateTag = dependencyTag{name: "droiddoc-template"}
|
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
type ExportedDroiddocDirProperties struct {
|
|
|
|
// path to the directory containing Droiddoc related files.
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
Path *string
|
|
|
|
}
|
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
type ExportedDroiddocDir struct {
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
android.ModuleBase
|
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
properties ExportedDroiddocDirProperties
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
|
|
|
|
deps android.Paths
|
|
|
|
dir android.Path
|
|
|
|
}
|
|
|
|
|
2019-07-09 01:48:04 +02:00
|
|
|
// droiddoc_exported_dir exports a directory of html templates or nullability annotations for use by doclava.
|
2018-08-02 00:00:28 +02:00
|
|
|
func ExportedDroiddocDirFactory() android.Module {
|
|
|
|
module := &ExportedDroiddocDir{}
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
module.AddProperties(&module.properties)
|
|
|
|
android.InitAndroidModule(module)
|
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
func (d *ExportedDroiddocDir) DepsMutator(android.BottomUpMutatorContext) {}
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
|
2018-08-02 00:00:28 +02:00
|
|
|
func (d *ExportedDroiddocDir) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
2019-03-05 21:46:40 +01:00
|
|
|
path := String(d.properties.Path)
|
|
|
|
d.dir = android.PathForModuleSrc(ctx, path)
|
2019-03-06 07:25:09 +01:00
|
|
|
d.deps = android.PathsForModuleSrc(ctx, []string{filepath.Join(path, "**/*")})
|
Add droiddoc_template
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
2018-02-26 23:33:31 +01:00
|
|
|
}
|
2018-02-23 20:18:47 +01:00
|
|
|
|
|
|
|
// Defaults
|
|
|
|
type DocDefaults struct {
|
|
|
|
android.ModuleBase
|
|
|
|
android.DefaultsModuleBase
|
|
|
|
}
|
|
|
|
|
|
|
|
func DocDefaultsFactory() android.Module {
|
|
|
|
module := &DocDefaults{}
|
|
|
|
|
|
|
|
module.AddProperties(
|
|
|
|
&JavadocProperties{},
|
|
|
|
&DroiddocProperties{},
|
|
|
|
)
|
|
|
|
|
|
|
|
android.InitDefaultsModule(module)
|
|
|
|
|
|
|
|
return module
|
|
|
|
}
|
2018-09-05 02:14:32 +02:00
|
|
|
|
2019-07-11 20:01:22 +02:00
|
|
|
func zipSyncCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
|
|
|
srcJarDir android.ModuleOutPath, srcJars android.Paths) android.OutputPath {
|
|
|
|
|
2021-03-13 02:56:51 +01:00
|
|
|
cmd := rule.Command()
|
|
|
|
cmd.Text("rm -rf").Text(cmd.PathForOutput(srcJarDir))
|
|
|
|
cmd = rule.Command()
|
|
|
|
cmd.Text("mkdir -p").Text(cmd.PathForOutput(srcJarDir))
|
2019-07-11 20:01:22 +02:00
|
|
|
srcJarList := srcJarDir.Join(ctx, "list")
|
|
|
|
|
|
|
|
rule.Temporary(srcJarList)
|
|
|
|
|
2021-03-13 02:56:51 +01:00
|
|
|
cmd = rule.Command()
|
|
|
|
cmd.BuiltTool("zipsync").
|
|
|
|
FlagWithArg("-d ", cmd.PathForOutput(srcJarDir)).
|
2019-07-11 20:01:22 +02:00
|
|
|
FlagWithOutput("-l ", srcJarList).
|
|
|
|
FlagWithArg("-f ", `"*.java"`).
|
|
|
|
Inputs(srcJars)
|
|
|
|
|
|
|
|
return srcJarList
|
|
|
|
}
|
|
|
|
|
|
|
|
func zipSyncCleanupCmd(rule *android.RuleBuilder, srcJarDir android.ModuleOutPath) {
|
|
|
|
rule.Command().Text("rm -rf").Text(srcJarDir.String())
|
|
|
|
}
|