Merge "Don't create a new module for bp2build conversion."
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
"android/soong/bazel"
|
||||
"android/soong/bazel/cquery"
|
||||
"android/soong/cc/config"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/pathtools"
|
||||
)
|
||||
@@ -256,24 +257,6 @@ type stripAttributes struct {
|
||||
None bazel.BoolAttribute
|
||||
}
|
||||
|
||||
type bazelCcLibrary struct {
|
||||
android.BazelTargetModuleBase
|
||||
bazelCcLibraryAttributes
|
||||
}
|
||||
|
||||
func (m *bazelCcLibrary) Name() string {
|
||||
return m.BaseModuleName()
|
||||
}
|
||||
|
||||
func (m *bazelCcLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
||||
|
||||
func BazelCcLibraryFactory() android.Module {
|
||||
module := &bazelCcLibrary{}
|
||||
module.AddProperties(&module.bazelCcLibraryAttributes)
|
||||
android.InitBazelTargetModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
||||
m, ok := ctx.Module().(*Module)
|
||||
if !ok || !m.ConvertWithBp2build(ctx) {
|
||||
@@ -346,7 +329,7 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
||||
Bzl_load_location: "//build/bazel/rules:full_cc_library.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(BazelCcLibraryFactory, m.Name(), props, attrs)
|
||||
ctx.CreateBazelTargetModule(m.Name(), props, attrs)
|
||||
}
|
||||
|
||||
// cc_library creates both static and/or shared libraries for a device and/or
|
||||
@@ -2414,7 +2397,7 @@ func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *
|
||||
Bzl_load_location: "//build/bazel/rules:cc_library_static.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(BazelCcLibraryStaticFactory, module.Name(), props, attrs)
|
||||
ctx.CreateBazelTargetModule(module.Name(), props, attrs)
|
||||
}
|
||||
|
||||
func CcLibraryStaticBp2Build(ctx android.TopDownMutatorContext) {
|
||||
|
@@ -111,18 +111,6 @@ type bazelCcLibraryHeadersAttributes struct {
|
||||
System_dynamic_deps bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
type bazelCcLibraryHeaders struct {
|
||||
android.BazelTargetModuleBase
|
||||
bazelCcLibraryHeadersAttributes
|
||||
}
|
||||
|
||||
func BazelCcLibraryHeadersFactory() android.Module {
|
||||
module := &bazelCcLibraryHeaders{}
|
||||
module.AddProperties(&module.bazelCcLibraryHeadersAttributes)
|
||||
android.InitBazelTargetModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
func CcLibraryHeadersBp2Build(ctx android.TopDownMutatorContext) {
|
||||
module, ok := ctx.Module().(*Module)
|
||||
if !ok {
|
||||
@@ -155,11 +143,5 @@ func CcLibraryHeadersBp2Build(ctx android.TopDownMutatorContext) {
|
||||
Bzl_load_location: "//build/bazel/rules:cc_library_headers.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(BazelCcLibraryHeadersFactory, module.Name(), props, attrs)
|
||||
ctx.CreateBazelTargetModule(module.Name(), props, attrs)
|
||||
}
|
||||
|
||||
func (m *bazelCcLibraryHeaders) Name() string {
|
||||
return m.BaseModuleName()
|
||||
}
|
||||
|
||||
func (m *bazelCcLibraryHeaders) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
||||
|
20
cc/object.go
20
cc/object.go
@@ -130,24 +130,6 @@ type bazelObjectAttributes struct {
|
||||
Asflags bazel.StringListAttribute
|
||||
}
|
||||
|
||||
type bazelObject struct {
|
||||
android.BazelTargetModuleBase
|
||||
bazelObjectAttributes
|
||||
}
|
||||
|
||||
func (m *bazelObject) Name() string {
|
||||
return m.BaseModuleName()
|
||||
}
|
||||
|
||||
func (m *bazelObject) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
||||
|
||||
func BazelObjectFactory() android.Module {
|
||||
module := &bazelObject{}
|
||||
module.AddProperties(&module.bazelObjectAttributes)
|
||||
android.InitBazelTargetModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
// ObjectBp2Build is the bp2build converter from cc_object modules to the
|
||||
// Bazel equivalent target, plus any necessary include deps for the cc_object.
|
||||
func ObjectBp2Build(ctx android.TopDownMutatorContext) {
|
||||
@@ -200,7 +182,7 @@ func ObjectBp2Build(ctx android.TopDownMutatorContext) {
|
||||
Bzl_load_location: "//build/bazel/rules:cc_object.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(BazelObjectFactory, m.Name(), props, attrs)
|
||||
ctx.CreateBazelTargetModule(m.Name(), props, attrs)
|
||||
}
|
||||
|
||||
func (object *objectLinker) appendLdflags(flags []string) {
|
||||
|
Reference in New Issue
Block a user