diff options
Diffstat (limited to 'android')
| -rw-r--r-- | android/config.go | 4 | ||||
| -rw-r--r-- | android/defs.go | 2 | ||||
| -rw-r--r-- | android/rule_builder.go | 4 | ||||
| -rw-r--r-- | android/rule_builder_test.go | 4 | ||||
| -rw-r--r-- | android/variable.go | 10 |
5 files changed, 19 insertions, 5 deletions
diff --git a/android/config.go b/android/config.go index 0aad3bdae..a9fcca5ad 100644 --- a/android/config.go +++ b/android/config.go @@ -1426,6 +1426,10 @@ func (c *config) IsVndkDeprecated() bool { return !Bool(c.productVariables.KeepVndk) } +func (c *config) VendorApiLevel() string { + return String(c.productVariables.VendorApiLevel) +} + func (c *deviceConfig) Arches() []Arch { var arches []Arch for _, target := range c.config.Targets[Android] { diff --git a/android/defs.go b/android/defs.go index b28d2fa3d..03968c10d 100644 --- a/android/defs.go +++ b/android/defs.go @@ -232,7 +232,7 @@ func shellUnescape(s string) string { // ContentFromFileRuleForTests returns the content that was passed to a WriteFileRule for use // in tests. -func ContentFromFileRuleForTests(t *testing.T, params TestingBuildParams) string { +func ContentFromFileRuleForTests(t *testing.T, ctx *TestContext, params TestingBuildParams) string { t.Helper() if g, w := params.Rule, writeFile; g != w { t.Errorf("expected params.Rule to be %q, was %q", w, g) diff --git a/android/rule_builder.go b/android/rule_builder.go index 5c6dffec1..1a491f708 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -1341,9 +1341,9 @@ func (c *RuleBuilderCommand) String() string { // RuleBuilderSboxProtoForTests takes the BuildParams for the manifest passed to RuleBuilder.Sbox() // and returns sbox testproto generated by the RuleBuilder. -func RuleBuilderSboxProtoForTests(t *testing.T, params TestingBuildParams) *sbox_proto.Manifest { +func RuleBuilderSboxProtoForTests(t *testing.T, ctx *TestContext, params TestingBuildParams) *sbox_proto.Manifest { t.Helper() - content := ContentFromFileRuleForTests(t, params) + content := ContentFromFileRuleForTests(t, ctx, params) manifest := sbox_proto.Manifest{} err := prototext.Unmarshal([]byte(content), &manifest) if err != nil { diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go index a6b3a27a1..63c35272a 100644 --- a/android/rule_builder_test.go +++ b/android/rule_builder_test.go @@ -683,7 +683,7 @@ func TestRuleBuilder_Build(t *testing.T) { t.Errorf("want Deps = %q, got %q", blueprint.DepsGCC, params.Deps) } - rspFile2Content := ContentFromFileRuleForTests(t, rspFile2Params) + rspFile2Content := ContentFromFileRuleForTests(t, result.TestContext, rspFile2Params) AssertStringEquals(t, "rspFile2 content", "rsp_in2\n", rspFile2Content) } @@ -797,7 +797,7 @@ func TestRuleBuilderHashInputs(t *testing.T) { t.Run(test.name, func(t *testing.T) { t.Run("sbox", func(t *testing.T) { gen := result.ModuleForTests(test.name+"_sbox", "") - manifest := RuleBuilderSboxProtoForTests(t, gen.Output("sbox.textproto")) + manifest := RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("sbox.textproto")) hash := manifest.Commands[0].GetInputHash() AssertStringEquals(t, "hash", test.expectedHash, hash) diff --git a/android/variable.go b/android/variable.go index 307deaf32..f4c6e1cd2 100644 --- a/android/variable.go +++ b/android/variable.go @@ -226,6 +226,8 @@ type ProductVariables struct { DeviceMaxPageSizeSupported *string `json:",omitempty"` DevicePageSizeAgnostic *bool `json:",omitempty"` + VendorApiLevel *string `json:",omitempty"` + RecoverySnapshotVersion *string `json:",omitempty"` DeviceSecondaryArch *string `json:",omitempty"` @@ -618,6 +620,14 @@ func (v *ProductVariables) SetDefaultConfig() { } } +func (this *ProductVariables) GetBuildFlagBool(flag string) bool { + val, ok := this.BuildFlags[flag] + if !ok { + return false + } + return val == "true" +} + // ProductConfigContext requires the access to the Module to get product config properties. type ProductConfigContext interface { Module() Module |