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:
@@ -17,7 +17,6 @@ package codegen
|
||||
import (
|
||||
"android/soong/aconfig"
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/cc"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -144,41 +143,3 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBuildActions(ctx cc.ModuleContex
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type bazelCcAconfigLibraryAttributes struct {
|
||||
cc.SdkAttributes
|
||||
Aconfig_declarations bazel.LabelAttribute
|
||||
Dynamic_deps bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
// Convert the cc_aconfig_library module to bazel.
|
||||
//
|
||||
// This method is called from cc.ConvertWithBp2build to actually convert the
|
||||
// cc_aconfig_library module. This is necessary since the factory method of this
|
||||
// module type returns a cc library and the bp2build conversion is called on the
|
||||
// cc library type.
|
||||
|
||||
func (this *CcAconfigLibraryCallbacks) GeneratorBp2build(ctx android.Bp2buildMutatorContext, module *cc.Module) bool {
|
||||
if ctx.ModuleType() != "cc_aconfig_library" {
|
||||
return false
|
||||
}
|
||||
|
||||
attrs := bazelCcAconfigLibraryAttributes{
|
||||
SdkAttributes: cc.Bp2BuildParseSdkAttributes(module),
|
||||
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, this.properties.Aconfig_declarations).Label),
|
||||
Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, []string{baseLibDep})),
|
||||
}
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "cc_aconfig_library",
|
||||
Bzl_load_location: "//build/bazel/rules/cc:cc_aconfig_library.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(
|
||||
props,
|
||||
android.CommonAttributes{
|
||||
Name: ctx.ModuleName(),
|
||||
Tags: android.ApexAvailableTagsWithoutTestApexes(ctx, module),
|
||||
},
|
||||
&attrs)
|
||||
return true
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import (
|
||||
|
||||
"android/soong/aconfig"
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/java"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -101,56 +100,3 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
|
||||
func isModeSupported(mode string) bool {
|
||||
return android.InList(mode, aconfigSupportedModes)
|
||||
}
|
||||
|
||||
type bazelJavaAconfigLibraryAttributes struct {
|
||||
Aconfig_declarations bazel.LabelAttribute
|
||||
Sdk_version *string
|
||||
Libs bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) Bp2build(ctx android.Bp2buildMutatorContext, module *java.GeneratedJavaLibraryModule) {
|
||||
if ctx.ModuleType() != "java_aconfig_library" {
|
||||
return
|
||||
}
|
||||
|
||||
// By default, soong builds the aconfig java library with private_current, however
|
||||
// bazel currently doesn't support it so we default it to system_current. One reason
|
||||
// is that the dependency of all java_aconfig_library aconfig-annotations-lib is
|
||||
// built with system_current. For the java aconfig library itself it doesn't really
|
||||
// matter whether it uses private API or system API because the only module it uses
|
||||
// is DeviceConfig which is in system, and the rdeps of the java aconfig library
|
||||
// won't change its sdk version either, so this should be fine.
|
||||
// Ideally we should only use the default value if it is not set by the user, but
|
||||
// bazel only supports a limited sdk versions, for example, the java_aconfig_library
|
||||
// modules in framework/base use core_platform which is not supported by bazel yet.
|
||||
// TODO(b/302148527): change soong to default to system_current as well.
|
||||
sdkVersion := "system_current"
|
||||
|
||||
var libs bazel.LabelListAttribute
|
||||
archVariantProps := module.GetArchVariantProperties(ctx, &java.CommonProperties{})
|
||||
for axis, configToProps := range archVariantProps {
|
||||
for config, p := range configToProps {
|
||||
if archProps, ok := p.(*java.CommonProperties); ok {
|
||||
var libLabels []bazel.Label
|
||||
for _, d := range archProps.Libs {
|
||||
neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d)
|
||||
neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink"
|
||||
libLabels = append(libLabels, neverlinkLabel)
|
||||
}
|
||||
libs.SetSelectValue(axis, config, (bazel.MakeLabelList(libLabels)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attrs := bazelJavaAconfigLibraryAttributes{
|
||||
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, callbacks.properties.Aconfig_declarations).Label),
|
||||
Sdk_version: &sdkVersion,
|
||||
Libs: libs,
|
||||
}
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "java_aconfig_library",
|
||||
Bzl_load_location: "//build/bazel/rules/java:java_aconfig_library.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: ctx.ModuleName()}, &attrs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user