xref: /aosp_15_r20/external/sandboxed-api/sandboxed_api/tools/filewrapper/BUILD.bazel (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1# Copyright 2019 Google LLC
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#     https://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("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
16load("//sandboxed_api/bazel:embed_data.bzl", "sapi_cc_embed_data")
17
18licenses(["notice"])
19
20# An implicit dependency of all "sapi_cc_embed_data" rules that builds
21# embedded data into .cc files.
22cc_binary(
23    name = "filewrapper",
24    srcs = ["filewrapper.cc"],
25    copts = sapi_platform_copts(),
26    visibility = ["//visibility:public"],
27    deps = [
28        "//sandboxed_api/util:fileops",
29        "//sandboxed_api/util:raw_logging",
30        "//sandboxed_api/util:strerror",
31        "@com_google_absl//absl/strings",
32        "@com_google_absl//absl/strings:str_format",
33    ],
34)
35
36sapi_cc_embed_data(
37    name = "filewrapper_embedded",
38    srcs = ["testdata/filewrapper_embedded.bin"],
39)
40
41cc_test(
42    name = "filewrapper_test",
43    srcs = ["filewrapper_test.cc"],
44    copts = sapi_platform_copts(),
45    data = ["testdata/filewrapper_embedded.bin"],
46    deps = [
47        ":filewrapper_embedded",
48        "//sandboxed_api:testing",
49        "//sandboxed_api/util:file_helpers",
50        "//sandboxed_api/util:status_matchers",
51        "@com_google_googletest//:gtest_main",
52    ],
53)
54