1// Copyright 2023, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19rust_defaults {
20    name: "libzbi_defaults",
21    crate_name: "zbi",
22    edition: "2021",
23    features: [],
24    srcs: ["src/lib.rs"],
25    rustlibs: ["libbitflags"],
26}
27
28rust_library {
29    name: "libzbi",
30    host_supported: true,
31    defaults: ["libzbi_defaults"],
32    rustlibs: ["libzerocopy"],
33}
34
35rust_library_rlib {
36    name: "libzbi_nostd",
37    defaults: ["libzbi_defaults"],
38    no_stdlibs: true,
39    prefer_rlib: true,
40    rustlibs: ["libzerocopy_nostd_noalloc"],
41}
42
43// libzbi unit tests to run on host.
44rust_test_host {
45    name: "libzbi_host_test",
46    defaults: ["libzbi_defaults"],
47    rustlibs: [
48        "libzerocopy",
49        "libhex",
50    ],
51}
52
53// libzbi unit tests to run on devices.
54rust_test {
55    name: "libzbi_device_test",
56    defaults: ["libzbi_defaults"],
57    rustlibs: [
58        "libzerocopy",
59        "libhex",
60    ],
61    test_suites: ["general-tests"],
62}
63