Merge "Add array type property flags, equivalent to args"
This commit is contained in:
@@ -112,13 +112,20 @@ type JavadocProperties struct {
|
|||||||
// local files that are used within user customized droiddoc options.
|
// local files that are used within user customized droiddoc options.
|
||||||
Arg_files []string `android:"path"`
|
Arg_files []string `android:"path"`
|
||||||
|
|
||||||
// user customized droiddoc args.
|
// user customized droiddoc args. Deprecated, use flags instead.
|
||||||
// Available variables for substitution:
|
// Available variables for substitution:
|
||||||
//
|
//
|
||||||
// $(location <label>): the path to the arg_files with name <label>
|
// $(location <label>): the path to the arg_files with name <label>
|
||||||
// $$: a literal $
|
// $$: a literal $
|
||||||
Args *string
|
Args *string
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
// names of the output files used in args that will be generated
|
// names of the output files used in args that will be generated
|
||||||
Out []string
|
Out []string
|
||||||
|
|
||||||
@@ -382,7 +389,7 @@ type Javadoc struct {
|
|||||||
argFiles android.Paths
|
argFiles android.Paths
|
||||||
implicits android.Paths
|
implicits android.Paths
|
||||||
|
|
||||||
args string
|
args []string
|
||||||
|
|
||||||
docZip android.WritablePath
|
docZip android.WritablePath
|
||||||
stubsSrcJar android.WritablePath
|
stubsSrcJar android.WritablePath
|
||||||
@@ -619,8 +626,8 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
}
|
}
|
||||||
srcFiles = filterHtml(srcFiles)
|
srcFiles = filterHtml(srcFiles)
|
||||||
|
|
||||||
flags := j.collectAidlFlags(ctx, deps)
|
aidlFlags := j.collectAidlFlags(ctx, deps)
|
||||||
srcFiles = j.genSources(ctx, srcFiles, flags)
|
srcFiles = j.genSources(ctx, srcFiles, aidlFlags)
|
||||||
|
|
||||||
// srcs may depend on some genrule output.
|
// srcs may depend on some genrule output.
|
||||||
j.srcJars = srcFiles.FilterByExt(".srcjar")
|
j.srcJars = srcFiles.FilterByExt(".srcjar")
|
||||||
@@ -649,8 +656,20 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var argsPropertyName string
|
||||||
j.args, err = android.Expand(String(j.properties.Args), func(name string) (string, error) {
|
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 {
|
||||||
|
args, err := android.Expand(flag, func(name string) (string, error) {
|
||||||
if strings.HasPrefix(name, "location ") {
|
if strings.HasPrefix(name, "location ") {
|
||||||
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
||||||
if paths, ok := argFilesMap[label]; ok {
|
if paths, ok := argFilesMap[label]; ok {
|
||||||
@@ -666,7 +685,9 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("args", "%s", err.Error())
|
ctx.PropertyErrorf(argsPropertyName, "%s", err.Error())
|
||||||
|
}
|
||||||
|
j.args = append(j.args, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
@@ -1010,7 +1031,7 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
d.stubsFlags(ctx, cmd, stubsDir)
|
d.stubsFlags(ctx, cmd, stubsDir)
|
||||||
|
|
||||||
cmd.Flag(d.Javadoc.args).Implicits(d.Javadoc.argFiles)
|
cmd.Flag(strings.Join(d.Javadoc.args, " ")).Implicits(d.Javadoc.argFiles)
|
||||||
|
|
||||||
if d.properties.Compat_config != nil {
|
if d.properties.Compat_config != nil {
|
||||||
compatConfig := android.PathForModuleSrc(ctx, String(d.properties.Compat_config))
|
compatConfig := android.PathForModuleSrc(ctx, String(d.properties.Compat_config))
|
||||||
@@ -1327,7 +1348,7 @@ func (d *Droidstubs) annotationsFlags(ctx android.ModuleContext, cmd *android.Ru
|
|||||||
cmd.Flag("--include-annotations")
|
cmd.Flag("--include-annotations")
|
||||||
|
|
||||||
validatingNullability :=
|
validatingNullability :=
|
||||||
strings.Contains(d.Javadoc.args, "--validate-nullability-from-merged-stubs") ||
|
android.InList("--validate-nullability-from-merged-stubs", d.Javadoc.args) ||
|
||||||
String(d.properties.Validate_nullability_from_list) != ""
|
String(d.properties.Validate_nullability_from_list) != ""
|
||||||
|
|
||||||
migratingNullability := String(d.properties.Previous_api) != ""
|
migratingNullability := String(d.properties.Previous_api) != ""
|
||||||
@@ -1539,14 +1560,14 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
d.apiLevelsAnnotationsFlags(ctx, cmd)
|
d.apiLevelsAnnotationsFlags(ctx, cmd)
|
||||||
d.apiToXmlFlags(ctx, cmd)
|
d.apiToXmlFlags(ctx, cmd)
|
||||||
|
|
||||||
if strings.Contains(d.Javadoc.args, "--generate-documentation") {
|
if android.InList("--generate-documentation", d.Javadoc.args) {
|
||||||
// Currently Metalava have the ability to invoke Javadoc in a seperate process.
|
// Currently Metalava have the ability to invoke Javadoc in a seperate process.
|
||||||
// Pass "-nodocs" to suppress the Javadoc invocation when Metalava receives
|
// Pass "-nodocs" to suppress the Javadoc invocation when Metalava receives
|
||||||
// "--generate-documentation" arg. This is not needed when Metalava removes this feature.
|
// "--generate-documentation" arg. This is not needed when Metalava removes this feature.
|
||||||
d.Javadoc.args = d.Javadoc.args + " -nodocs "
|
d.Javadoc.args = append(d.Javadoc.args, "-nodocs")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flag(d.Javadoc.args).Implicits(d.Javadoc.argFiles)
|
cmd.Flag(strings.Join(d.Javadoc.args, " ")).Implicits(d.Javadoc.argFiles)
|
||||||
for _, o := range d.Javadoc.properties.Out {
|
for _, o := range d.Javadoc.properties.Out {
|
||||||
cmd.ImplicitOutput(android.PathForModuleGen(ctx, o))
|
cmd.ImplicitOutput(android.PathForModuleGen(ctx, o))
|
||||||
}
|
}
|
||||||
|
@@ -1097,7 +1097,7 @@ func TestDroiddoc(t *testing.T) {
|
|||||||
],
|
],
|
||||||
proofread_file: "libcore-proofread.txt",
|
proofread_file: "libcore-proofread.txt",
|
||||||
todo_file: "libcore-docs-todo.html",
|
todo_file: "libcore-docs-todo.html",
|
||||||
args: "-offlinemode -title \"libcore\"",
|
flags: ["-offlinemode -title \"libcore\""],
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
map[string][]byte{
|
map[string][]byte{
|
||||||
@@ -1124,6 +1124,42 @@ func TestDroiddoc(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDroiddocArgsAndFlagsCausesError(t *testing.T) {
|
||||||
|
testJavaError(t, "flags is set. Cannot set args", `
|
||||||
|
droiddoc_exported_dir {
|
||||||
|
name: "droiddoc-templates-sdk",
|
||||||
|
path: ".",
|
||||||
|
}
|
||||||
|
filegroup {
|
||||||
|
name: "bar-doc-aidl-srcs",
|
||||||
|
srcs: ["bar-doc/IBar.aidl"],
|
||||||
|
path: "bar-doc",
|
||||||
|
}
|
||||||
|
droiddoc {
|
||||||
|
name: "bar-doc",
|
||||||
|
srcs: [
|
||||||
|
"bar-doc/a.java",
|
||||||
|
"bar-doc/IFoo.aidl",
|
||||||
|
":bar-doc-aidl-srcs",
|
||||||
|
],
|
||||||
|
exclude_srcs: [
|
||||||
|
"bar-doc/b.java"
|
||||||
|
],
|
||||||
|
custom_template: "droiddoc-templates-sdk",
|
||||||
|
hdf: [
|
||||||
|
"android.whichdoc offline",
|
||||||
|
],
|
||||||
|
knowntags: [
|
||||||
|
"bar-doc/known_oj_tags.txt",
|
||||||
|
],
|
||||||
|
proofread_file: "libcore-proofread.txt",
|
||||||
|
todo_file: "libcore-docs-todo.html",
|
||||||
|
flags: ["-offlinemode -title \"libcore\""],
|
||||||
|
args: "-offlinemode -title \"libcore\"",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
func TestDroidstubsWithSystemModules(t *testing.T) {
|
func TestDroidstubsWithSystemModules(t *testing.T) {
|
||||||
ctx, _ := testJava(t, `
|
ctx, _ := testJava(t, `
|
||||||
droidstubs {
|
droidstubs {
|
||||||
|
Reference in New Issue
Block a user