summaryrefslogtreecommitdiff
path: root/xml/xml.go
diff options
context:
space:
mode:
author Alix <agespino@google.com> 2022-06-27 20:57:44 +0000
committer Alix Espino <agespino@google.com> 2022-09-22 20:17:19 +0000
commit5918d649a4c2e4e77efca5d50cbd0dfafb004251 (patch)
tree265d9c51a2c06a9532dafe86be1b2c26b75ba527 /xml/xml.go
parent2c27b17f8e0edc27526d0fa8bb95d0290ab5d8d5 (diff)
Implement bp2build for prebuilt_etc_xml
Bug: 237039154 Test: xml_conversion_test.go & bp2build Change-Id: I1f2c57b9532138f73041d8fc08feea3f66b2ebbc
Diffstat (limited to 'xml/xml.go')
-rw-r--r--xml/xml.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/xml/xml.go b/xml/xml.go
index c28107847..8c0c07282 100644
--- a/xml/xml.go
+++ b/xml/xml.go
@@ -16,6 +16,7 @@ package xml
import (
"android/soong/android"
+ "android/soong/bazel"
"android/soong/etc"
"github.com/google/blueprint"
@@ -67,6 +68,8 @@ type prebuiltEtcXmlProperties struct {
}
type prebuiltEtcXml struct {
+ android.BazelModuleBase
+
etc.PrebuiltEtc
properties prebuiltEtcXmlProperties
@@ -129,5 +132,40 @@ func PrebuiltEtcXmlFactory() android.Module {
etc.InitPrebuiltEtcModule(&module.PrebuiltEtc, "etc")
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitBazelModule(module)
return module
}
+
+type bazelPrebuiltEtcXmlAttributes struct {
+ Src bazel.LabelAttribute
+ Filename bazel.LabelAttribute
+ Dir string
+ Installable bazel.BoolAttribute
+ Filename_from_src bazel.BoolAttribute
+ Schema *string
+}
+
+func (p *prebuiltEtcXml) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
+ baseAttrs := p.PrebuiltEtc.Bp2buildHelper(ctx)
+
+ var schema *string
+ if p.properties.Schema != nil {
+ schema = p.properties.Schema
+ }
+
+ attrs := &bazelPrebuiltEtcXmlAttributes{
+ Src: baseAttrs.Src,
+ Filename: baseAttrs.Filename,
+ Dir: baseAttrs.Dir,
+ Installable: baseAttrs.Installable,
+ Filename_from_src: baseAttrs.Filename_from_src,
+ Schema: schema,
+ }
+
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "prebuilt_xml",
+ Bzl_load_location: "//build/bazel/rules/prebuilt_xml.bzl",
+ }
+
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: p.Name()}, attrs)
+}