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("@gbl//toolchain:gbl_workspace_util.bzl", "ANDROID_RUST_LINTS") 16load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") 17 18package( 19 default_visibility = ["//visibility:public"], 20) 21 22rust_library( 23 name = "libgbl", 24 srcs = glob( 25 ["**/*.rs"], 26 exclude = ["tests/**/*.rs"], 27 ), 28 aliases = {"@itertools_noalloc": "itertools_noalloc"}, 29 edition = "2021", 30 rustc_flags = ANDROID_RUST_LINTS, 31 visibility = ["//visibility:public"], 32 deps = [ 33 "@arrayvec", 34 "@avb", 35 "@avb//:avb_bindgen", 36 "@bitflags", 37 "@crc32fast", 38 "@gbl//libabr", 39 "@gbl//libasync", 40 "@gbl//libboot", 41 "@gbl//libbootimg", 42 "@gbl//libbootparams", 43 "@gbl//libdttable", 44 "@gbl//liberror", 45 "@gbl//libfastboot", 46 "@gbl//libfdt", 47 "@gbl//libmisc", 48 "@gbl//libsafemath", 49 "@gbl//libstorage", 50 "@gbl//libutils", 51 "@itertools_noalloc", 52 "@lz4_flex", 53 "@spin", 54 "@static_assertions", 55 "@uuid", 56 "@zbi", 57 "@zerocopy", 58 "@zune_inflate", 59 ], 60) 61 62rust_test( 63 name = "libgbl_test", 64 aliases = {"@itertools_noalloc": "itertools_noalloc"}, 65 compile_data = [ 66 "@gbl//libstorage/test:test_data", 67 "@gbl//libdttable/test/data:all", 68 "@gbl//libfdt/test/data:all", 69 ], 70 crate = ":libgbl", 71 crate_features = ["uuid"], 72 data = ["@gbl//libgbl/testdata"], 73 rustc_flags = ANDROID_RUST_LINTS, 74 deps = [ 75 "@avb//:avb_crypto_ops_sha_impl_staticlib", 76 "@avb//:avb_test", 77 "@gbl//libasync:cyclic_executor", 78 "@gbl//libavb:sysdeps", 79 "@gbl//libc:libc_deps_posix", 80 "@itertools", 81 "@itertools_noalloc", 82 "@static_assertions", 83 "@uuid", 84 ], 85) 86