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 "in_sandbox.cpp", 30 "json.cpp", 31 "network.cpp", 32 "proc_file_utils.cpp", 33 "shared_fd_flag.cpp", 34 "signals.cpp", 35 "subprocess.cpp", 36 "tcp_socket.cpp", 37 "tee_logging.cpp", 38 "unix_sockets.cpp", 39 "users.cpp", 40 ], 41 shared: { 42 shared_libs: [ 43 "libbase", 44 "libcrypto", 45 "libcuttlefish_fs", 46 "libjsoncpp", 47 ], 48 }, 49 static: { 50 static_libs: [ 51 "libbase", 52 "libcuttlefish_fs", 53 "libjsoncpp", 54 ], 55 shared_libs: [ 56 "libcrypto", // libcrypto_static is not accessible from all targets 57 ], 58 }, 59 target: { 60 darwin: { 61 enabled: true, 62 }, 63 linux: { 64 srcs: [ 65 "inotify.cpp", 66 "socket2socket_proxy.cpp", // TODO(b/285989475): Find eventfd alternative 67 "vsock_connection.cpp", 68 ], 69 }, 70 }, 71 whole_static_libs: ["libcuttlefish_utils_result"], 72 defaults: ["cuttlefish_host"], 73 product_available: true, 74} 75 76cc_test_host { 77 name: "libcuttlefish_utils_test", 78 srcs: [ 79 "base64_test.cpp", 80 "files_test.cpp", 81 "files_test_helper.cpp", 82 "flag_parser_test.cpp", 83 "network_test.cpp", 84 "proc_file_utils_test.cpp", 85 "result_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: [ 109 "libbase", 110 "libcuttlefish_fs", 111 "libjsoncpp", 112 "liblog", 113 ], 114 defaults: ["cuttlefish_guest_only"], 115 include_dirs: ["device/google/cuttlefish"], 116 export_include_dirs: ["."], 117} 118 119cc_library { 120 name: "libcuttlefish_utils_result", 121 product_available: true, 122 srcs: ["result.cpp"], 123 static_libs: ["libbase"], 124 target: { 125 darwin: { 126 enabled: true, 127 }, 128 windows: { 129 enabled: true, 130 }, 131 }, 132 defaults: ["cuttlefish_host"], 133} 134