aboutsummaryrefslogtreecommitdiffstats
path: root/genrule
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-10-20 15:07:08 -0700
committerColin Cross <ccross@android.com>2017-10-20 20:44:50 -0700
commit15e86d938bea0cf95f2694714fbc4dc35ee2a30e (patch)
tree9153d78f2efa6838bcc2f895f12b8d37f8eaa5a9 /genrule
parent535e2cf4e1aa7b942e4662f6073517df0c00d09e (diff)
downloadbuild_soong-15e86d938bea0cf95f2694714fbc4dc35ee2a30e.tar.gz
build_soong-15e86d938bea0cf95f2694714fbc4dc35ee2a30e.tar.bz2
build_soong-15e86d938bea0cf95f2694714fbc4dc35ee2a30e.zip
Support multiple outputs in genrules with depfile: true
Ninja doesn't support depfiles on a rule with multiple outputs. Use a single output and put all the rest as implicit outputs. Bug: 68057449 Test: java_test.go Change-Id: Ia544493b1b3b51b185c865149d8f3e0eb3c57ee2
Diffstat (limited to 'genrule')
-rw-r--r--genrule/genrule.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 4a734dad..e4703531 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -260,13 +260,13 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// recall that Sprintf replaces percent sign expressions, whereas dollar signs expressions remain as written,
// to be replaced later by ninja_strings.go
- sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q $out", sandboxPath, buildDir, rawCommand)
+ sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q $allouts", sandboxPath, buildDir, rawCommand)
ruleParams := blueprint.RuleParams{
Command: sandboxCommand,
CommandDeps: []string{"$sboxCmd"},
}
- var args []string
+ args := []string{"allouts"}
if g.properties.Depfile {
ruleParams.Deps = blueprint.DepsGCC
args = append(args, "depfile")
@@ -281,16 +281,24 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask) {
desc := "generate"
+ if len(task.out) == 0 {
+ ctx.ModuleErrorf("must have at least one output file")
+ return
+ }
if len(task.out) == 1 {
desc += " " + task.out[0].Base()
}
params := android.ModuleBuildParams{
- Rule: g.rule,
- Description: "generate",
- Outputs: task.out,
- Inputs: task.in,
- Implicits: g.deps,
+ Rule: g.rule,
+ Description: "generate",
+ Output: task.out[0],
+ ImplicitOutputs: task.out[1:],
+ Inputs: task.in,
+ Implicits: g.deps,
+ Args: map[string]string{
+ "allouts": strings.Join(task.out.Strings(), " "),
+ },
}
if g.properties.Depfile {
depfile := android.GenPathWithExt(ctx, "", task.out[0], task.out[0].Ext()+".d")