Remove bp2build from frameworks/base/api/
Bug: 315353489
Test: m blueprint_tests
Change-Id: I50d938017203ad12198d8a6373c9aef80a8535c6
diff --git a/api/api.go b/api/api.go
index 71b1e10..2668999 100644
--- a/api/api.go
+++ b/api/api.go
@@ -22,7 +22,6 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
- "android/soong/bazel"
"android/soong/genrule"
"android/soong/java"
)
@@ -65,7 +64,6 @@
type CombinedApis struct {
android.ModuleBase
- android.BazelModuleBase
properties CombinedApisProperties
}
@@ -115,20 +113,6 @@
Previous_api *string
}
-type Bazel_module struct {
- Label *string
- Bp2build_available *bool
-}
-type bazelProperties struct {
- *Bazel_module
-}
-
-var bp2buildNotAvailable = bazelProperties{
- &Bazel_module{
- Bp2build_available: proptools.BoolPtr(false),
- },
-}
-
// Struct to pass parameters for the various merged [current|removed].txt file modules we create.
type MergedTxtDefinition struct {
// "current.txt" or "removed.txt"
@@ -143,8 +127,6 @@
ModuleTag string
// public, system, module-lib or system-server
Scope string
- // True if there is a bp2build definition for this module
- Bp2buildDefined bool
}
func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
@@ -178,20 +160,7 @@
},
}
props.Visibility = []string{"//visibility:public"}
- bazelProps := bazelProperties{
- &Bazel_module{
- Bp2build_available: proptools.BoolPtr(false),
- },
- }
- if txt.Bp2buildDefined {
- moduleDir := ctx.ModuleDir()
- if moduleDir == android.Bp2BuildTopLevel {
- moduleDir = ""
- }
- label := fmt.Sprintf("//%s:%s", moduleDir, moduleName)
- bazelProps.Label = &label
- }
- ctx.CreateModule(genrule.GenRuleFactory, &props, &bazelProps)
+ ctx.CreateModule(genrule.GenRuleFactory, &props)
}
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) {
@@ -221,7 +190,7 @@
props := fgProps{}
props.Name = proptools.StringPtr(i.name)
props.Srcs = createSrcs(i.modules, i.tag)
- ctx.CreateModule(android.FileGroupFactory, &props, &bp2buildNotAvailable)
+ ctx.CreateModule(android.FileGroupFactory, &props)
}
}
@@ -315,7 +284,7 @@
props.Name = proptools.StringPtr("all-modules-public-stubs-source")
props.Srcs = createSrcs(modules, "{.public.stubs.source}")
props.Visibility = []string{"//frameworks/base"}
- ctx.CreateModule(android.FileGroupFactory, &props, &bp2buildNotAvailable)
+ ctx.CreateModule(android.FileGroupFactory, &props)
}
func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) {
@@ -323,43 +292,38 @@
tagSuffix := []string{".api.txt}", ".removed-api.txt}"}
distFilename := []string{"android.txt", "android-removed.txt"}
- bp2BuildDefined := []bool{true, false}
for i, f := range []string{"current.txt", "removed.txt"} {
textFiles = append(textFiles, MergedTxtDefinition{
- TxtFilename: f,
- DistFilename: distFilename[i],
- BaseTxt: ":non-updatable-" + f,
- Modules: bootclasspath,
- ModuleTag: "{.public" + tagSuffix[i],
- Scope: "public",
- Bp2buildDefined: bp2BuildDefined[i],
+ TxtFilename: f,
+ DistFilename: distFilename[i],
+ BaseTxt: ":non-updatable-" + f,
+ Modules: bootclasspath,
+ ModuleTag: "{.public" + tagSuffix[i],
+ Scope: "public",
})
textFiles = append(textFiles, MergedTxtDefinition{
- TxtFilename: f,
- DistFilename: distFilename[i],
- BaseTxt: ":non-updatable-system-" + f,
- Modules: bootclasspath,
- ModuleTag: "{.system" + tagSuffix[i],
- Scope: "system",
- Bp2buildDefined: bp2BuildDefined[i],
+ TxtFilename: f,
+ DistFilename: distFilename[i],
+ BaseTxt: ":non-updatable-system-" + f,
+ Modules: bootclasspath,
+ ModuleTag: "{.system" + tagSuffix[i],
+ Scope: "system",
})
textFiles = append(textFiles, MergedTxtDefinition{
- TxtFilename: f,
- DistFilename: distFilename[i],
- BaseTxt: ":non-updatable-module-lib-" + f,
- Modules: bootclasspath,
- ModuleTag: "{.module-lib" + tagSuffix[i],
- Scope: "module-lib",
- Bp2buildDefined: bp2BuildDefined[i],
+ TxtFilename: f,
+ DistFilename: distFilename[i],
+ BaseTxt: ":non-updatable-module-lib-" + f,
+ Modules: bootclasspath,
+ ModuleTag: "{.module-lib" + tagSuffix[i],
+ Scope: "module-lib",
})
textFiles = append(textFiles, MergedTxtDefinition{
- TxtFilename: f,
- DistFilename: distFilename[i],
- BaseTxt: ":non-updatable-system-server-" + f,
- Modules: system_server_classpath,
- ModuleTag: "{.system-server" + tagSuffix[i],
- Scope: "system-server",
- Bp2buildDefined: bp2BuildDefined[i],
+ TxtFilename: f,
+ DistFilename: distFilename[i],
+ BaseTxt: ":non-updatable-system-server-" + f,
+ Modules: system_server_classpath,
+ ModuleTag: "{.system-server" + tagSuffix[i],
+ Scope: "system-server",
})
}
for _, txt := range textFiles {
@@ -446,55 +410,9 @@
module.AddProperties(&module.properties)
android.InitAndroidModule(module)
android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) })
- android.InitBazelModule(module)
return module
}
-type bazelCombinedApisAttributes struct {
- Scope bazel.StringAttribute
- Base bazel.LabelAttribute
- Deps bazel.LabelListAttribute
-}
-
-// combined_apis bp2build converter
-func (a *CombinedApis) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
- basePrefix := "non-updatable"
- scopeToSuffix := map[string]string{
- "public": "-current.txt",
- "system": "-system-current.txt",
- "module-lib": "-module-lib-current.txt",
- "system-server": "-system-server-current.txt",
- }
-
- for scopeName, suffix := range scopeToSuffix {
- name := a.Name() + suffix
-
- var scope bazel.StringAttribute
- scope.SetValue(scopeName)
-
- var base bazel.LabelAttribute
- base.SetValue(android.BazelLabelForModuleDepSingle(ctx, basePrefix+suffix))
-
- var deps bazel.LabelListAttribute
- classpath := a.properties.Bootclasspath
- if scopeName == "system-server" {
- classpath = a.properties.System_server_classpath
- }
- deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, classpath))
-
- attrs := bazelCombinedApisAttributes{
- Scope: scope,
- Base: base,
- Deps: deps,
- }
- props := bazel.BazelTargetModuleProperties{
- Rule_class: "merged_txts",
- Bzl_load_location: "//build/bazel/rules/java:merged_txts.bzl",
- }
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, &attrs)
- }
-}
-
// Various utility methods below.
// Creates an array of ":<m><tag>" for each m in <modules>.