Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module types, along with the related code. Bug: 315353489 Test: m blueprint_tests Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
This commit is contained in:
66
bpf/bpf.go
66
bpf/bpf.go
@@ -22,8 +22,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/bazel/cquery"
|
||||
"android/soong/cc"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -98,7 +96,6 @@ type BpfProperties struct {
|
||||
|
||||
type bpf struct {
|
||||
android.ModuleBase
|
||||
android.BazelModuleBase
|
||||
|
||||
properties BpfProperties
|
||||
|
||||
@@ -245,35 +242,6 @@ func (bpf *bpf) AndroidMk() android.AndroidMkData {
|
||||
}
|
||||
}
|
||||
|
||||
var _ android.MixedBuildBuildable = (*bpf)(nil)
|
||||
|
||||
func (bpf *bpf) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (bpf *bpf) QueueBazelCall(ctx android.BaseModuleContext) {
|
||||
bazelCtx := ctx.Config().BazelContext
|
||||
bazelCtx.QueueBazelRequest(
|
||||
bpf.GetBazelLabel(ctx, bpf),
|
||||
cquery.GetOutputFiles,
|
||||
android.GetConfigKey(ctx))
|
||||
}
|
||||
|
||||
func (bpf *bpf) ProcessBazelQueryResponse(ctx android.ModuleContext) {
|
||||
bazelCtx := ctx.Config().BazelContext
|
||||
objPaths, err := bazelCtx.GetOutputFiles(bpf.GetBazelLabel(ctx, bpf), android.GetConfigKey(ctx))
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
bazelOuts := android.Paths{}
|
||||
for _, p := range objPaths {
|
||||
bazelOuts = append(bazelOuts, android.PathForBazelOut(ctx, p))
|
||||
}
|
||||
bpf.objs = bazelOuts
|
||||
}
|
||||
|
||||
// Implements OutputFileFileProducer interface so that the obj output can be used in the data property
|
||||
// of other modules.
|
||||
func (bpf *bpf) OutputFiles(tag string) (android.Paths, error) {
|
||||
@@ -297,39 +265,5 @@ func BpfFactory() android.Module {
|
||||
module.AddProperties(&module.properties)
|
||||
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitBazelModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
type bazelBpfAttributes struct {
|
||||
Srcs bazel.LabelListAttribute
|
||||
Copts bazel.StringListAttribute
|
||||
Absolute_includes bazel.StringListAttribute
|
||||
Btf *bool
|
||||
// TODO(b/249528391): Add support for sub_dir
|
||||
}
|
||||
|
||||
// bpf bp2build converter
|
||||
func (b *bpf) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "bpf" {
|
||||
return
|
||||
}
|
||||
|
||||
srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, b.properties.Srcs))
|
||||
copts := bazel.MakeStringListAttribute(b.properties.Cflags)
|
||||
absolute_includes := bazel.MakeStringListAttribute(b.properties.Include_dirs)
|
||||
btf := b.properties.Btf
|
||||
|
||||
attrs := bazelBpfAttributes{
|
||||
Srcs: srcs,
|
||||
Copts: copts,
|
||||
Absolute_includes: absolute_includes,
|
||||
Btf: btf,
|
||||
}
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "bpf",
|
||||
Bzl_load_location: "//build/bazel/rules/bpf:bpf.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: b.Name()}, &attrs)
|
||||
}
|
||||
|
@@ -71,26 +71,3 @@ func TestBpfSourceName(t *testing.T) {
|
||||
`\QAndroid.bp:2:3: module "bpf_invalid_name.o" variant "android_common": invalid character '_' in source name\E`)).
|
||||
RunTestWithBp(t, bp)
|
||||
}
|
||||
|
||||
func TestBpfWithBazel(t *testing.T) {
|
||||
bp := `
|
||||
bpf {
|
||||
name: "bpf.o",
|
||||
srcs: ["bpf.c"],
|
||||
bazel_module: { label: "//bpf" },
|
||||
}
|
||||
`
|
||||
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForBpfTest, android.FixtureModifyConfig(func(config android.Config) {
|
||||
config.BazelContext = android.MockBazelContext{
|
||||
OutputBaseDir: "outputbase",
|
||||
LabelToOutputFiles: map[string][]string{
|
||||
"//bpf": []string{"bpf.o"}}}
|
||||
})).RunTestWithBp(t, bp)
|
||||
|
||||
output := result.Module("bpf.o", "android_common").(*bpf)
|
||||
|
||||
expectedOutputFiles := []string{"outputbase/execroot/__main__/bpf.o"}
|
||||
android.AssertDeepEquals(t, "output files", expectedOutputFiles, output.objs.Strings())
|
||||
}
|
||||
|
Reference in New Issue
Block a user