Switch bp2build mutator to bottom up
This should be no-op, as the underlying mutator has not changed yet.
Some other refactoring is required and done in this CL:
- Delete some old, dead ApiBp2build code
- Fix casting to TopDownMutator when it's not necessary
This change is required to prepare for allowlist v2 work, as only
BottomUp mutators can AddDependency.
Bug: 285631638
Test: m nothing
Test: presubmits
Change-Id: I5212a5f5634cc13056195783e6df37ff8eb000da
diff --git a/android/api_domain.go b/android/api_domain.go
index 587ceae..0603c70 100644
--- a/android/api_domain.go
+++ b/android/api_domain.go
@@ -107,24 +107,3 @@
bazelLabels := BazelLabelForModuleDepsWithFn(ctx, contributions, addSuffix)
return bazel.MakeLabelListAttribute(bazelLabels)
}
-
-type bazelApiDomainAttributes struct {
- Cc_api_contributions bazel.LabelListAttribute
- Java_api_contributions bazel.LabelListAttribute
-}
-
-var _ ApiProvider = (*apiDomain)(nil)
-
-func (a *apiDomain) ConvertWithApiBp2build(ctx TopDownMutatorContext) {
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "api_domain",
- Bzl_load_location: "//build/bazel/rules/apis:api_domain.bzl",
- }
- attrs := &bazelApiDomainAttributes{
- Cc_api_contributions: contributionBazelAttributes(ctx, a.properties.Cc_api_contributions),
- Java_api_contributions: contributionBazelAttributes(ctx, a.properties.Java_api_contributions),
- }
- ctx.CreateBazelTargetModule(props, CommonAttributes{
- Name: ctx.ModuleName(),
- }, attrs)
-}
diff --git a/android/bazel.go b/android/bazel.go
index 732419b..4516396 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -600,10 +600,10 @@
}
func registerBp2buildConversionMutator(ctx RegisterMutatorsContext) {
- ctx.TopDown("bp2build_conversion", bp2buildConversionMutator).Parallel()
+ ctx.BottomUp("bp2build_conversion", bp2buildConversionMutator).Parallel()
}
-func bp2buildConversionMutator(ctx TopDownMutatorContext) {
+func bp2buildConversionMutator(ctx BottomUpMutatorContext) {
bModule, ok := ctx.Module().(Bazelable)
if !ok {
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
@@ -647,17 +647,6 @@
}
}
-func registerApiBp2buildConversionMutator(ctx RegisterMutatorsContext) {
- ctx.TopDown("apiBp2build_conversion", convertWithApiBp2build).Parallel()
-}
-
-// Generate API contribution targets if the Soong module provides APIs
-func convertWithApiBp2build(ctx TopDownMutatorContext) {
- if m, ok := ctx.Module().(ApiProvider); ok {
- m.ConvertWithApiBp2build(ctx)
- }
-}
-
// GetMainClassInManifest scans the manifest file specified in filepath and returns
// the value of attribute Main-Class in the manifest file if it exists, or returns error.
// WARNING: this is for bp2build converters of java_* modules only.
diff --git a/android/filegroup.go b/android/filegroup.go
index a4bbcae..5a8c4b9 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -86,12 +86,6 @@
Strip_import_prefix *string
}
-// api srcs can be contained in filegroups.
-// this should be generated in api_bp2build workspace as well.
-func (fg *fileGroup) ConvertWithApiBp2build(ctx TopDownMutatorContext) {
- fg.ConvertWithBp2build(ctx)
-}
-
// ConvertWithBp2build performs bp2build conversion of filegroup
func (fg *fileGroup) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
srcs := bazel.MakeLabelListAttribute(
diff --git a/android/module.go b/android/module.go
index ceb54de..74b8cb8 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1272,7 +1272,7 @@
m.base().commonProperties.CreateCommonOSVariant = true
}
-func (attrs *CommonAttributes) fillCommonBp2BuildModuleAttrs(ctx *topDownMutatorContext,
+func (attrs *CommonAttributes) fillCommonBp2BuildModuleAttrs(ctx *bottomUpMutatorContext,
enabledPropertyOverrides bazel.BoolAttribute) constraintAttributes {
mod := ctx.Module().base()
@@ -1430,7 +1430,7 @@
// If compile_mulitilib is set to
// 1. 32: Add an incompatibility constraint for non-32 arches
// 1. 64: Add an incompatibility constraint for non-64 arches
-func addCompatibilityConstraintForCompileMultilib(ctx *topDownMutatorContext, enabled *bazel.LabelListAttribute) {
+func addCompatibilityConstraintForCompileMultilib(ctx *bottomUpMutatorContext, enabled *bazel.LabelListAttribute) {
mod := ctx.Module().base()
multilib, _ := decodeMultilib(mod, mod.commonProperties.CompileOS, ctx.Config().IgnorePrefer32OnDevice())
@@ -1456,7 +1456,7 @@
// Check product variables for `enabled: true` flag override.
// Returns a list of the constraint_value targets who enable this override.
-func productVariableConfigEnableAttribute(ctx *topDownMutatorContext) bazel.LabelListAttribute {
+func productVariableConfigEnableAttribute(ctx *bottomUpMutatorContext) bazel.LabelListAttribute {
result := bazel.LabelListAttribute{}
productVariableProps, errs := ProductVariableProperties(ctx, ctx.Module())
for _, err := range errs {
diff --git a/android/mutator.go b/android/mutator.go
index 336f8f7..57ff1e0 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -38,13 +38,6 @@
registerMutatorsForBazelConversion(ctx, bp2buildMutators)
}
-// RegisterMutatorsForApiBazelConversion is an alternate registration pipeline for api_bp2build
-// This pipeline restricts generation of Bazel targets to Soong modules that contribute APIs
-func RegisterMutatorsForApiBazelConversion(ctx *Context, preArchMutators []RegisterMutatorFunc) {
- bp2buildMutators := append(preArchMutators, registerApiBp2buildConversionMutator)
- registerMutatorsForBazelConversion(ctx, bp2buildMutators)
-}
-
func registerMutatorsForBazelConversion(ctx *Context, bp2buildMutators []RegisterMutatorFunc) {
mctx := ®isterMutatorsContext{
bazelConversionMode: true,
@@ -284,7 +277,6 @@
type TopDownMutatorContext interface {
BaseMutatorContext
- Bp2buildMutatorContext
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
// the specified property structs to it as if the properties were set in a blueprint file.
@@ -300,6 +292,7 @@
type BottomUpMutatorContext interface {
BaseMutatorContext
+ Bp2buildMutatorContext
// AddDependency adds a dependency to the given module. It returns a slice of modules for each
// dependency (some entries may be nil).
@@ -711,14 +704,14 @@
ctx.BottomUp("deps", depsMutator).Parallel()
}
-func (t *topDownMutatorContext) CreateBazelTargetModule(
+func (t *bottomUpMutatorContext) CreateBazelTargetModule(
bazelProps bazel.BazelTargetModuleProperties,
commonAttrs CommonAttributes,
attrs interface{}) {
t.createBazelTargetModule(bazelProps, commonAttrs, attrs, bazel.BoolAttribute{})
}
-func (t *topDownMutatorContext) CreateBazelTargetModuleWithRestrictions(
+func (t *bottomUpMutatorContext) CreateBazelTargetModuleWithRestrictions(
bazelProps bazel.BazelTargetModuleProperties,
commonAttrs CommonAttributes,
attrs interface{},
@@ -726,7 +719,7 @@
t.createBazelTargetModule(bazelProps, commonAttrs, attrs, enabledProperty)
}
-func (t *topDownMutatorContext) MarkBp2buildUnconvertible(
+func (t *bottomUpMutatorContext) MarkBp2buildUnconvertible(
reasonType bp2build_metrics_proto.UnconvertedReasonType, detail string) {
mod := t.Module()
mod.base().setBp2buildUnconvertible(reasonType, detail)
@@ -742,7 +735,7 @@
Actual *bazel.LabelAttribute
}
-func (t *topDownMutatorContext) CreateBazelTargetAliasInDir(
+func (t *bottomUpMutatorContext) CreateBazelTargetAliasInDir(
dir string,
name string,
actual bazel.Label) {
@@ -763,7 +756,7 @@
// Returns the directory in which the bazel target will be generated
// If ca.Dir is not nil, use that
// Otherwise default to the directory of the soong module
-func dirForBazelTargetGeneration(t *topDownMutatorContext, ca *CommonAttributes) string {
+func dirForBazelTargetGeneration(t *bottomUpMutatorContext, ca *CommonAttributes) string {
dir := t.OtherModuleDir(t.Module())
if ca.Dir != nil {
dir = *ca.Dir
@@ -781,7 +774,7 @@
return dir
}
-func (t *topDownMutatorContext) CreateBazelConfigSetting(
+func (t *bottomUpMutatorContext) CreateBazelConfigSetting(
csa bazel.ConfigSettingAttributes,
ca CommonAttributes,
dir string) {
@@ -867,7 +860,7 @@
return ConvertApexAvailableToTags(noTestApexes)
}
-func (t *topDownMutatorContext) createBazelTargetModule(
+func (t *bottomUpMutatorContext) createBazelTargetModule(
bazelProps bazel.BazelTargetModuleProperties,
commonAttrs CommonAttributes,
attrs interface{},
diff --git a/android/proto.go b/android/proto.go
index fc21d01..c449a87 100644
--- a/android/proto.go
+++ b/android/proto.go
@@ -289,7 +289,7 @@
attrs.Strip_import_prefix = proptools.StringPtr("")
}
- tags := ApexAvailableTagsWithoutTestApexes(ctx.(TopDownMutatorContext), ctx.Module())
+ tags := ApexAvailableTagsWithoutTestApexes(ctx, ctx.Module())
moduleDir := ctx.ModuleDir()
if !canonicalPathFromRoot {
diff --git a/bp2build/testing.go b/bp2build/testing.go
index a810709..dfd4d57 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -571,23 +571,6 @@
)
}
-var _ android.ApiProvider = (*customModule)(nil)
-
-func (c *customModule) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "custom_api_contribution",
- }
- apiAttribute := bazel.MakeLabelAttribute(
- android.BazelLabelForModuleSrcSingle(ctx, proptools.String(c.props.Api)).Label,
- )
- attrs := &customBazelModuleAttributes{
- Api: *apiAttribute,
- }
- ctx.CreateBazelTargetModule(props,
- android.CommonAttributes{Name: c.Name()},
- attrs)
-}
-
// A bp2build mutator that uses load statements and creates a 1:M mapping from
// module to target.
func customBp2buildOneToMany(ctx android.Bp2buildMutatorContext, m *customModule) {
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 569f721..5dc119e 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -223,7 +223,7 @@
}
// bp2BuildParseLibProps returns the attributes for a variant of a cc_library.
-func bp2BuildParseLibProps(ctx android.BazelConversionPathContext, module *Module, isStatic bool) staticOrSharedAttributes {
+func bp2BuildParseLibProps(ctx android.Bp2buildMutatorContext, module *Module, isStatic bool) staticOrSharedAttributes {
lib, ok := module.compiler.(*libraryDecorator)
if !ok {
return staticOrSharedAttributes{}
@@ -232,12 +232,12 @@
}
// bp2buildParseSharedProps returns the attributes for the shared variant of a cc_library.
-func bp2BuildParseSharedProps(ctx android.BazelConversionPathContext, module *Module) staticOrSharedAttributes {
+func bp2BuildParseSharedProps(ctx android.Bp2buildMutatorContext, module *Module) staticOrSharedAttributes {
return bp2BuildParseLibProps(ctx, module, false)
}
// bp2buildParseStaticProps returns the attributes for the static variant of a cc_library.
-func bp2BuildParseStaticProps(ctx android.BazelConversionPathContext, module *Module) staticOrSharedAttributes {
+func bp2BuildParseStaticProps(ctx android.Bp2buildMutatorContext, module *Module) staticOrSharedAttributes {
return bp2BuildParseLibProps(ctx, module, true)
}
@@ -288,7 +288,7 @@
}
// Parses properties common to static and shared libraries. Also used for prebuilt libraries.
-func bp2buildParseStaticOrSharedProps(ctx android.BazelConversionPathContext, module *Module, lib *libraryDecorator, isStatic bool) staticOrSharedAttributes {
+func bp2buildParseStaticOrSharedProps(ctx android.Bp2buildMutatorContext, module *Module, lib *libraryDecorator, isStatic bool) staticOrSharedAttributes {
attrs := staticOrSharedAttributes{}
setAttrs := func(axis bazel.ConfigurationAxis, config string, props StaticOrSharedProperties) {
@@ -334,7 +334,7 @@
attrs.Srcs_c = partitionedSrcs[cSrcPartition]
attrs.Srcs_as = partitionedSrcs[asSrcPartition]
- attrs.Apex_available = android.ConvertApexAvailableToTagsWithoutTestApexes(ctx.(android.TopDownMutatorContext), apexAvailable)
+ attrs.Apex_available = android.ConvertApexAvailableToTagsWithoutTestApexes(ctx, apexAvailable)
attrs.Features.Append(convertHiddenVisibilityToFeatureStaticOrShared(ctx, module, isStatic))
@@ -1143,7 +1143,7 @@
compilerAttrs compilerAttributes,
) *bazel.LabelAttribute {
var aidlLibsFromSrcs, aidlFiles bazel.LabelListAttribute
- apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.TopDownMutatorContext), ctx.Module())
+ apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx, ctx.Module())
if !aidlSrcs.IsEmpty() {
aidlLibsFromSrcs, aidlFiles = aidlSrcs.Partition(func(src bazel.Label) bool {
@@ -1283,7 +1283,7 @@
la.implementationDeps.Append(staticExcludesLabelList)
}
-func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversionPathContext, module *Module, axis bazel.ConfigurationAxis, config string, props *BaseLinkerProperties) {
+func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.Bp2buildMutatorContext, module *Module, axis bazel.ConfigurationAxis, config string, props *BaseLinkerProperties) {
isBinary := module.Binary()
// Use a single variable to capture usage of nocrt in arch variants, so there's only 1 error message for this module
var axisFeatures []string
@@ -1490,7 +1490,7 @@
// Note that this is an anti-pattern: The config_setting should be created from the apex definition
// and not from a cc_library.
// This anti-pattern is needed today since not all apexes have been allowlisted.
-func createInApexConfigSetting(ctx android.TopDownMutatorContext, apexName string) {
+func createInApexConfigSetting(ctx android.Bp2buildMutatorContext, apexName string) {
if apexName == android.AvailableToPlatform || apexName == android.AvailableToAnyApex {
// These correspond to android-non_apex and android-in_apex
return
@@ -1587,13 +1587,13 @@
return exists && ctx.OtherModuleType(mod) == "ndk_library"
}
-func SetStubsForDynamicDeps(ctx android.BazelConversionPathContext, axis bazel.ConfigurationAxis,
+func SetStubsForDynamicDeps(ctx android.Bp2buildMutatorContext, axis bazel.ConfigurationAxis,
config string, apexAvailable []string, dynamicLibs bazel.LabelList, dynamicDeps *bazel.LabelListAttribute, ind int, buildNonApexWithStubs bool) {
// Create a config_setting for each apex_available.
// This will be used to select impl of a dep if dep is available to the same apex.
for _, aa := range apexAvailable {
- createInApexConfigSetting(ctx.(android.TopDownMutatorContext), aa)
+ createInApexConfigSetting(ctx, aa)
}
apiDomainForSelects := []string{}
diff --git a/cc/cc.go b/cc/cc.go
index 81a6cd6..1896766 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -4273,24 +4273,6 @@
}
}
-var _ android.ApiProvider = (*Module)(nil)
-
-func (c *Module) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
- if c.IsPrebuilt() {
- return
- }
- switch c.typ() {
- case fullLibrary:
- apiContributionBp2Build(ctx, c)
- case sharedLibrary:
- apiContributionBp2Build(ctx, c)
- case headerLibrary:
- // Aggressively generate api targets for all header modules
- // This is necessary since the header module does not know if it is a dep of API surface stub library
- apiLibraryHeadersBp2Build(ctx, c)
- }
-}
-
// Defaults
type Defaults struct {
android.ModuleBase
diff --git a/cc/library.go b/cc/library.go
index b9dc71b..e66ce08 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -517,70 +517,6 @@
}
}
-func apiContributionBp2Build(ctx android.TopDownMutatorContext, module *Module) {
- apiSurfaces := make([]string, 0)
- apiHeaders := make([]string, 0)
- // module-libapi for apexes (non-null `stubs` property)
- if module.HasStubsVariants() {
- apiSurfaces = append(apiSurfaces, android.ModuleLibApi.String())
- apiIncludes := getModuleLibApiIncludes(ctx, module)
- if !apiIncludes.isEmpty() {
- createApiHeaderTarget(ctx, apiIncludes)
- apiHeaders = append(apiHeaders, apiIncludes.name)
- }
- }
- // vendorapi (non-null `llndk` property)
- if module.HasLlndkStubs() {
- apiSurfaces = append(apiSurfaces, android.VendorApi.String())
- apiIncludes := getVendorApiIncludes(ctx, module)
- if !apiIncludes.isEmpty() {
- createApiHeaderTarget(ctx, apiIncludes)
- apiHeaders = append(apiHeaders, apiIncludes.name)
- }
- }
- // create a target only if this module contributes to an api surface
- // TODO: Currently this does not distinguish modulelibapi-only headers and vendrorapi-only headers
- // TODO: Update so that modulelibapi-only headers do not get exported to vendorapi (and vice-versa)
- if len(apiSurfaces) > 0 {
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "cc_api_contribution",
- Bzl_load_location: "//build/bazel/rules/apis:cc_api_contribution.bzl",
- }
- attrs := &bazelCcApiContributionAttributes{
- Library_name: module.Name(),
- Api_surfaces: bazel.MakeStringListAttribute(apiSurfaces),
- Api: apiLabelAttribute(ctx, module),
- Hdrs: bazel.MakeLabelListAttribute(
- bazel.MakeLabelListFromTargetNames(apiHeaders),
- ),
- }
- ctx.CreateBazelTargetModule(
- props,
- android.CommonAttributes{
- Name: android.ApiContributionTargetName(module.Name()),
- SkipData: proptools.BoolPtr(true),
- },
- attrs,
- )
- }
-}
-
-// Native apis are versioned in a single .map.txt for all api surfaces
-// Pick any one of the .map.txt files
-func apiLabelAttribute(ctx android.TopDownMutatorContext, module *Module) bazel.LabelAttribute {
- var apiFile *string
- linker := module.linker.(*libraryDecorator)
- if llndkApi := linker.Properties.Llndk.Symbol_file; llndkApi != nil {
- apiFile = llndkApi
- } else if moduleLibApi := linker.Properties.Stubs.Symbol_file; moduleLibApi != nil {
- apiFile = moduleLibApi
- } else {
- ctx.ModuleErrorf("API surface library does not have any API file")
- }
- apiLabel := android.BazelLabelForModuleSrcSingle(ctx, proptools.String(apiFile)).Label
- return *bazel.MakeLabelAttribute(apiLabel)
-}
-
// wrapper struct to flatten the arch and os specific export_include_dirs
// flattening is necessary since we want to export apis of all arches even when we build for x86 (e.g.)
type bazelCcApiLibraryHeadersAttributes struct {
diff --git a/cc/library_headers.go b/cc/library_headers.go
index 5eba6ab..fccdf99 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -15,8 +15,6 @@
package cc
import (
- "github.com/google/blueprint/proptools"
-
"android/soong/android"
"android/soong/bazel"
"android/soong/bazel/cquery"
@@ -175,106 +173,6 @@
return bazel.MakeLabelList(labels)
}
-func apiLibraryHeadersBp2Build(ctx android.TopDownMutatorContext, module *Module) {
- // cc_api_library_headers have a 1:1 mapping to arch/no-arch
- // For API export, create a top-level arch-agnostic target and list the arch-specific targets as its deps
-
- // arch-agnostic includes
- apiIncludes := getModuleLibApiIncludes(ctx, module)
- // arch and os specific includes
- archApiIncludes, androidOsIncludes := archOsSpecificApiIncludes(ctx, module)
- for _, arch := range allArches { // sorted iteration
- archApiInclude := archApiIncludes[arch]
- if !archApiInclude.isEmpty() {
- createApiHeaderTarget(ctx, archApiInclude)
- apiIncludes.addDep(archApiInclude.name)
- }
- }
- // os==android includes
- if !androidOsIncludes.isEmpty() {
- createApiHeaderTarget(ctx, androidOsIncludes)
- apiIncludes.addDep(androidOsIncludes.name)
- }
-
- if !apiIncludes.isEmpty() {
- // override the name from <mod>.module-libapi.headers --> <mod>.contribution
- apiIncludes.name = android.ApiContributionTargetName(module.Name())
- createApiHeaderTarget(ctx, apiIncludes)
- }
-}
-
-func createApiHeaderTarget(ctx android.TopDownMutatorContext, includes apiIncludes) {
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "cc_api_library_headers",
- Bzl_load_location: "//build/bazel/rules/apis:cc_api_contribution.bzl",
- }
- ctx.CreateBazelTargetModule(
- props,
- android.CommonAttributes{
- Name: includes.name,
- SkipData: proptools.BoolPtr(true),
- },
- &includes.attrs,
- )
-}
-
var (
allArches = []string{"arm", "arm64", "x86", "x86_64"}
)
-
-type archApiIncludes map[string]apiIncludes
-
-func archOsSpecificApiIncludes(ctx android.TopDownMutatorContext, module *Module) (archApiIncludes, apiIncludes) {
- baseProps := bp2BuildParseBaseProps(ctx, module)
- i := bp2BuildParseExportedIncludes(ctx, module, &baseProps.includes)
- archRet := archApiIncludes{}
- for _, arch := range allArches {
- includes := i.Includes.SelectValue(
- bazel.ArchConfigurationAxis,
- arch)
- systemIncludes := i.SystemIncludes.SelectValue(
- bazel.ArchConfigurationAxis,
- arch)
- deps := baseProps.deps.SelectValue(
- bazel.ArchConfigurationAxis,
- arch)
- attrs := bazelCcLibraryHeadersAttributes{
- Export_includes: bazel.MakeStringListAttribute(includes),
- Export_system_includes: bazel.MakeStringListAttribute(systemIncludes),
- }
- apiDeps := apiBazelTargets(deps)
- if !apiDeps.IsEmpty() {
- attrs.Deps = bazel.MakeLabelListAttribute(apiDeps)
- }
- apiIncludes := apiIncludes{
- name: android.ApiContributionTargetName(module.Name()) + "." + arch,
- attrs: bazelCcApiLibraryHeadersAttributes{
- bazelCcLibraryHeadersAttributes: attrs,
- Arch: proptools.StringPtr(arch),
- },
- }
- archRet[arch] = apiIncludes
- }
-
- // apiIncludes for os == Android
- androidOsDeps := baseProps.deps.SelectValue(bazel.OsConfigurationAxis, bazel.OsAndroid)
- androidOsAttrs := bazelCcLibraryHeadersAttributes{
- Export_includes: bazel.MakeStringListAttribute(
- i.Includes.SelectValue(bazel.OsConfigurationAxis, bazel.OsAndroid),
- ),
- Export_system_includes: bazel.MakeStringListAttribute(
- i.SystemIncludes.SelectValue(bazel.OsConfigurationAxis, bazel.OsAndroid),
- ),
- }
- androidOsApiDeps := apiBazelTargets(androidOsDeps)
- if !androidOsApiDeps.IsEmpty() {
- androidOsAttrs.Deps = bazel.MakeLabelListAttribute(androidOsApiDeps)
- }
- osRet := apiIncludes{
- name: android.ApiContributionTargetName(module.Name()) + ".androidos",
- attrs: bazelCcApiLibraryHeadersAttributes{
- bazelCcLibraryHeadersAttributes: androidOsAttrs,
- },
- }
- return archRet, osRet
-}
diff --git a/cc/proto.go b/cc/proto.go
index 0ed4381..4e08a4c 100644
--- a/cc/proto.go
+++ b/cc/proto.go
@@ -246,7 +246,7 @@
protoAttrs.Min_sdk_version = m.Properties.Min_sdk_version
name := m.Name() + suffix
- tags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.TopDownMutatorContext), m)
+ tags := android.ApexAvailableTagsWithoutTestApexes(ctx, m)
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: rule_class,
diff --git a/cc/sysprop.go b/cc/sysprop.go
index 7ddd476..be03004 100644
--- a/cc/sysprop.go
+++ b/cc/sysprop.go
@@ -38,7 +38,7 @@
}
func Bp2buildSysprop(ctx android.Bp2buildMutatorContext, labels SyspropLibraryLabels, srcs bazel.LabelListAttribute, minSdkVersion *string) {
- apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.TopDownMutatorContext), ctx.Module())
+ apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx, ctx.Module())
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "sysprop_library",
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 1d5dd76..67a55bd 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -24,7 +24,6 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
- "android/soong/bazel"
"android/soong/java/config"
"android/soong/remoteexec"
)
@@ -855,34 +854,6 @@
}
}
-var _ android.ApiProvider = (*Droidstubs)(nil)
-
-type bazelJavaApiContributionAttributes struct {
- Api bazel.LabelAttribute
- Api_surface *string
-}
-
-func (d *Droidstubs) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "java_api_contribution",
- Bzl_load_location: "//build/bazel/rules/apis:java_api_contribution.bzl",
- }
- apiFile := d.properties.Check_api.Current.Api_file
- // Do not generate a target if check_api is not set
- if apiFile == nil {
- return
- }
- attrs := &bazelJavaApiContributionAttributes{
- Api: *bazel.MakeLabelAttribute(
- android.BazelLabelForModuleSrcSingle(ctx, proptools.String(apiFile)).Label,
- ),
- Api_surface: proptools.StringPtr(bazelApiSurfaceName(d.Name())),
- }
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{
- Name: android.ApiContributionTargetName(ctx.ModuleName()),
- }, attrs)
-}
-
func (d *Droidstubs) createApiContribution(ctx android.DefaultableHookContext) {
api_file := d.properties.Check_api.Current.Api_file
api_surface := d.properties.Api_surface