Remove ConvertWithBp2build implementations

Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
This commit is contained in:
Colin Cross
2023-12-07 13:10:56 -08:00
parent e51c6e4109
commit 8ff105860d
168 changed files with 64 additions and 39712 deletions

View File

@@ -24,13 +24,10 @@ import (
"strings"
"sync"
"android/soong/ui/metrics/bp2build_metrics_proto"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/bazel"
"android/soong/dexpreopt"
)
@@ -1238,8 +1235,6 @@ type SdkLibraryDependency interface {
type SdkLibrary struct {
Library
android.BazelModuleBase
sdkLibraryProperties sdkLibraryProperties
// Map from api scope to the scope specific property structure.
@@ -2318,47 +2313,9 @@ func SdkLibraryFactory() android.Module {
module.CreateInternalModules(ctx)
}
})
android.InitBazelModule(module)
return module
}
type bazelSdkLibraryAttributes struct {
Public *bazel.Label
System *bazel.Label
Test *bazel.Label
Module_lib *bazel.Label
System_server *bazel.Label
}
// java_sdk_library bp2build converter
func (module *SdkLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
if ctx.ModuleType() != "java_sdk_library" {
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
return
}
nameToAttr := make(map[string]*bazel.Label)
for _, scope := range module.getGeneratedApiScopes(ctx) {
apiSurfaceFile := android.BazelLabelForModuleSrcSingle(ctx, path.Join(module.getApiDir(), scope.apiFilePrefix+"current.txt"))
nameToAttr[scope.name] = &apiSurfaceFile
}
attrs := bazelSdkLibraryAttributes{
Public: nameToAttr["public"],
System: nameToAttr["system"],
Test: nameToAttr["test"],
Module_lib: nameToAttr["module-lib"],
System_server: nameToAttr["system-server"],
}
props := bazel.BazelTargetModuleProperties{
Rule_class: "java_sdk_library",
Bzl_load_location: "//build/bazel/rules/java:sdk_library.bzl",
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, &attrs)
}
//
// SDK library prebuilts
//
@@ -2400,7 +2357,6 @@ type sdkLibraryImportProperties struct {
type SdkLibraryImport struct {
android.ModuleBase
android.DefaultableModuleBase
android.BazelModuleBase
prebuilt android.Prebuilt
android.ApexModuleBase
@@ -2484,7 +2440,6 @@ func sdkLibraryImportFactory() android.Module {
android.InitPrebuiltModule(module, &[]string{""})
android.InitApexModule(module)
android.InitBazelModule(module)
InitJavaModule(module, android.HostAndDeviceSupported)
module.SetDefaultableHook(func(mctx android.DefaultableHookContext) {
@@ -2495,33 +2450,6 @@ func sdkLibraryImportFactory() android.Module {
return module
}
// java_sdk_library bp2build converter
func (i *SdkLibraryImport) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
nameToAttr := make(map[string]*bazel.Label)
for scope, props := range i.scopeProperties {
if api := proptools.String(props.Current_api); api != "" {
apiSurfaceFile := android.BazelLabelForModuleSrcSingle(ctx, api)
nameToAttr[scope.name] = &apiSurfaceFile
}
}
attrs := bazelSdkLibraryAttributes{
Public: nameToAttr["public"],
System: nameToAttr["system"],
Test: nameToAttr["test"],
Module_lib: nameToAttr["module-lib"],
System_server: nameToAttr["system-server"],
}
props := bazel.BazelTargetModuleProperties{
Rule_class: "java_sdk_library",
Bzl_load_location: "//build/bazel/rules/java:sdk_library.bzl",
}
name := android.RemoveOptionalPrebuiltPrefix(i.Name())
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, &attrs)
}
var _ PermittedPackagesForUpdatableBootJars = (*SdkLibraryImport)(nil)
func (module *SdkLibraryImport) PermittedPackagesForUpdatableBootJars() []string {