Create bp2build converter for platform_compat_config module type
This change adds bp2build converter for platform_compat_config module type and its corresponding test case. Bug: 269202028 Test: bp2build unit tests Change-Id: I17d560c8f0e725efe69e151685d003c3dcb11f2f
This commit is contained in:
@@ -19,7 +19,10 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -54,6 +57,7 @@ type platformCompatConfigProperties struct {
|
||||
|
||||
type platformCompatConfig struct {
|
||||
android.ModuleBase
|
||||
android.BazelModuleBase
|
||||
|
||||
properties platformCompatConfigProperties
|
||||
installDirPath android.InstallPath
|
||||
@@ -122,10 +126,29 @@ func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
}}
|
||||
}
|
||||
|
||||
type bazelPlatformCompatConfigAttributes struct {
|
||||
Src bazel.LabelAttribute
|
||||
}
|
||||
|
||||
func (p *platformCompatConfig) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "platform_compat_config",
|
||||
Bzl_load_location: "//build/bazel/rules/java:platform_compat_config.bzl",
|
||||
}
|
||||
attr := &bazelPlatformCompatConfigAttributes{
|
||||
Src: *bazel.MakeLabelAttribute(
|
||||
android.BazelLabelForModuleSrcSingle(ctx, proptools.String(p.properties.Src)).Label),
|
||||
}
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
|
||||
Name: p.Name(),
|
||||
}, attr)
|
||||
}
|
||||
|
||||
func PlatformCompatConfigFactory() android.Module {
|
||||
module := &platformCompatConfig{}
|
||||
module.AddProperties(&module.properties)
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitBazelModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user