Merge "Cleanup unused code for bp2build conversion."
This commit is contained in:
@@ -522,62 +522,6 @@ type Module interface {
|
|||||||
TransitivePackagingSpecs() []PackagingSpec
|
TransitivePackagingSpecs() []PackagingSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
// BazelTargetModule is a lightweight wrapper interface around Module for
|
|
||||||
// bp2build conversion purposes.
|
|
||||||
//
|
|
||||||
// In bp2build's bootstrap.Main execution, Soong runs an alternate pipeline of
|
|
||||||
// mutators that creates BazelTargetModules from regular Module objects,
|
|
||||||
// performing the mapping from Soong properties to Bazel rule attributes in the
|
|
||||||
// process. This process may optionally create additional BazelTargetModules,
|
|
||||||
// resulting in a 1:many mapping.
|
|
||||||
//
|
|
||||||
// bp2build.Codegen is then responsible for visiting all modules in the graph,
|
|
||||||
// filtering for BazelTargetModules, and code-generating BUILD targets from
|
|
||||||
// them.
|
|
||||||
type BazelTargetModule interface {
|
|
||||||
Module
|
|
||||||
|
|
||||||
bazelTargetModuleProperties() *bazel.BazelTargetModuleProperties
|
|
||||||
SetBazelTargetModuleProperties(props bazel.BazelTargetModuleProperties)
|
|
||||||
|
|
||||||
RuleClass() string
|
|
||||||
BzlLoadLocation() string
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitBazelTargetModule is a wrapper function that decorates BazelTargetModule
|
|
||||||
// with property structs containing metadata for bp2build conversion.
|
|
||||||
func InitBazelTargetModule(module BazelTargetModule) {
|
|
||||||
module.AddProperties(module.bazelTargetModuleProperties())
|
|
||||||
InitAndroidModule(module)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BazelTargetModuleBase contains the property structs with metadata for
|
|
||||||
// bp2build conversion.
|
|
||||||
type BazelTargetModuleBase struct {
|
|
||||||
ModuleBase
|
|
||||||
Properties bazel.BazelTargetModuleProperties
|
|
||||||
}
|
|
||||||
|
|
||||||
// bazelTargetModuleProperties getter.
|
|
||||||
func (btmb *BazelTargetModuleBase) bazelTargetModuleProperties() *bazel.BazelTargetModuleProperties {
|
|
||||||
return &btmb.Properties
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetBazelTargetModuleProperties setter for BazelTargetModuleProperties
|
|
||||||
func (btmb *BazelTargetModuleBase) SetBazelTargetModuleProperties(props bazel.BazelTargetModuleProperties) {
|
|
||||||
btmb.Properties = props
|
|
||||||
}
|
|
||||||
|
|
||||||
// RuleClass returns the rule class for this Bazel target
|
|
||||||
func (b *BazelTargetModuleBase) RuleClass() string {
|
|
||||||
return b.bazelTargetModuleProperties().Rule_class
|
|
||||||
}
|
|
||||||
|
|
||||||
// BzlLoadLocation returns the rule class for this Bazel target
|
|
||||||
func (b *BazelTargetModuleBase) BzlLoadLocation() string {
|
|
||||||
return b.bazelTargetModuleProperties().Bzl_load_location
|
|
||||||
}
|
|
||||||
|
|
||||||
// Qualified id for a module
|
// Qualified id for a module
|
||||||
type qualifiedModuleName struct {
|
type qualifiedModuleName struct {
|
||||||
// The package (i.e. directory) in which the module is defined, without trailing /
|
// The package (i.e. directory) in which the module is defined, without trailing /
|
||||||
|
@@ -252,11 +252,6 @@ type customBazelModuleAttributes struct {
|
|||||||
Arch_paths bazel.LabelListAttribute
|
Arch_paths bazel.LabelListAttribute
|
||||||
}
|
}
|
||||||
|
|
||||||
type customBazelModule struct {
|
|
||||||
android.BazelTargetModuleBase
|
|
||||||
customBazelModuleAttributes
|
|
||||||
}
|
|
||||||
|
|
||||||
func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
|
func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
|
||||||
if m, ok := ctx.Module().(*customModule); ok {
|
if m, ok := ctx.Module().(*customModule); ok {
|
||||||
if !m.ConvertWithBp2build(ctx) {
|
if !m.ConvertWithBp2build(ctx) {
|
||||||
|
@@ -2341,18 +2341,6 @@ type bazelCcLibraryStaticAttributes struct {
|
|||||||
Static staticOrSharedAttributes
|
Static staticOrSharedAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
type bazelCcLibraryStatic struct {
|
|
||||||
android.BazelTargetModuleBase
|
|
||||||
bazelCcLibraryStaticAttributes
|
|
||||||
}
|
|
||||||
|
|
||||||
func BazelCcLibraryStaticFactory() android.Module {
|
|
||||||
module := &bazelCcLibraryStatic{}
|
|
||||||
module.AddProperties(&module.bazelCcLibraryStaticAttributes)
|
|
||||||
android.InitBazelTargetModule(module)
|
|
||||||
return module
|
|
||||||
}
|
|
||||||
|
|
||||||
func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *Module) {
|
func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *Module) {
|
||||||
compilerAttrs := bp2BuildParseCompilerProps(ctx, module)
|
compilerAttrs := bp2BuildParseCompilerProps(ctx, module)
|
||||||
linkerAttrs := bp2BuildParseLinkerProps(ctx, module)
|
linkerAttrs := bp2BuildParseLinkerProps(ctx, module)
|
||||||
@@ -2423,9 +2411,3 @@ func CcLibraryStaticBp2Build(ctx android.TopDownMutatorContext) {
|
|||||||
|
|
||||||
ccLibraryStaticBp2BuildInternal(ctx, module)
|
ccLibraryStaticBp2BuildInternal(ctx, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *bazelCcLibraryStatic) Name() string {
|
|
||||||
return m.BaseModuleName()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *bazelCcLibraryStatic) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
|
||||||
|
Reference in New Issue
Block a user