• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/ohos_var.gni")
16
17group("tests") {
18  deps = [
19    ":cxx_test_host_and_target",
20    "test_bin_crate:test_bin_crate(${host_toolchain})",
21    "test_cdylib_crate:test_cdylib_crate(${host_toolchain})",
22    "test_dylib_crate:test_dylib_crate(${host_toolchain})",
23    "test_proc_macro_crate:test_proc_macro_crate(${host_toolchain})",
24    "test_static_link:test_static_link(${host_toolchain})",
25  ]
26  deps += [
27    "//build/rust/tests/test_bin_crate",
28    "//build/rust/tests/test_cdylib_crate",
29    "//build/rust/tests/test_dylib_crate",
30    "//build/rust/tests/test_rlib_crate",
31    "//build/rust/tests/test_static_link",
32    "//build/rust/tests/test_staticlib_crate",
33  ]
34  deps += [ ":cargo_crate_test" ]
35  if (is_system_component) {
36    deps += [ "//build/rust/tests/test_idl" ]
37  }
38  deps += [ ":original_libstd.so" ]
39}
40
41group("ohos_rust_xxxtest_tests") {
42  testonly = true
43  deps = [
44    "test_rust_st:test_rust_st(${host_toolchain})",
45    "test_rust_ut:test_rust_ut(${host_toolchain})",
46    "//build/rust/tests/test_proc_macro_crate/test_derive_macro:test_derive_macro(${host_toolchain})",
47    "//build/rust/tests/test_rust_st",
48    "//build/rust/tests/test_rust_ut",
49  ]
50}
51
52group("cargo_crate_test") {
53  deps = [
54    "test_bin_cargo_crate:test_bin_cargo_crate",
55    "test_proc_macro_cargo_crate:test_proc_macro_cargo_crate(${host_toolchain})",
56    "test_rlib_cargo_crate:test_rlib_crate_associated_bin",
57  ]
58}
59
60group("cxx_test_host_and_target") {
61  deps = [
62    "//build/rust/tests/test_bindgen_test/test_for_extern_c:test_extern_c",
63    "//build/rust/tests/test_bindgen_test/test_for_extern_c:test_extern_c(${host_toolchain})",
64    "//build/rust/tests/test_bindgen_test/test_for_h:bindgen_test_for_h",
65    "//build/rust/tests/test_bindgen_test/test_for_h:bindgen_test_for_h(${host_toolchain})",
66    "//build/rust/tests/test_bindgen_test/test_for_hello_world:bindgen_test",
67    "//build/rust/tests/test_bindgen_test/test_for_hello_world:bindgen_test(${host_toolchain})",
68    "//build/rust/tests/test_bindgen_test/test_for_hpp:bindgen_test_hpp",
69    "//build/rust/tests/test_bindgen_test/test_for_hpp:bindgen_test_hpp(${host_toolchain})",
70    "//build/rust/tests/test_cxx:test_cxx_exe",
71    "//build/rust/tests/test_cxx:test_cxx_exe(${host_toolchain})",
72    "//build/rust/tests/test_cxx_rust:test_cxx_rust",
73    "//build/rust/tests/test_cxx_rust:test_cxx_rust(${host_toolchain})",
74  ]
75}
76
77ohos_prebuilt_shared_library("original_libstd.so") {
78  if (current_cpu == "arm64") {
79    source = "//prebuilts/rustc/linux-x86_64/current/lib/rustlib/aarch64-linux-ohos/lib/libstd.dylib.so"
80    output = "libstd-37747be394d9d22c.so"
81  } else if (current_cpu == "arm") {
82    source = "//prebuilts/rustc/linux-x86_64/current/lib/rustlib/armv7-linux-ohos/lib/libstd.dylib.so"
83    output = "libstd-a4ed09c4b860e683.so"
84  } else if (current_cpu == "x86_64" || current_cpu == "x64") {
85    source =
86        "//prebuilts/rustc/linux-x86_64/current/lib/libstd-b779f91b8eb0a330.so"
87    output = "libstd-c244726431624c96.so"
88  }
89  enable_strip = true
90  install_images = [
91    "system",
92    "updater",
93  ]
94  subsystem_name = "build"
95  part_name = "build_framework"
96}
97