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
This commit is contained in:
Chris Parsons
2023-09-22 16:21:53 +00:00
parent 68a3d9b33e
commit 6666d0f6b1
14 changed files with 26 additions and 301 deletions

View File

@@ -24,7 +24,6 @@ import (
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/bazel"
"android/soong/java/config"
"android/soong/remoteexec"
)
@@ -855,34 +854,6 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
}
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