diff options
author | Paul Duffin <paulduffin@google.com> | 2019-12-19 16:01:36 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2019-12-19 19:19:40 +0000 |
commit | 77980a8bb9e86cbd847181e2f5d53b06a987cae8 (patch) | |
tree | 248af0e0eb71d964afba7e3fbc879a40f6608a02 /rust | |
parent | 2ccaffd1d7e335bd50e79a850a79f51ba3aba1b1 (diff) | |
download | build_soong-77980a8bb9e86cbd847181e2f5d53b06a987cae8.tar.gz build_soong-77980a8bb9e86cbd847181e2f5d53b06a987cae8.tar.bz2 build_soong-77980a8bb9e86cbd847181e2f5d53b06a987cae8.zip |
Dedup registration for cc default test config
The cc.GatherRequiredDepsForTest() method returns some default module
definitions that are required when using cc module types like
cc_library. Previously, the registration of the module types and
mutators needed to process those default definitions was duplicated
in the test config initialization.
This change removes that duplicated code and replaces it with calls
to cc.RegisterRequiredBuildComponentsForTest(ctx) which registers all
the required build components.
Test: m checkbuild
Bug: 146540677
Change-Id: I80b6913c5691ff164ce9d308b9e1da24940f2d42
Diffstat (limited to 'rust')
-rw-r--r-- | rust/testing.go | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/rust/testing.go b/rust/testing.go index 1dd16cfd..f9adec82 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -75,97 +75,19 @@ func GatherRequiredDepsForTest() string { ////////////////////////////// // Device module requirements - toolchain_library { - name: "libgcc", - no_libcrt: true, - nocrt: true, - src: "", - system_shared_libs: [], - } - cc_library { - name: "libc", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_library { - name: "libm", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_library { - name: "libdl", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - } - cc_object { - name: "crtbegin_dynamic", - } - - cc_object { - name: "crtend_android", - } cc_library { name: "liblog", no_libcrt: true, nocrt: true, system_shared_libs: [], } - - ////////////////////////////// - // cc module requirements - - toolchain_library { - name: "libatomic", - src: "", - } - toolchain_library { - name: "libclang_rt.builtins-aarch64-android", - src: "", - } - toolchain_library { - name: "libgcc_stripped", - src: "", - } - cc_library { - name: "libc++_static", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - cc_library { - name: "libc++demangle", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - host_supported: false, - } - cc_library { - name: "libc++", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - cc_library { - name: "libunwind_llvm", - no_libcrt: true, - nocrt: true, - system_shared_libs: [], - stl: "none", - } - ` +` + cc.GatherRequiredDepsForTest(android.NoOsType) return bp } func CreateTestContext() *android.TestContext { ctx := android.NewTestArchContext() - ctx.RegisterModuleType("cc_library", cc.LibraryFactory) - ctx.RegisterModuleType("cc_object", cc.ObjectFactory) + cc.RegisterRequiredBuildComponentsForTest(ctx) ctx.RegisterModuleType("rust_binary", RustBinaryFactory) ctx.RegisterModuleType("rust_binary_host", RustBinaryHostFactory) ctx.RegisterModuleType("rust_test", RustTestFactory) @@ -182,13 +104,7 @@ func CreateTestContext() *android.TestContext { ctx.RegisterModuleType("rust_library_host_static", RustLibraryStaticHostFactory) ctx.RegisterModuleType("rust_proc_macro", ProcMacroFactory) ctx.RegisterModuleType("rust_prebuilt_dylib", PrebuiltDylibFactory) - ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { - // cc mutators - ctx.BottomUp("link", cc.LinkageMutator).Parallel() - ctx.BottomUp("version", cc.VersionMutator).Parallel() - ctx.BottomUp("begin", cc.BeginMutator).Parallel() - // rust mutators ctx.BottomUp("rust_libraries", LibraryMutator).Parallel() ctx.BottomUp("rust_unit_tests", TestPerSrcMutator).Parallel() |