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
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index 2197304..1248275 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -19,7 +19,10 @@
 	"path/filepath"
 
 	"android/soong/android"
+	"android/soong/bazel"
+
 	"github.com/google/blueprint"
+	"github.com/google/blueprint/proptools"
 )
 
 func init() {
@@ -54,6 +57,7 @@
 
 type platformCompatConfig struct {
 	android.ModuleBase
+	android.BazelModuleBase
 
 	properties     platformCompatConfigProperties
 	installDirPath android.InstallPath
@@ -122,10 +126,29 @@
 	}}
 }
 
+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
 }