Set Bazel_module for (un)converted sysprop libs
Set Bazel_module.Label for modules that are migrated and Bazel_module.Bp2build_available: false for types that are not converted. Test: CI Test: m json-module-graph and inspect Change-Id: I47b82d5055cdfd5ba6b2878e88f39447f1a50223
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"android/soong/bazel"
|
"android/soong/bazel"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
@@ -410,7 +411,7 @@ type ccLibraryProperties struct {
|
|||||||
Apex_available []string
|
Apex_available []string
|
||||||
Min_sdk_version *string
|
Min_sdk_version *string
|
||||||
Bazel_module struct {
|
Bazel_module struct {
|
||||||
Bp2build_available *bool
|
Label *string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,6 +429,9 @@ type javaLibraryProperties struct {
|
|||||||
SyspropPublicStub string
|
SyspropPublicStub string
|
||||||
Apex_available []string
|
Apex_available []string
|
||||||
Min_sdk_version *string
|
Min_sdk_version *string
|
||||||
|
Bazel_module struct {
|
||||||
|
Bp2build_available *bool
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
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())
|
"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.
|
// Generate a C++ implementation library.
|
||||||
// cc_library can receive *.sysprop files as their srcs, generating sources itself.
|
// cc_library can receive *.sysprop files as their srcs, generating sources itself.
|
||||||
ccProps := ccLibraryProperties{}
|
ccProps := ccLibraryProperties{}
|
||||||
@@ -492,11 +504,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||||||
ccProps.Host_supported = m.properties.Host_supported
|
ccProps.Host_supported = m.properties.Host_supported
|
||||||
ccProps.Apex_available = m.ApexProperties.Apex_available
|
ccProps.Apex_available = m.ApexProperties.Apex_available
|
||||||
ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
|
ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
|
||||||
// A Bazel macro handles this, so this module does not need to be handled
|
ccProps.Bazel_module.Label = label
|
||||||
// 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)
|
|
||||||
ctx.CreateModule(cc.LibraryFactory, &ccProps)
|
ctx.CreateModule(cc.LibraryFactory, &ccProps)
|
||||||
|
|
||||||
scope := "internal"
|
scope := "internal"
|
||||||
@@ -541,6 +549,11 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||||||
SyspropPublicStub: publicStub,
|
SyspropPublicStub: publicStub,
|
||||||
Apex_available: m.ApexProperties.Apex_available,
|
Apex_available: m.ApexProperties.Apex_available,
|
||||||
Min_sdk_version: m.properties.Java.Min_sdk_version,
|
Min_sdk_version: m.properties.Java.Min_sdk_version,
|
||||||
|
Bazel_module: struct {
|
||||||
|
Bp2build_available *bool
|
||||||
|
}{
|
||||||
|
Bp2build_available: proptools.BoolPtr(false),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if publicStub != "" {
|
if publicStub != "" {
|
||||||
@@ -558,6 +571,11 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||||||
Sdk_version: proptools.StringPtr("core_current"),
|
Sdk_version: proptools.StringPtr("core_current"),
|
||||||
Libs: []string{javaSyspropStub},
|
Libs: []string{javaSyspropStub},
|
||||||
Stem: proptools.StringPtr(m.BaseModuleName()),
|
Stem: proptools.StringPtr(m.BaseModuleName()),
|
||||||
|
Bazel_module: struct {
|
||||||
|
Bp2build_available *bool
|
||||||
|
}{
|
||||||
|
Bp2build_available: proptools.BoolPtr(false),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user