diff options
author | 2023-12-07 13:10:56 -0800 | |
---|---|---|
committer | 2023-12-08 13:51:05 -0800 | |
commit | 8ff105860d20f2ccbb8d8044bf562f94100b7f6a (patch) | |
tree | b01575cd628eb36807b7ca274de28fd6a1971e17 /rust/binary.go | |
parent | e51c6e4109e8063e54cf7d8ced1b7da7f9359c34 (diff) |
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
Diffstat (limited to 'rust/binary.go')
-rw-r--r-- | rust/binary.go | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/rust/binary.go b/rust/binary.go index 5e7e922cf..996951366 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -15,10 +15,7 @@ package rust import ( - "fmt" - "android/soong/android" - "android/soong/bazel" ) func init() { @@ -63,8 +60,6 @@ func RustBinaryHostFactory() android.Module { func NewRustBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) { module := newModule(hod, android.MultilibFirst) - android.InitBazelModule(module) - binary := &binaryDecorator{ baseCompiler: NewBaseCompiler("bin", "", InstallInSystem), } @@ -185,88 +180,3 @@ func (binary *binaryDecorator) staticallyLinked() bool { func (binary *binaryDecorator) testBinary() bool { return false } - -type rustBinaryLibraryAttributes struct { - Srcs bazel.LabelListAttribute - Compile_data bazel.LabelListAttribute - Crate_name bazel.StringAttribute - Edition bazel.StringAttribute - Crate_features bazel.StringListAttribute - Deps bazel.LabelListAttribute - Proc_macro_deps bazel.LabelListAttribute - Rustc_flags bazel.StringListAttribute -} - -func binaryBp2build(ctx android.Bp2buildMutatorContext, m *Module) { - binary := m.compiler.(*binaryDecorator) - - var srcs bazel.LabelList - var compileData bazel.LabelList - - if binary.baseCompiler.Properties.Srcs[0] == "src/main.rs" { - srcs = android.BazelLabelForModuleSrc(ctx, []string{"src/**/*.rs"}) - compileData = android.BazelLabelForModuleSrc( - ctx, - []string{ - "src/**/*.proto", - "examples/**/*.rs", - "**/*.md", - "templates/**/*.template", - }, - ) - } else { - srcs = android.BazelLabelForModuleSrc(ctx, binary.baseCompiler.Properties.Srcs) - } - - deps := android.BazelLabelForModuleDeps(ctx, append( - binary.baseCompiler.Properties.Rustlibs, - )) - - procMacroDeps := android.BazelLabelForModuleDeps(ctx, binary.baseCompiler.Properties.Proc_macros) - - var rustcFLags []string - for _, cfg := range binary.baseCompiler.Properties.Cfgs { - rustcFLags = append(rustcFLags, fmt.Sprintf("--cfg=%s", cfg)) - } - - attrs := &rustBinaryLibraryAttributes{ - Srcs: bazel.MakeLabelListAttribute( - srcs, - ), - Compile_data: bazel.MakeLabelListAttribute( - compileData, - ), - Crate_name: bazel.StringAttribute{ - Value: &binary.baseCompiler.Properties.Crate_name, - }, - Edition: bazel.StringAttribute{ - Value: binary.baseCompiler.Properties.Edition, - }, - Crate_features: bazel.StringListAttribute{ - Value: binary.baseCompiler.Properties.Features, - }, - Deps: bazel.MakeLabelListAttribute( - deps, - ), - Proc_macro_deps: bazel.MakeLabelListAttribute( - procMacroDeps, - ), - Rustc_flags: bazel.StringListAttribute{ - Value: append( - rustcFLags, - binary.baseCompiler.Properties.Flags..., - ), - }, - } - - ctx.CreateBazelTargetModule( - bazel.BazelTargetModuleProperties{ - Rule_class: "rust_binary", - Bzl_load_location: "@rules_rust//rust:defs.bzl", - }, - android.CommonAttributes{ - Name: m.Name(), - }, - attrs, - ) -} |