summaryrefslogtreecommitdiff
path: root/aconfig/aconfig_values.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2023-09-05 17:19:45 -0700
committer Yu Liu <yudiliu@google.com> 2023-09-09 12:33:40 -0700
commit2cc802a4421313db16a054674a4dc567f400844b (patch)
treeb649781238d38c8f2018dc06db2eb4c6416940d7 /aconfig/aconfig_values.go
parent3f0aa4d618766485293946bbd1b603f8904d5310 (diff)
Support aconfig_declarations, aconfig_values and aconfig_value_set
Bug: 297356603 Test: Unit tests Change-Id: I2f797578a35322440db0f281b4d46b6652512e00
Diffstat (limited to 'aconfig/aconfig_values.go')
-rw-r--r--aconfig/aconfig_values.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/aconfig/aconfig_values.go b/aconfig/aconfig_values.go
index 91f1c9098..0aa6a72a4 100644
--- a/aconfig/aconfig_values.go
+++ b/aconfig/aconfig_values.go
@@ -16,6 +16,7 @@ package aconfig
import (
"android/soong/android"
+ "android/soong/bazel"
"github.com/google/blueprint"
)
@@ -23,6 +24,7 @@ import (
type ValuesModule struct {
android.ModuleBase
android.DefaultableModuleBase
+ android.BazelModuleBase
properties struct {
// aconfig files, relative to this Android.bp file
@@ -39,8 +41,7 @@ func ValuesFactory() android.Module {
android.InitAndroidModule(module)
android.InitDefaultableModule(module)
module.AddProperties(&module.properties)
- // TODO: bp2build
- //android.InitBazelModule(module)
+ android.InitBazelModule(module)
return module
}
@@ -68,3 +69,27 @@ func (module *ValuesModule) GenerateAndroidBuildActions(ctx android.ModuleContex
}
ctx.SetProvider(valuesProviderKey, providerData)
}
+
+type bazelAconfigValuesAttributes struct {
+ Srcs bazel.LabelListAttribute
+ Package string
+}
+
+func (module *ValuesModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
+ if ctx.ModuleType() != "aconfig_values" {
+ return
+ }
+
+ srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, module.properties.Srcs))
+
+ attrs := bazelAconfigValuesAttributes{
+ Srcs: srcs,
+ Package: module.properties.Package,
+ }
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "aconfig_values",
+ Bzl_load_location: "//build/bazel/rules/aconfig:aconfig_values.bzl",
+ }
+
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, &attrs)
+}