aboutsummaryrefslogtreecommitdiffstats
path: root/genrule
diff options
context:
space:
mode:
authorJeff Gaston <jeffrygaston@google.com>2017-11-06 14:15:16 -0800
committerJeff Gaston <jeffrygaston@google.com>2017-11-08 12:37:14 -0800
commit5acec2b0e04d5b5d49838d9789fd367b0203c589 (patch)
treec9cb6fa6f5008dfbd96f1220cf2e8fd1b193f17b /genrule
parentd293e65c820805bd526d3cf84ab13df0d85c42da (diff)
downloadbuild_soong-5acec2b0e04d5b5d49838d9789fd367b0203c589.tar.gz
build_soong-5acec2b0e04d5b5d49838d9789fd367b0203c589.tar.bz2
build_soong-5acec2b0e04d5b5d49838d9789fd367b0203c589.zip
Have genrule use $genDir as sbox's --output-root
rather than passing buildDir . This will make it reasonable for sbox to delete its --output-root Bug: 38205169 Test: m -j Change-Id: Ic3a82a8df040117870c251c068a88545143257cf
Diffstat (limited to 'genrule')
-rw-r--r--genrule/genrule.go22
1 files changed, 5 insertions, 17 deletions
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 6af18eeb..cffbf738 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -138,17 +138,6 @@ func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
-// Given an output file, returns an expression for the corresponding file path within the sandbox
-func sandboxPathForOutput(ctx android.ModuleContext, outputFile string) (relative string, err error) {
- var relativePath string
- basedir := ctx.AConfig().BuildDir()
- relativePath, err = filepath.Rel(basedir, outputFile)
- if err != nil {
- return "", err
- }
- return filepath.Join("__SBOX_OUT_DIR__", relativePath), nil
-}
-
func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(g.properties.Tools) == 0 && len(g.properties.Tool_files) == 0 {
ctx.ModuleErrorf("at least one `tools` or `tool_files` is required")
@@ -221,6 +210,8 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
referencedDepfile := false
+ ruleOutputDir := android.PathForModuleGen(ctx, "").String()
+
rawCommand, err := android.Expand(g.properties.Cmd, func(name string) (string, error) {
switch name {
case "location":
@@ -240,11 +231,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
return "__SBOX_DEPFILE__", nil
case "genDir":
- path, err := sandboxPathForOutput(ctx, android.PathForModuleGen(ctx, "").String())
- if err != nil {
- return "", err
- }
- return path, nil
+ return "__SBOX_OUT_DIR__", nil
default:
if strings.HasPrefix(name, "location ") {
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
@@ -277,7 +264,8 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if g.properties.Depfile {
depfilePlaceholder = "$depfileArgs"
}
- sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q %s $allouts", sandboxPath, buildDir, rawCommand, depfilePlaceholder)
+
+ sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q %s $allouts", sandboxPath, ruleOutputDir, rawCommand, depfilePlaceholder)
ruleParams := blueprint.RuleParams{
Command: sandboxCommand,