Make absolute OUT_DIR work with sbox
Test: make OUT_DIR=/tmp/abspath Test: make OUT_DIR=relative-out Bug: 35562758 Change-Id: I688d5f6117b194440c5d01c1040033b5671187c2
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user