Support sandboxing droiddoc and droidstubs with args properties

args properties can access arbitrary files with $(location) expansions,
so they need to pass them through RuleBuilderCommand.PathsForInputs
to produce a path inside the sandbox.  Extract the arg expansion out
of collectDeps into a new expandArgs method that takes the
RuleBuilderCommand.

Test: TestDroidstubsSandbox
Change-Id: I9022d17bf3cb64c97b2008c4c1b733bf48edca95
This commit is contained in:
Colin Cross
2021-03-25 18:33:16 -07:00
parent 6aa5c40393
commit bc13992711
3 changed files with 29 additions and 17 deletions

View File

@@ -284,7 +284,7 @@ func (d *Droidstubs) annotationsFlags(ctx android.ModuleContext, cmd *android.Ru
cmd.Flag("--include-annotations")
validatingNullability :=
android.InList("--validate-nullability-from-merged-stubs", d.Javadoc.args) ||
strings.Contains(String(d.Javadoc.properties.Args), "--validate-nullability-from-merged-stubs") ||
String(d.properties.Validate_nullability_from_list) != ""
migratingNullability := String(d.properties.Previous_api) != ""
@@ -509,14 +509,8 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
d.inclusionAnnotationsFlags(ctx, cmd)
d.apiLevelsAnnotationsFlags(ctx, cmd)
if android.InList("--generate-documentation", d.Javadoc.args) {
// Currently Metalava have the ability to invoke Javadoc in a separate process.
// Pass "-nodocs" to suppress the Javadoc invocation when Metalava receives
// "--generate-documentation" arg. This is not needed when Metalava removes this feature.
d.Javadoc.args = append(d.Javadoc.args, "-nodocs")
}
d.expandArgs(ctx, cmd)
cmd.Flag(strings.Join(d.Javadoc.args, " ")).Implicits(d.Javadoc.argFiles)
for _, o := range d.Javadoc.properties.Out {
cmd.ImplicitOutput(android.PathForModuleGen(ctx, o))
}