diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go index 0edbb7c37..a2c0fb731 100644 --- a/sysprop/sysprop_library.go +++ b/sysprop/sysprop_library.go @@ -24,6 +24,7 @@ import ( "sync" "android/soong/bazel" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" @@ -410,7 +411,7 @@ type ccLibraryProperties struct { Apex_available []string Min_sdk_version *string Bazel_module struct { - Bp2build_available *bool + Label *string } } @@ -428,6 +429,9 @@ type javaLibraryProperties struct { SyspropPublicStub string Apex_available []string Min_sdk_version *string + Bazel_module struct { + Bp2build_available *bool + } } func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { @@ -473,6 +477,14 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner()) } + var label *string + if b, ok := ctx.Module().(android.Bazelable); ok && b.ShouldConvertWithBp2build(ctx) { + // TODO: b/295566168 - this will need to change once build files are checked in to account for + // checked in modules in mixed builds + label = proptools.StringPtr( + fmt.Sprintf("//%s:%s", ctx.ModuleDir(), m.CcImplementationModuleName())) + } + // Generate a C++ implementation library. // cc_library can receive *.sysprop files as their srcs, generating sources itself. ccProps := ccLibraryProperties{} @@ -492,11 +504,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { ccProps.Host_supported = m.properties.Host_supported ccProps.Apex_available = m.ApexProperties.Apex_available ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version - // A Bazel macro handles this, so this module does not need to be handled - // in bp2build - // TODO(b/237810289) perhaps do something different here so that we aren't - // also disabling these modules in mixed builds - ccProps.Bazel_module.Bp2build_available = proptools.BoolPtr(false) + ccProps.Bazel_module.Label = label ctx.CreateModule(cc.LibraryFactory, &ccProps) scope := "internal" @@ -541,6 +549,11 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { SyspropPublicStub: publicStub, Apex_available: m.ApexProperties.Apex_available, Min_sdk_version: m.properties.Java.Min_sdk_version, + Bazel_module: struct { + Bp2build_available *bool + }{ + Bp2build_available: proptools.BoolPtr(false), + }, }) if publicStub != "" { @@ -558,6 +571,11 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { Sdk_version: proptools.StringPtr("core_current"), Libs: []string{javaSyspropStub}, Stem: proptools.StringPtr(m.BaseModuleName()), + Bazel_module: struct { + Bp2build_available *bool + }{ + Bp2build_available: proptools.BoolPtr(false), + }, }) }