diff options
author | Jeff Gaston <jeffrygaston@google.com> | 2017-06-12 15:00:12 -0700 |
---|---|---|
committer | Jeff Gaston <jeffrygaston@google.com> | 2017-06-12 16:36:17 -0700 |
commit | 193f2fb092387dc42d1243405f577e3d00f7bde9 (patch) | |
tree | 69c21c64fe43546a8245873f926fa124addad7b3 /genrule | |
parent | aac67d38b290e786f294b4c41c9f3a527efe7dda (diff) | |
download | build_soong-193f2fb092387dc42d1243405f577e3d00f7bde9.tar.gz build_soong-193f2fb092387dc42d1243405f577e3d00f7bde9.tar.bz2 build_soong-193f2fb092387dc42d1243405f577e3d00f7bde9.zip |
Make absolute OUT_DIR work with sbox
Test: make OUT_DIR=/tmp/abspath
Test: make OUT_DIR=relative-out
Bug: 35562758
Change-Id: I688d5f6117b194440c5d01c1040033b5671187c2
Diffstat (limited to 'genrule')
-rw-r--r-- | genrule/genrule.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/genrule/genrule.go b/genrule/genrule.go index b98ccfdb..dc4e9683 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -194,15 +194,11 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) { case "genDir": genPath := android.PathForModuleGen(ctx, "").String() var relativePath string - if path.IsAbs(genPath) { - var err error - outputPath := android.PathForOutput(ctx).String() - relativePath, err = filepath.Rel(genPath, outputPath) - if err != nil { - panic(err) - } - } else { - relativePath = genPath + var err error + outputPath := android.PathForOutput(ctx).String() + relativePath, err = filepath.Rel(outputPath, genPath) + if err != nil { + panic(err) } return path.Join("__SBOX_OUT_DIR__", relativePath), nil default: @@ -224,11 +220,12 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) { } // tell the sbox command which directory to use as its sandbox root - sandboxPath := shared.TempDirForOutDir(android.PathForOutput(ctx).String()) + buildDir := android.PathForOutput(ctx).String() + sandboxPath := shared.TempDirForOutDir(buildDir) // 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 -c %q $out", sandboxPath, rawCommand) + sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q $out", sandboxPath, buildDir, rawCommand) ruleParams := blueprint.RuleParams{ Command: sandboxCommand, |