Add sandbox property to the javadoc rule.
The sandbox property indicates whether metalava should only read inputs explicitly specified on the command line. This CL adds the property and sets the appropriate configuration for RBE depending on whether the sandbox is set or not. Bug: b/156613606 Test: built aosp_crosshatch-userdebug with/without RBE_METALAVA. Change-Id: I7256d29f18e0af18dbe65d1c7dbbf62fd3d65f4c Merged-In: I7256d29f18e0af18dbe65d1c7dbbf62fd3d65f4c
This commit is contained in:
@@ -172,7 +172,7 @@ func (r *RuleBuilder) Inputs() Paths {
|
||||
|
||||
inputs := make(map[string]Path)
|
||||
for _, c := range r.commands {
|
||||
for _, input := range c.inputs {
|
||||
for _, input := range append(c.inputs, c.implicits...) {
|
||||
inputStr := input.String()
|
||||
if _, isOutput := outputs[inputStr]; !isOutput {
|
||||
if _, isDepFile := depFiles[inputStr]; !isDepFile {
|
||||
@@ -480,6 +480,7 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
||||
type RuleBuilderCommand struct {
|
||||
buf strings.Builder
|
||||
inputs Paths
|
||||
implicits Paths
|
||||
orderOnlys Paths
|
||||
outputs WritablePaths
|
||||
depFiles WritablePaths
|
||||
@@ -503,6 +504,16 @@ func (c *RuleBuilderCommand) addInput(path Path) string {
|
||||
return path.String()
|
||||
}
|
||||
|
||||
func (c *RuleBuilderCommand) addImplicit(path Path) string {
|
||||
if c.sbox {
|
||||
if rel, isRel, _ := maybeRelErr(c.sboxOutDir.String(), path.String()); isRel {
|
||||
return "__SBOX_OUT_DIR__/" + rel
|
||||
}
|
||||
}
|
||||
c.implicits = append(c.implicits, path)
|
||||
return path.String()
|
||||
}
|
||||
|
||||
func (c *RuleBuilderCommand) addOrderOnly(path Path) {
|
||||
c.orderOnlys = append(c.orderOnlys, path)
|
||||
}
|
||||
@@ -623,7 +634,7 @@ func (c *RuleBuilderCommand) Inputs(paths Paths) *RuleBuilderCommand {
|
||||
// Implicit adds the specified input path to the dependencies returned by RuleBuilder.Inputs without modifying the
|
||||
// command line.
|
||||
func (c *RuleBuilderCommand) Implicit(path Path) *RuleBuilderCommand {
|
||||
c.addInput(path)
|
||||
c.addImplicit(path)
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -631,11 +642,16 @@ func (c *RuleBuilderCommand) Implicit(path Path) *RuleBuilderCommand {
|
||||
// command line.
|
||||
func (c *RuleBuilderCommand) Implicits(paths Paths) *RuleBuilderCommand {
|
||||
for _, path := range paths {
|
||||
c.addInput(path)
|
||||
c.addImplicit(path)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// GetImplicits returns the command's implicit inputs.
|
||||
func (c *RuleBuilderCommand) GetImplicits() Paths {
|
||||
return c.implicits
|
||||
}
|
||||
|
||||
// OrderOnly adds the specified input path to the dependencies returned by RuleBuilder.OrderOnlys
|
||||
// without modifying the command line.
|
||||
func (c *RuleBuilderCommand) OrderOnly(path Path) *RuleBuilderCommand {
|
||||
|
Reference in New Issue
Block a user