Merge "Remove srcs_lib_whitelist_dirs"
This commit is contained in:
commit
0f60062cb5
|
@ -64,10 +64,7 @@ type JavadocProperties struct {
|
|||
// the java library (in classpath) for documentation that provides java srcs and srcjars.
|
||||
Srcs_lib *string
|
||||
|
||||
// the base dirs under srcs_lib will be scanned for java srcs.
|
||||
Srcs_lib_whitelist_dirs []string
|
||||
|
||||
// the sub dirs under srcs_lib_whitelist_dirs will be scanned for java srcs.
|
||||
// List of packages to document from srcs_lib
|
||||
Srcs_lib_whitelist_pkgs []string
|
||||
|
||||
// If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true.
|
||||
|
@ -428,19 +425,6 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
|
|||
}
|
||||
}
|
||||
|
||||
func (j *Javadoc) genWhitelistPathPrefixes(whitelistPathPrefixes map[string]bool) {
|
||||
for _, dir := range j.properties.Srcs_lib_whitelist_dirs {
|
||||
for _, pkg := range j.properties.Srcs_lib_whitelist_pkgs {
|
||||
// convert foo.bar.baz to foo/bar/baz
|
||||
pkgAsPath := filepath.Join(strings.Split(pkg, ".")...)
|
||||
prefix := filepath.Join(dir, pkgAsPath)
|
||||
if _, found := whitelistPathPrefixes[prefix]; !found {
|
||||
whitelistPathPrefixes[prefix] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (j *Javadoc) collectAidlFlags(ctx android.ModuleContext, deps deps) droiddocBuilderFlags {
|
||||
var flags droiddocBuilderFlags
|
||||
|
||||
|
@ -480,10 +464,12 @@ func (j *Javadoc) genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
|||
|
||||
outSrcFiles := make(android.Paths, 0, len(srcFiles))
|
||||
|
||||
aidlIncludeFlags := genAidlIncludeFlags(srcFiles)
|
||||
|
||||
for _, srcFile := range srcFiles {
|
||||
switch srcFile.Ext() {
|
||||
case ".aidl":
|
||||
javaFile := genAidl(ctx, srcFile, flags.aidlFlags, flags.aidlDeps)
|
||||
javaFile := genAidl(ctx, srcFile, flags.aidlFlags+aidlIncludeFlags, flags.aidlDeps)
|
||||
outSrcFiles = append(outSrcFiles, javaFile)
|
||||
case ".sysprop":
|
||||
javaFile := genSysprop(ctx, srcFile)
|
||||
|
@ -537,14 +523,13 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||
switch dep := module.(type) {
|
||||
case Dependency:
|
||||
srcs := dep.(SrcDependency).CompiledSrcs()
|
||||
whitelistPathPrefixes := make(map[string]bool)
|
||||
j.genWhitelistPathPrefixes(whitelistPathPrefixes)
|
||||
for _, src := range srcs {
|
||||
if _, ok := src.(android.WritablePath); ok { // generated sources
|
||||
deps.srcs = append(deps.srcs, src)
|
||||
} else { // select source path for documentation based on whitelist path prefixs.
|
||||
for k := range whitelistPathPrefixes {
|
||||
if strings.HasPrefix(src.Rel(), k) {
|
||||
for _, pkg := range j.properties.Srcs_lib_whitelist_pkgs {
|
||||
pkgAsPath := filepath.Join(strings.Split(pkg, ".")...)
|
||||
if strings.HasPrefix(src.Rel(), pkgAsPath) {
|
||||
deps.srcs = append(deps.srcs, src)
|
||||
break
|
||||
}
|
||||
|
|
21
java/gen.go
21
java/gen.go
|
@ -65,10 +65,6 @@ var (
|
|||
func genAidl(ctx android.ModuleContext, aidlFile android.Path, aidlFlags string, deps android.Paths) android.Path {
|
||||
javaFile := android.GenPathWithExt(ctx, "aidl", aidlFile, "java")
|
||||
depFile := javaFile.String() + ".d"
|
||||
baseDir := strings.TrimSuffix(aidlFile.String(), aidlFile.Rel())
|
||||
if baseDir != "" {
|
||||
aidlFlags += " -I" + baseDir
|
||||
}
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aidl,
|
||||
|
@ -111,15 +107,30 @@ func genSysprop(ctx android.ModuleContext, syspropFile android.Path) android.Pat
|
|||
return srcJarFile
|
||||
}
|
||||
|
||||
func genAidlIncludeFlags(srcFiles android.Paths) string {
|
||||
var baseDirs []string
|
||||
for _, srcFile := range srcFiles {
|
||||
if srcFile.Ext() == ".aidl" {
|
||||
baseDir := strings.TrimSuffix(srcFile.String(), srcFile.Rel())
|
||||
if baseDir != "" && !android.InList(baseDir, baseDirs) {
|
||||
baseDirs = append(baseDirs, baseDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
return android.JoinWithPrefix(baseDirs, " -I")
|
||||
}
|
||||
|
||||
func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
||||
flags javaBuilderFlags) android.Paths {
|
||||
|
||||
outSrcFiles := make(android.Paths, 0, len(srcFiles))
|
||||
|
||||
aidlIncludeFlags := genAidlIncludeFlags(srcFiles)
|
||||
|
||||
for _, srcFile := range srcFiles {
|
||||
switch srcFile.Ext() {
|
||||
case ".aidl":
|
||||
javaFile := genAidl(ctx, srcFile, flags.aidlFlags, flags.aidlDeps)
|
||||
javaFile := genAidl(ctx, srcFile, flags.aidlFlags+aidlIncludeFlags, flags.aidlDeps)
|
||||
outSrcFiles = append(outSrcFiles, javaFile)
|
||||
case ".logtags":
|
||||
j.logtagsSrcs = append(j.logtagsSrcs, srcFile)
|
||||
|
|
|
@ -103,11 +103,7 @@ type sdkLibraryProperties struct {
|
|||
// the java library (in classpath) for documentation that provides java srcs and srcjars.
|
||||
Srcs_lib *string
|
||||
|
||||
// the base dirs under srcs_lib will be scanned for java srcs.
|
||||
Srcs_lib_whitelist_dirs []string
|
||||
|
||||
// the sub dirs under srcs_lib_whitelist_dirs will be scanned for java srcs.
|
||||
// Defaults to "android.annotation".
|
||||
// list of packages to document from srcs_lib. Defaults to "android.annotation".
|
||||
Srcs_lib_whitelist_pkgs []string
|
||||
|
||||
// a list of top-level directories containing files to merge qualifier annotations
|
||||
|
@ -443,7 +439,6 @@ func (module *SdkLibrary) createDocs(mctx android.LoadHookContext, apiScope apiS
|
|||
Srcs []string
|
||||
Installable *bool
|
||||
Srcs_lib *string
|
||||
Srcs_lib_whitelist_dirs []string
|
||||
Srcs_lib_whitelist_pkgs []string
|
||||
Sdk_version *string
|
||||
Libs []string
|
||||
|
@ -535,7 +530,6 @@ func (module *SdkLibrary) createDocs(mctx android.LoadHookContext, apiScope apiS
|
|||
module.latestRemovedApiFilegroupName(apiScope))
|
||||
props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true)
|
||||
props.Srcs_lib = module.sdkLibraryProperties.Srcs_lib
|
||||
props.Srcs_lib_whitelist_dirs = module.sdkLibraryProperties.Srcs_lib_whitelist_dirs
|
||||
props.Srcs_lib_whitelist_pkgs = module.sdkLibraryProperties.Srcs_lib_whitelist_pkgs
|
||||
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props)
|
||||
|
@ -550,9 +544,9 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue