1//
2// Copyright (C) 2018 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_library {
21    name: "libcuttlefish_utils",
22    srcs: [
23        "archive.cpp",
24        "base64.cpp",
25        "environment.cpp",
26        "files.cpp",
27        "flag_parser.cpp",
28        "flags_validator.cpp",
29        "json.cpp",
30        "network.cpp",
31        "proc_file_utils.cpp",
32        "shared_fd_flag.cpp",
33        "signals.cpp",
34        "subprocess.cpp",
35        "tcp_socket.cpp",
36        "tee_logging.cpp",
37        "unix_sockets.cpp",
38        "users.cpp",
39    ],
40    shared: {
41        shared_libs: [
42            "libbase",
43            "libcuttlefish_fs",
44            "libcrypto",
45            "libjsoncpp",
46        ],
47    },
48    static: {
49        static_libs: [
50            "libbase",
51            "libcuttlefish_fs",
52            "libjsoncpp",
53        ],
54        shared_libs: [
55          "libcrypto", // libcrypto_static is not accessible from all targets
56        ],
57    },
58    target: {
59        darwin: {
60            enabled: true,
61        },
62        linux: {
63            srcs: [
64                "inotify.cpp",
65                "socket2socket_proxy.cpp", // TODO(b/285989475): Find eventfd alternative
66                "vsock_connection.cpp",
67            ]
68        },
69    },
70    whole_static_libs: ["libcuttlefish_utils_result"],
71    defaults: ["cuttlefish_host"],
72    product_available: true,
73}
74
75cc_test_host {
76    name: "libcuttlefish_utils_test",
77    srcs: [
78        "base64_test.cpp",
79        "files_test.cpp",
80        "files_test_helper.cpp",
81        "flag_parser_test.cpp",
82        "network_test.cpp",
83        "proc_file_utils_test.cpp",
84        "result_test.cpp",
85        "unique_resource_allocator_test.cpp",
86        "unix_sockets_test.cpp",
87    ],
88    static_libs: [
89        "libbase",
90        "libcuttlefish_fs",
91        "libcuttlefish_utils",
92        "libgmock",
93    ],
94    shared_libs: [
95        "libcrypto",
96        "liblog",
97        "libxml2",
98    ],
99    test_options: {
100        unit_test: true,
101    },
102    defaults: ["cuttlefish_host"],
103}
104
105cc_library {
106    name: "libvsock_utils",
107    srcs: ["vsock_connection.cpp"],
108    shared_libs: ["libbase", "libcuttlefish_fs", "liblog", "libjsoncpp"],
109    defaults: ["cuttlefish_guest_only"],
110    include_dirs: ["device/google/cuttlefish"],
111    export_include_dirs: ["."],
112}
113
114cc_library {
115    name: "libcuttlefish_utils_result",
116    product_available: true,
117    srcs: ["result.cpp"],
118    static_libs: ["libbase"],
119    target: {
120        darwin: {
121            enabled: true,
122        },
123        windows: {
124            enabled: true,
125        },
126    },
127    defaults: ["cuttlefish_host"],
128}
129
130