rust: Add data_libs and data_bins to rust_test
Allows defining data binaries and libraries that should be installed alongside a rust_test module, similar to cc_test. This refactors cc_test as well so it can define rust_ffi_shared and rust_binary modules as data. Bug: 171710847 Test: New Soong tests pass. Test: Example module installs data appropriately. Change-Id: I0b56098fb475ec54f9b7a761220d260fe68cbee1
This commit is contained in:
25
cc/test.go
25
cc/test.go
@@ -378,31 +378,26 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
||||
|
||||
ctx.VisitDirectDepsWithTag(dataLibDepTag, func(dep android.Module) {
|
||||
depName := ctx.OtherModuleName(dep)
|
||||
ccDep, ok := dep.(LinkableInterface)
|
||||
|
||||
linkableDep, ok := dep.(LinkableInterface)
|
||||
if !ok {
|
||||
ctx.ModuleErrorf("data_lib %q is not a linkable cc module", depName)
|
||||
ctx.ModuleErrorf("data_lib %q is not a LinkableInterface module", depName)
|
||||
}
|
||||
ccModule, ok := dep.(*Module)
|
||||
if !ok {
|
||||
ctx.ModuleErrorf("data_lib %q is not a cc module", depName)
|
||||
}
|
||||
if ccDep.OutputFile().Valid() {
|
||||
if linkableDep.OutputFile().Valid() {
|
||||
test.data = append(test.data,
|
||||
android.DataPath{SrcPath: ccDep.OutputFile().Path(),
|
||||
RelativeInstallPath: ccModule.installer.relativeInstallPath()})
|
||||
android.DataPath{SrcPath: linkableDep.OutputFile().Path(),
|
||||
RelativeInstallPath: linkableDep.RelativeInstallPath()})
|
||||
}
|
||||
})
|
||||
ctx.VisitDirectDepsWithTag(dataBinDepTag, func(dep android.Module) {
|
||||
depName := ctx.OtherModuleName(dep)
|
||||
ccModule, ok := dep.(*Module)
|
||||
linkableDep, ok := dep.(LinkableInterface)
|
||||
if !ok {
|
||||
ctx.ModuleErrorf("data_bin %q is not a cc module", depName)
|
||||
ctx.ModuleErrorf("data_bin %q is not a LinkableInterface module", depName)
|
||||
}
|
||||
if ccModule.OutputFile().Valid() {
|
||||
if linkableDep.OutputFile().Valid() {
|
||||
test.data = append(test.data,
|
||||
android.DataPath{SrcPath: ccModule.OutputFile().Path(),
|
||||
RelativeInstallPath: ccModule.installer.relativeInstallPath()})
|
||||
android.DataPath{SrcPath: linkableDep.OutputFile().Path(),
|
||||
RelativeInstallPath: linkableDep.RelativeInstallPath()})
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user