Include "soong" in sandboxed out paths

Previously, the path to built files in the sandbox would be
out/.intermediates/... instead of out/soong/.intermediates/....

After this cl, it will be out/soong/.intermediates/.... This makes
it more consistent with the non-sandboxed paths, which is easier for
developers.

CtsApkVerityTestDebugFiles is a genrule that's used to find the paths
to other modules. Developers were expected to build it, then copy all
the files listed in its output file to a temporary directory. Those
paths would be wrong before this change.

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py CtsApkVerityTestDebugFiles
Change-Id: Iadf9e3240a2c828567e46b6b02cc14004f30e8bf
This commit is contained in:
Cole Faust
2023-11-30 17:26:37 -08:00
parent cd11c9535f
commit e8561c6108
4 changed files with 5 additions and 5 deletions

View File

@@ -590,7 +590,7 @@ func (r *RuleBuilder) build(name string, desc string, ninjaEscapeCommandString b
To: proto.String(sboxOutSubDir),
},
{
From: proto.String(PathForOutput(r.ctx).String()),
From: proto.String(r.ctx.Config().OutDir()),
To: proto.String(sboxOutSubDir),
},
},
@@ -891,7 +891,7 @@ func (r *RuleBuilder) _sboxPathForInputRel(path Path) (rel string, inSandbox boo
// When sandboxing inputs all inputs have to be copied into the sandbox. Input files that
// are outputs of other rules could be an arbitrary absolute path if OUT_DIR is set, so they
// will be copied to relative paths under __SBOX_OUT_DIR__/out.
rel, isRelOut, _ := maybeRelErr(PathForOutput(r.ctx).String(), path.String())
rel, isRelOut, _ := maybeRelErr(r.ctx.Config().OutDir(), path.String())
if isRelOut {
return filepath.Join(sboxOutSubDir, rel), true
}