Loading android/rule_builder.go +7 −6 Original line number Diff line number Diff line Loading @@ -367,10 +367,6 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string sboxOutputs[i] = "__SBOX_OUT_DIR__/" + Rel(ctx, r.sboxOutDir.String(), output.String()) } if depFile != nil { sboxOutputs = append(sboxOutputs, "__SBOX_OUT_DIR__/"+Rel(ctx, r.sboxOutDir.String(), depFile.String())) } commandString = proptools.ShellEscape(commandString) if !strings.HasPrefix(commandString, `'`) { commandString = `'` + commandString + `'` Loading @@ -380,8 +376,13 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string sboxCmd.BuiltTool(ctx, "sbox"). Flag("-c").Text(commandString). Flag("--sandbox-path").Text(shared.TempDirForOutDir(PathForOutput(ctx).String())). Flag("--output-root").Text(r.sboxOutDir.String()). Flags(sboxOutputs) Flag("--output-root").Text(r.sboxOutDir.String()) if depFile != nil { sboxCmd.Flag("--depfile-out").Text(depFile.String()) } sboxCmd.Flags(sboxOutputs) commandString = sboxCmd.buf.String() tools = append(tools, sboxCmd.tools...) Loading android/rule_builder_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -475,6 +475,7 @@ func TestRuleBuilder_Build(t *testing.T) { FailIfErrored(t, errs) check := func(t *testing.T, params TestingBuildParams, wantCommand, wantOutput, wantDepfile string, wantRestat bool, extraCmdDeps []string) { t.Helper() if params.RuleParams.Command != wantCommand { t.Errorf("\nwant RuleParams.Command = %q\n got %q", wantCommand, params.RuleParams.Command) } Loading Loading @@ -518,13 +519,14 @@ func TestRuleBuilder_Build(t *testing.T) { t.Run("sbox", func(t *testing.T) { outDir := filepath.Join(buildDir, ".intermediates", "foo_sbox") outFile := filepath.Join(outDir, "foo_sbox") depFile := filepath.Join(outDir, "foo_sbox.d") sbox := filepath.Join(buildDir, "host", config.PrebuiltOS(), "bin/sbox") sandboxPath := shared.TempDirForOutDir(buildDir) cmd := sbox + ` -c 'cp bar __SBOX_OUT_DIR__/foo_sbox' --sandbox-path ` + sandboxPath + " --output-root " + outDir + " __SBOX_OUT_DIR__/foo_sbox __SBOX_OUT_DIR__/foo_sbox.d" cmd := sbox + ` -c 'cp bar __SBOX_OUT_DIR__/foo_sbox' --sandbox-path ` + sandboxPath + " --output-root " + outDir + " --depfile-out " + depFile + " __SBOX_OUT_DIR__/foo_sbox" check(t, ctx.ModuleForTests("foo_sbox", "").Rule("rule"), cmd, outFile, outFile+".d", false, []string{sbox}) cmd, outFile, depFile, false, []string{sbox}) }) t.Run("singleton", func(t *testing.T) { outFile := filepath.Join(buildDir, "baz") Loading cmd/dep_fixer/Android.bp +2 −6 Original line number Diff line number Diff line Loading @@ -14,10 +14,6 @@ blueprint_go_binary { name: "dep_fixer", deps: ["androidmk-parser"], srcs: [ "main.go", "deps.go", ], testSrcs: ["deps_test.go"], deps: ["soong-makedeps"], srcs: ["main.go"], } cmd/dep_fixer/main.go +4 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import ( "io/ioutil" "log" "os" "android/soong/makedeps" ) func main() { Loading @@ -39,7 +41,7 @@ func main() { log.Fatal("Expected at least one input file as an argument") } var mergedDeps *Deps var mergedDeps *makedeps.Deps var firstInput []byte for i, arg := range flag.Args() { Loading @@ -48,7 +50,7 @@ func main() { log.Fatalf("Error opening %q: %v", arg, err) } deps, err := Parse(arg, bytes.NewBuffer(append([]byte(nil), input...))) deps, err := makedeps.Parse(arg, bytes.NewBuffer(append([]byte(nil), input...))) if err != nil { log.Fatalf("Failed to parse: %v", err) } Loading cmd/sbox/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ blueprint_go_binary { name: "sbox", deps: ["soong-makedeps"], srcs: [ "sbox.go", ], Loading Loading
android/rule_builder.go +7 −6 Original line number Diff line number Diff line Loading @@ -367,10 +367,6 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string sboxOutputs[i] = "__SBOX_OUT_DIR__/" + Rel(ctx, r.sboxOutDir.String(), output.String()) } if depFile != nil { sboxOutputs = append(sboxOutputs, "__SBOX_OUT_DIR__/"+Rel(ctx, r.sboxOutDir.String(), depFile.String())) } commandString = proptools.ShellEscape(commandString) if !strings.HasPrefix(commandString, `'`) { commandString = `'` + commandString + `'` Loading @@ -380,8 +376,13 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string sboxCmd.BuiltTool(ctx, "sbox"). Flag("-c").Text(commandString). Flag("--sandbox-path").Text(shared.TempDirForOutDir(PathForOutput(ctx).String())). Flag("--output-root").Text(r.sboxOutDir.String()). Flags(sboxOutputs) Flag("--output-root").Text(r.sboxOutDir.String()) if depFile != nil { sboxCmd.Flag("--depfile-out").Text(depFile.String()) } sboxCmd.Flags(sboxOutputs) commandString = sboxCmd.buf.String() tools = append(tools, sboxCmd.tools...) Loading
android/rule_builder_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -475,6 +475,7 @@ func TestRuleBuilder_Build(t *testing.T) { FailIfErrored(t, errs) check := func(t *testing.T, params TestingBuildParams, wantCommand, wantOutput, wantDepfile string, wantRestat bool, extraCmdDeps []string) { t.Helper() if params.RuleParams.Command != wantCommand { t.Errorf("\nwant RuleParams.Command = %q\n got %q", wantCommand, params.RuleParams.Command) } Loading Loading @@ -518,13 +519,14 @@ func TestRuleBuilder_Build(t *testing.T) { t.Run("sbox", func(t *testing.T) { outDir := filepath.Join(buildDir, ".intermediates", "foo_sbox") outFile := filepath.Join(outDir, "foo_sbox") depFile := filepath.Join(outDir, "foo_sbox.d") sbox := filepath.Join(buildDir, "host", config.PrebuiltOS(), "bin/sbox") sandboxPath := shared.TempDirForOutDir(buildDir) cmd := sbox + ` -c 'cp bar __SBOX_OUT_DIR__/foo_sbox' --sandbox-path ` + sandboxPath + " --output-root " + outDir + " __SBOX_OUT_DIR__/foo_sbox __SBOX_OUT_DIR__/foo_sbox.d" cmd := sbox + ` -c 'cp bar __SBOX_OUT_DIR__/foo_sbox' --sandbox-path ` + sandboxPath + " --output-root " + outDir + " --depfile-out " + depFile + " __SBOX_OUT_DIR__/foo_sbox" check(t, ctx.ModuleForTests("foo_sbox", "").Rule("rule"), cmd, outFile, outFile+".d", false, []string{sbox}) cmd, outFile, depFile, false, []string{sbox}) }) t.Run("singleton", func(t *testing.T) { outFile := filepath.Join(buildDir, "baz") Loading
cmd/dep_fixer/Android.bp +2 −6 Original line number Diff line number Diff line Loading @@ -14,10 +14,6 @@ blueprint_go_binary { name: "dep_fixer", deps: ["androidmk-parser"], srcs: [ "main.go", "deps.go", ], testSrcs: ["deps_test.go"], deps: ["soong-makedeps"], srcs: ["main.go"], }
cmd/dep_fixer/main.go +4 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import ( "io/ioutil" "log" "os" "android/soong/makedeps" ) func main() { Loading @@ -39,7 +41,7 @@ func main() { log.Fatal("Expected at least one input file as an argument") } var mergedDeps *Deps var mergedDeps *makedeps.Deps var firstInput []byte for i, arg := range flag.Args() { Loading @@ -48,7 +50,7 @@ func main() { log.Fatalf("Error opening %q: %v", arg, err) } deps, err := Parse(arg, bytes.NewBuffer(append([]byte(nil), input...))) deps, err := makedeps.Parse(arg, bytes.NewBuffer(append([]byte(nil), input...))) if err != nil { log.Fatalf("Failed to parse: %v", err) } Loading
cmd/sbox/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ blueprint_go_binary { name: "sbox", deps: ["soong-makedeps"], srcs: [ "sbox.go", ], Loading