Reland: Rewrite sbox to use a textproto manifest
This relands I3b918a6643cea77199fd39577ef71e34cdeacdb1 with a fix to create the directory for the output depfile if doesn't exist. In preparation for more complicated sandboxing that copies tools and/or inputs into the sandbox directory, make sbox use a textproto input that describes the commands to be run and the files to copy in or out of the sandbox. Bug: 124313442 Test: m checkbuild Test: rule_builder_test.go Test: genrule_test.go Change-Id: I8af00c8c0b25a92f55a5032fcb525715ae8297c2
This commit is contained in:
@@ -232,7 +232,8 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
||||
var yaccRule_ *android.RuleBuilder
|
||||
yaccRule := func() *android.RuleBuilder {
|
||||
if yaccRule_ == nil {
|
||||
yaccRule_ = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "yacc"))
|
||||
yaccRule_ = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "yacc"),
|
||||
android.PathForModuleGen(ctx, "yacc.sbox.textproto"))
|
||||
}
|
||||
return yaccRule_
|
||||
}
|
||||
@@ -261,7 +262,8 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
||||
deps = append(deps, headerFile)
|
||||
case ".aidl":
|
||||
if aidlRule == nil {
|
||||
aidlRule = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "aidl"))
|
||||
aidlRule = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "aidl"),
|
||||
android.PathForModuleGen(ctx, "aidl.sbox.textproto"))
|
||||
}
|
||||
cppFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp")
|
||||
depFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp.d")
|
||||
|
@@ -18,6 +18,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
func TestGen(t *testing.T) {
|
||||
@@ -56,13 +58,14 @@ func TestGen(t *testing.T) {
|
||||
}`)
|
||||
|
||||
aidl := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("aidl")
|
||||
aidlManifest := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Output("aidl.sbox.textproto")
|
||||
libfoo := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
|
||||
|
||||
if !inList("-I"+filepath.Dir(aidl.Output.String()), libfoo.flags.Local.CommonFlags) {
|
||||
t.Errorf("missing aidl includes in global flags")
|
||||
}
|
||||
|
||||
aidlCommand := aidl.RuleParams.Command
|
||||
aidlCommand := android.RuleBuilderSboxProtoForTests(t, aidlManifest).Commands[0].GetCommand()
|
||||
if !strings.Contains(aidlCommand, "-Isub") {
|
||||
t.Errorf("aidl command for c.aidl should contain \"-Isub\", but was %q", aidlCommand)
|
||||
}
|
||||
|
Reference in New Issue
Block a user