summaryrefslogtreecommitdiff
path: root/rust/testing.go
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2020-11-17 22:21:02 +0900
committerJiyong Park <jiyong@google.com>2020-11-30 15:40:48 +0000
commit99644e92c86e400fb78595edf02184139574c2ca (patch)
tree42017649a604b8a75c3ac29734865c7f1a30458c /rust/testing.go
parentd35d92a7b57c61deaa3316e624d6a9898475704d (diff)
rust modules can be included in apex
We will have some APEXes having rust binaries and libraries. So, adding the support for the types of modules. rust.Module now inherits from android.ApexModuleBase and implements the android.ApexModule interface. Bug: 172414324 Test: m Exempt-From-Owner-Approval: rebased after +2 from the owner Change-Id: I356ef4c45f782a6460f001e83af96d1710642d80
Diffstat (limited to 'rust/testing.go')
-rw-r--r--rust/testing.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/rust/testing.go b/rust/testing.go
index 001f322d8..a8496d983 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -77,6 +77,7 @@ func GatherRequiredDepsForTest() string {
no_libcrt: true,
nocrt: true,
system_shared_libs: [],
+ apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
}
cc_library {
name: "libprotobuf-cpp-full",
@@ -93,6 +94,7 @@ func GatherRequiredDepsForTest() string {
host_supported: true,
native_coverage: false,
sysroot: true,
+ apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
}
rust_library {
name: "libtest",
@@ -102,6 +104,7 @@ func GatherRequiredDepsForTest() string {
host_supported: true,
native_coverage: false,
sysroot: true,
+ apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
}
rust_library {
name: "libprotobuf",
@@ -122,15 +125,11 @@ func GatherRequiredDepsForTest() string {
host_supported: true,
}
-` + cc.GatherRequiredDepsForTest(android.NoOsType)
+`
return bp
}
-func CreateTestContext(config android.Config) *android.TestContext {
- ctx := android.NewTestArchContext(config)
- android.RegisterPrebuiltMutators(ctx)
- ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
- cc.RegisterRequiredBuildComponentsForTest(ctx)
+func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
ctx.RegisterModuleType("rust_binary", RustBinaryFactory)
ctx.RegisterModuleType("rust_binary_host", RustBinaryHostFactory)
ctx.RegisterModuleType("rust_bindgen", RustBindgenFactory)
@@ -164,6 +163,14 @@ func CreateTestContext(config android.Config) *android.TestContext {
ctx.BottomUp("rust_begin", BeginMutator).Parallel()
})
ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton)
+}
+
+func CreateTestContext(config android.Config) *android.TestContext {
+ ctx := android.NewTestArchContext(config)
+ android.RegisterPrebuiltMutators(ctx)
+ ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
+ cc.RegisterRequiredBuildComponentsForTest(ctx)
+ RegisterRequiredBuildComponentsForTest(ctx)
return ctx
}