• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2024 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
15load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
16
17rust_library(
18    name = "libgbl",
19    srcs = glob(
20        ["**/*.rs"],
21        exclude = ["tests/**/*.rs"],
22    ),
23    aliases = {"@itertools_noalloc": "itertools_noalloc"},
24    edition = "2021",
25    visibility = ["//visibility:public"],
26    deps = [
27        "@avb",
28        "@bitflags",
29        "@crc32fast",
30        "@cstr",
31        "@gbl//libfastboot",
32        "@gbl//libsafemath",
33        "@gbl//libstorage",
34        "@gbl//third_party/libzbi",
35        "@itertools_noalloc",
36        "@spin",
37        "@static_assertions",
38        "@zerocopy",
39    ],
40)
41
42rust_test(
43    name = "libgbl_test",
44    aliases = {"@itertools_noalloc": "itertools_noalloc"},
45    compile_data = ["@gbl//libstorage/test:test_data"],
46    crate = ":libgbl",
47    crate_features = ["uuid"],
48    data = [
49        "@gbl//libgbl/testdata:sparse_test.bin",
50        "@gbl//libgbl/testdata:sparse_test_blk1024.bin",
51        "@gbl//libgbl/testdata:sparse_test_raw.bin",
52        "@gbl//libgbl/testdata:testkey_rsa4096_pub.bin",
53        "@gbl//libgbl/testdata:writeback_test_disk.bin",
54        "@gbl//libgbl/testdata:zircon_a.bin",
55        "@gbl//libgbl/testdata:zircon_a.vbmeta",
56    ],
57    deps = [
58        "@avb//:avb_crypto_ops_sha_impl_staticlib",
59        "@avb//:avb_test",
60        "@gbl//libavb:sysdeps",
61        "@gbl//libstorage:libstorage_testlib",
62        "@itertools",
63        "@itertools_noalloc",
64        "@static_assertions",
65        "@uuid",
66    ],
67)
68
69rust_test(
70    name = "integration_test",
71    srcs = ["tests/integration_tests.rs"],
72    compile_data = [
73        "@gbl//libgbl/testdata:zircon_a.bin",
74        "@gbl//libgbl/testdata:zircon_b.bin",
75        "@gbl//libgbl/testdata:zircon_r.bin",
76        "@gbl//libgbl/testdata:zircon_gpt.bin",
77    ],
78    deps = [
79        ":libgbl",
80        "@avb//:avb_crypto_ops_sha_impl_staticlib",
81        "@gbl//libavb:sysdeps",
82        "@gbl//libstorage",
83        "@gbl//libstorage:libstorage_testlib",
84    ],
85)
86