Merge "Remove dylibs prop from rust module types" into main

This commit is contained in:
Vinh Tran
2023-08-15 13:45:10 +00:00
committed by Gerrit Code Review
5 changed files with 5 additions and 18 deletions

View File

@@ -390,7 +390,7 @@ func TestBasicApex(t *testing.T) {
name: "foo.rust",
srcs: ["foo.rs"],
rlibs: ["libfoo.rlib.rust"],
dylibs: ["libfoo.dylib.rust"],
rustlibs: ["libfoo.dylib.rust"],
apex_available: ["myapex"],
}

View File

@@ -294,7 +294,7 @@ func (b *bindgenDecorator) SourceProviderProps() []interface{} {
// rust_bindgen generates Rust FFI bindings to C libraries using bindgen given a wrapper header as the primary input.
// Bindgen has a number of flags to control the generated source, and additional flags can be passed to clang to ensure
// the header and generated source is appropriately handled. It is recommended to add it as a dependency in the
// rlibs, dylibs or rustlibs property. It may also be added in the srcs property for external crates, using the ":"
// rlibs or rustlibs property. It may also be added in the srcs property for external crates, using the ":"
// prefix.
func RustBindgenFactory() android.Module {
module, _ := NewRustBindgen(android.HostAndDeviceSupported)

View File

@@ -91,10 +91,8 @@ type BaseCompilerProperties struct {
// list of rust rlib crate dependencies
Rlibs []string `android:"arch_variant"`
// list of rust dylib crate dependencies
Dylibs []string `android:"arch_variant"`
// list of rust automatic crate dependencies
// list of rust automatic crate dependencies.
// Rustlibs linkage is rlib for host targets and dylib for device targets.
Rustlibs []string `android:"arch_variant"`
// list of rust proc_macro crate dependencies
@@ -359,7 +357,6 @@ func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath {
func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
deps.Rlibs = append(deps.Rlibs, compiler.Properties.Rlibs...)
deps.Dylibs = append(deps.Dylibs, compiler.Properties.Dylibs...)
deps.Rustlibs = append(deps.Rustlibs, compiler.Properties.Rustlibs...)
deps.ProcMacros = append(deps.ProcMacros, compiler.Properties.Proc_macros...)
deps.StaticLibs = append(deps.StaticLibs, compiler.Properties.Static_libs...)

View File

@@ -243,7 +243,7 @@ func (proto *protobufDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) D
// rust_protobuf generates protobuf rust code from the provided proto file. This uses the protoc-gen-rust plugin for
// protoc. Additional flags to the protoc command can be passed via the proto_flags property. This module type will
// create library variants that can be used as a crate dependency by adding it to the rlibs, dylibs, and rustlibs
// create library variants that can be used as a crate dependency by adding it to the rlibs and rustlibs
// properties of other modules.
func RustProtobufFactory() android.Module {
module, _ := NewRustProtobuf(android.HostAndDeviceSupported)

View File

@@ -232,11 +232,6 @@ func TestDepsTracking(t *testing.T) {
srcs: ["foo.rs"],
crate_name: "shared",
}
rust_library_host_dylib {
name: "libdylib",
srcs: ["foo.rs"],
crate_name: "dylib",
}
rust_library_host_rlib {
name: "librlib",
srcs: ["foo.rs"],
@@ -252,7 +247,6 @@ func TestDepsTracking(t *testing.T) {
}
rust_binary_host {
name: "fizz-buzz",
dylibs: ["libdylib"],
rlibs: ["librlib"],
proc_macros: ["libpm"],
static_libs: ["libstatic"],
@@ -265,10 +259,6 @@ func TestDepsTracking(t *testing.T) {
rustLink := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustLink")
// Since dependencies are added to AndroidMk* properties, we can check these to see if they've been picked up.
if !android.InList("libdylib", module.Properties.AndroidMkDylibs) {
t.Errorf("Dylib dependency not detected (dependency missing from AndroidMkDylibs)")
}
if !android.InList("librlib.rlib-std", module.Properties.AndroidMkRlibs) {
t.Errorf("Rlib dependency not detected (dependency missing from AndroidMkRlibs)")
}