Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main am: c331812a59
am: 95f97af223
am: 88db04e1a9
am: 5b60cdaa36
am: 097399434f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2756986 Change-Id: I3bfd6e81efefe823c8f7b443d28d8df593aad93d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
b8db405c7b
@@ -1241,7 +1241,7 @@ type bazelAndroidLibraryImport struct {
|
||||
Sdk_version bazel.StringAttribute
|
||||
}
|
||||
|
||||
func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.TopDownMutatorContext) (*bazelAapt, bool) {
|
||||
func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.Bp2buildMutatorContext) (*bazelAapt, bool) {
|
||||
manifest := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
|
||||
|
||||
resourceFiles := bazel.LabelList{
|
||||
@@ -1277,7 +1277,7 @@ func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.TopDownMutatorContext) (
|
||||
}, true
|
||||
}
|
||||
|
||||
func (a *AARImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AARImport) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
aars := android.BazelLabelForModuleSrcExcludes(ctx, a.properties.Aars, []string{})
|
||||
exportableStaticLibs := []string{}
|
||||
// TODO(b/240716882): investigate and handle static_libs deps that are not imports. They are not supported for export by Bazel.
|
||||
@@ -1330,7 +1330,7 @@ func AndroidLibraryBazelTargetModuleProperties() bazel.BazelTargetModuleProperti
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AndroidLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
commonAttrs, bp2buildInfo, supported := a.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
|
10
java/app.go
10
java/app.go
@@ -1594,11 +1594,11 @@ type bazelAndroidAppCertificateAttributes struct {
|
||||
Certificate string
|
||||
}
|
||||
|
||||
func (m *AndroidAppCertificate) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *AndroidAppCertificate) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
androidAppCertificateBp2Build(ctx, m)
|
||||
}
|
||||
|
||||
func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *AndroidAppCertificate) {
|
||||
func androidAppCertificateBp2Build(ctx android.Bp2buildMutatorContext, module *AndroidAppCertificate) {
|
||||
var certificate string
|
||||
if module.properties.Certificate != nil {
|
||||
certificate = *module.properties.Certificate
|
||||
@@ -1634,7 +1634,7 @@ type bazelAndroidAppAttributes struct {
|
||||
Proguard_specs bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func convertWithBp2build(ctx android.TopDownMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) {
|
||||
func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) {
|
||||
aapt, supported := a.convertAaptAttrsWithBp2Build(ctx)
|
||||
if !supported {
|
||||
return false, android.CommonAttributes{}, &bazelAndroidAppAttributes{}
|
||||
@@ -1745,7 +1745,7 @@ func convertWithBp2build(ctx android.TopDownMutatorContext, a *AndroidApp) (bool
|
||||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||
func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AndroidApp) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ok, commonAttrs, appAttrs := convertWithBp2build(ctx, a); ok {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "android_binary",
|
||||
@@ -1758,7 +1758,7 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_test to Bazel.
|
||||
func (at *AndroidTest) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (at *AndroidTest) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ok, commonAttrs, appAttrs := convertWithBp2build(ctx, &at.AndroidApp); ok {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "android_test",
|
||||
|
@@ -2359,7 +2359,7 @@ type ModuleWithStem interface {
|
||||
|
||||
var _ ModuleWithStem = (*Module)(nil)
|
||||
|
||||
func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (j *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
switch ctx.ModuleType() {
|
||||
case "java_library", "java_library_host", "java_library_static", "tradefed_java_library_host":
|
||||
if lib, ok := ctx.Module().(*Library); ok {
|
||||
|
@@ -198,7 +198,7 @@ type bazelDeviceHostConverterAttributes struct {
|
||||
Exports bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
ctx.CreateBazelTargetModule(
|
||||
bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "java_host_for_device",
|
||||
|
@@ -871,7 +871,7 @@ func (d *ExportedDroiddocDir) GenerateAndroidBuildActions(ctx android.ModuleCont
|
||||
}
|
||||
|
||||
// ConvertWithBp2build implements android.BazelModule.
|
||||
func (d *ExportedDroiddocDir) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (d *ExportedDroiddocDir) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
// Use the native py_library rule.
|
||||
Rule_class: "droiddoc_exported_dir",
|
||||
|
16
java/java.go
16
java/java.go
@@ -2775,7 +2775,7 @@ type javaResourcesAttributes struct {
|
||||
Additional_resources bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (m *Library) getResourceFilegroupStripPrefix(ctx android.TopDownMutatorContext, resourceFilegroup string) (*string, bool) {
|
||||
func (m *Library) getResourceFilegroupStripPrefix(ctx android.Bp2buildMutatorContext, resourceFilegroup string) (*string, bool) {
|
||||
if otherM, ok := ctx.ModuleFromName(resourceFilegroup); ok {
|
||||
if fg, isFilegroup := otherM.(android.FileGroupPath); isFilegroup {
|
||||
return proptools.StringPtr(filepath.Join(ctx.OtherModuleDir(otherM), fg.GetPath(ctx))), true
|
||||
@@ -2784,7 +2784,7 @@ func (m *Library) getResourceFilegroupStripPrefix(ctx android.TopDownMutatorCont
|
||||
return proptools.StringPtr(""), false
|
||||
}
|
||||
|
||||
func (m *Library) convertJavaResourcesAttributes(ctx android.TopDownMutatorContext) *javaResourcesAttributes {
|
||||
func (m *Library) convertJavaResourcesAttributes(ctx android.Bp2buildMutatorContext) *javaResourcesAttributes {
|
||||
var resources bazel.LabelList
|
||||
var resourceStripPrefix *string
|
||||
|
||||
@@ -2915,7 +2915,7 @@ func javaXsdTargetName(xsd android.XsdConfigBp2buildTargets) string {
|
||||
// which has other non-attribute information needed for bp2build conversion
|
||||
// that needs different handling depending on the module types, and thus needs
|
||||
// to be returned to the calling function.
|
||||
func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) (*javaCommonAttributes, *bp2BuildJavaInfo, bool) {
|
||||
func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext) (*javaCommonAttributes, *bp2BuildJavaInfo, bool) {
|
||||
var srcs bazel.LabelListAttribute
|
||||
var deps bazel.LabelListAttribute
|
||||
var staticDeps bazel.LabelListAttribute
|
||||
@@ -3136,7 +3136,7 @@ func javaLibraryBazelTargetModuleProperties() bazel.BazelTargetModuleProperties
|
||||
}
|
||||
}
|
||||
|
||||
func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
|
||||
func javaLibraryBp2Build(ctx android.Bp2buildMutatorContext, m *Library) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
@@ -3192,7 +3192,7 @@ type javaBinaryHostAttributes struct {
|
||||
}
|
||||
|
||||
// JavaBinaryHostBp2Build is for java_binary_host bp2build.
|
||||
func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
|
||||
func javaBinaryHostBp2Build(ctx android.Bp2buildMutatorContext, m *Binary) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
@@ -3279,7 +3279,7 @@ type javaTestHostAttributes struct {
|
||||
}
|
||||
|
||||
// javaTestHostBp2Build is for java_test_host bp2build.
|
||||
func javaTestHostBp2Build(ctx android.TopDownMutatorContext, m *TestHost) {
|
||||
func javaTestHostBp2Build(ctx android.Bp2buildMutatorContext, m *TestHost) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
@@ -3332,7 +3332,7 @@ type libraryCreationInfo struct {
|
||||
|
||||
// helper function that creates java_library target from java_binary_host or java_test_host,
|
||||
// and returns the library target name,
|
||||
func createLibraryTarget(ctx android.TopDownMutatorContext, libInfo libraryCreationInfo) string {
|
||||
func createLibraryTarget(ctx android.Bp2buildMutatorContext, libInfo libraryCreationInfo) string {
|
||||
libName := libInfo.baseName + "_lib"
|
||||
var libProps bazel.BazelTargetModuleProperties
|
||||
if libInfo.hasKotlin {
|
||||
@@ -3355,7 +3355,7 @@ type bazelJavaImportAttributes struct {
|
||||
}
|
||||
|
||||
// java_import bp2Build converter.
|
||||
func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (i *Import) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
var jars bazel.LabelListAttribute
|
||||
archVariantProps := i.GetArchVariantProperties(ctx, &ImportProperties{})
|
||||
for axis, configToProps := range archVariantProps {
|
||||
|
@@ -130,7 +130,7 @@ type bazelPlatformCompatConfigAttributes struct {
|
||||
Src bazel.LabelAttribute
|
||||
}
|
||||
|
||||
func (p *platformCompatConfig) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *platformCompatConfig) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "platform_compat_config",
|
||||
Bzl_load_location: "//build/bazel/rules/java:platform_compat_config.bzl",
|
||||
|
@@ -64,7 +64,7 @@ type pluginAttributes struct {
|
||||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||
func (p *Plugin) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *Plugin) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
pluginName := p.Name()
|
||||
commonAttrs, bp2BuildInfo, supported := p.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
|
@@ -2290,7 +2290,7 @@ type bazelSdkLibraryAttributes struct {
|
||||
}
|
||||
|
||||
// java_sdk_library bp2build converter
|
||||
func (module *SdkLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *SdkLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "java_sdk_library" {
|
||||
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
|
||||
return
|
||||
@@ -2455,7 +2455,7 @@ func sdkLibraryImportFactory() android.Module {
|
||||
}
|
||||
|
||||
// java_sdk_library bp2build converter
|
||||
func (i *SdkLibraryImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (i *SdkLibraryImport) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
nameToAttr := make(map[string]*bazel.Label)
|
||||
|
||||
for scope, props := range i.scopeProperties {
|
||||
|
Reference in New Issue
Block a user