• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This file is generated by cargo2android.py --run --device --tests --dependencies --global_defaults=crosvm_defaults --add_workspace --no-subdir.
2// Do not modify this file as changes will be overridden on upgrade.
3
4package {
5    // See: http://go/android-license-faq
6    // A large-scale-change added 'default_applicable_licenses' to import
7    // all of the 'license_kinds' from "external_crosvm_license"
8    // to get the below license kinds:
9    //   SPDX-license-identifier-BSD
10    default_applicable_licenses: ["external_crosvm_license"],
11}
12
13rust_library {
14    name: "libsys_util",
15    defaults: ["crosvm_defaults"],
16    host_supported: true,
17    crate_name: "sys_util",
18    srcs: ["src/lib.rs"],
19    edition: "2018",
20    rustlibs: [
21        "libdata_model",
22        "liblibc",
23        "libserde",
24        "libserde_json",
25        "libsync_rust",
26        "libtempfile",
27    ],
28    proc_macros: ["libpoll_token_derive"],
29    shared_libs: ["libcap"],  // specified in src/capabilities.rs
30    target: {
31        android: {
32            rustlibs: [
33                "libandroid_log_sys",
34            ],
35        },
36        linux_bionic_arm64: {
37            // For ARM architecture, we use aarch64-linux-android for BOTH
38            // device and host targets. As a result, host targets are also
39            // built with target_os = "android". Therefore, sys_util/src/android
40            // is used and thus this android module is required.
41            // This seems incorrect, but is inevitable because rustc doesn't
42            // yet support a Linux-based target using Bionic as libc. We can't
43            // use aarch64-unknown-linux-gnu because it's using glibc which
44            // we don't support for cross-host builds.
45            rustlibs: [
46                "libandroid_log_sys",
47            ],
48        },
49    },
50}
51
52rust_defaults {
53    name: "sys_util_defaults",
54    defaults: ["crosvm_defaults"],
55    crate_name: "sys_util",
56    srcs: ["src/lib.rs"],
57    test_suites: ["general-tests"],
58    auto_gen_config: true,
59    edition: "2018",
60    rustlibs: [
61        "libdata_model",
62        "liblibc",
63        "libserde",
64        "libserde_json",
65        "libsync_rust",
66        "libtempfile",
67    ],
68    proc_macros: ["libpoll_token_derive"],
69    shared_libs: ["libcap"],  // specified in src/capabilities.rs
70}
71
72// TODO: This doesn't link because of missing getrandom in Bionic (host only, it's
73// available in the guest). Fix it upstream.
74// rust_test_host {
75//     name: "sys_util_host_test_src_lib",
76//     defaults: ["sys_util_defaults"],
77//     test_options: {
78//         unit_test: true,
79//     },
80// }
81
82// TODO: This doesn't build due to missing shm_open &c. in Bionic. Fix it upstream.
83//rust_test {
84//    name: "sys_util_device_test_src_lib",
85//    defaults: ["sys_util_defaults"],
86//    rustlibs: [
87//        "libandroid_log_sys",
88//    ],
89//}
90
91// dependent_library ["feature_list"]
92//   ../assertions/src/lib.rs
93//   ../data_model/src/lib.rs
94//   ../sync/src/lib.rs
95//   ../tempfile/src/lib.rs
96//   itoa-0.4.7
97//   libc-0.2.93 "default,std"
98//   proc-macro2-1.0.26 "default,proc-macro"
99//   quote-1.0.9 "default,proc-macro"
100//   ryu-1.0.5
101//   serde-1.0.125 "default,derive,serde_derive,std"
102//   serde_derive-1.0.125 "default"
103//   serde_json-1.0.64 "default,std"
104//   syn-1.0.70 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
105//   unicode-xid-0.2.1 "default"
106