1// Copyright (C) 2017 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 15// Default values for the USE flags. Override these USE flags from your product 16// by setting BRILLO_USE_* values. Note that we define local variables like 17// local_use_* to prevent leaking our default setting for other packages. 18 19package { 20 default_applicable_licenses: ["external_libbrillo_license"], 21} 22 23// Added automatically by a large-scale-change that took the approach of 24// 'apply every license found to every target'. While this makes sure we respect 25// every license restriction, it may not be entirely correct. 26// 27// e.g. GPL in an MIT project might only apply to the contrib/ directory. 28// 29// Please consider splitting the single license below into multiple licenses, 30// taking care not to lose any license_kind information, and overriding the 31// default license using the 'licenses: [...]' property on targets as needed. 32// 33// For unused files, consider creating a 'fileGroup' with "//visibility:private" 34// to attach the license to, and including a comment whether the files may be 35// used in the current project. 36// See: http://go/android-license-faq 37license { 38 name: "external_libbrillo_license", 39 visibility: [":__subpackages__"], 40 license_kinds: [ 41 "SPDX-license-identifier-Apache-2.0", 42 "SPDX-license-identifier-BSD", 43 ], 44 license_text: [ 45 "NOTICE", 46 ], 47} 48 49libbrillo_core_sources = [ 50 "brillo/backoff_entry.cc", 51 "brillo/data_encoding.cc", 52 "brillo/errors/error.cc", 53 "brillo/errors/error_codes.cc", 54 "brillo/flag_helper.cc", 55 "brillo/key_value_store.cc", 56 "brillo/message_loops/base_message_loop.cc", 57 "brillo/message_loops/message_loop.cc", 58 "brillo/message_loops/message_loop_utils.cc", 59 "brillo/mime_utils.cc", 60 "brillo/osrelease_reader.cc", 61 "brillo/process.cc", 62 "brillo/process_information.cc", 63 "brillo/secure_blob.cc", 64 "brillo/strings/string_utils.cc", 65 "brillo/syslog_logging.cc", 66 "brillo/type_name_undecorate.cc", 67 "brillo/url_utils.cc", 68 "brillo/userdb_utils.cc", 69 "brillo/value_conversion.cc", 70] 71 72libbrillo_linux_sources = [ 73 "brillo/asynchronous_signal_handler.cc", 74 "brillo/daemons/daemon.cc", 75 "brillo/file_utils.cc", 76 "brillo/process_reaper.cc", 77] 78 79libbrillo_binder_sources = ["brillo/binder_watcher.cc"] 80 81libbrillo_http_sources = [ 82 "brillo/http/curl_api.cc", 83 "brillo/http/http_connection_curl.cc", 84 "brillo/http/http_form_data.cc", 85 "brillo/http/http_request.cc", 86 "brillo/http/http_transport.cc", 87 "brillo/http/http_transport_curl.cc", 88 "brillo/http/http_utils.cc", 89] 90 91libbrillo_policy_sources = [ 92 "policy/device_policy.cc", 93 "policy/libpolicy.cc", 94] 95 96libbrillo_stream_sources = [ 97 "brillo/streams/file_stream.cc", 98 "brillo/streams/input_stream_set.cc", 99 "brillo/streams/memory_containers.cc", 100 "brillo/streams/memory_stream.cc", 101 "brillo/streams/openssl_stream_bio.cc", 102 "brillo/streams/stream.cc", 103 "brillo/streams/stream_errors.cc", 104 "brillo/streams/stream_utils.cc", 105 "brillo/streams/tls_stream.cc", 106] 107 108libbrillo_test_helpers_sources = [ 109 "brillo/http/http_connection_fake.cc", 110 "brillo/http/http_transport_fake.cc", 111 "brillo/message_loops/fake_message_loop.cc", 112 "brillo/streams/fake_stream.cc", 113 "brillo/unittest_utils.cc", 114] 115 116libbrillo_test_sources = [ 117 "brillo/asynchronous_signal_handler_test.cc", 118 "brillo/backoff_entry_test.cc", 119 "brillo/data_encoding_test.cc", 120 "brillo/enum_flags_test.cc", 121 "brillo/errors/error_codes_test.cc", 122 "brillo/errors/error_test.cc", 123 "brillo/file_utils_test.cc", 124 "brillo/flag_helper_test.cc", 125 "brillo/http/http_connection_curl_test.cc", 126 "brillo/http/http_form_data_test.cc", 127 "brillo/http/http_request_test.cc", 128 "brillo/http/http_transport_curl_test.cc", 129 "brillo/http/http_utils_test.cc", 130 "brillo/key_value_store_test.cc", 131 "brillo/map_utils_test.cc", 132 "brillo/message_loops/base_message_loop_test.cc", 133 "brillo/message_loops/fake_message_loop_test.cc", 134 "brillo/mime_utils_test.cc", 135 "brillo/osrelease_reader_test.cc", 136 "brillo/process_reaper_test.cc", 137 "brillo/process_test.cc", 138 "brillo/secure_blob_test.cc", 139 "brillo/streams/fake_stream_test.cc", 140 "brillo/streams/file_stream_test.cc", 141 "brillo/streams/input_stream_set_test.cc", 142 "brillo/streams/memory_containers_test.cc", 143 "brillo/streams/memory_stream_test.cc", 144 "brillo/streams/openssl_stream_bio_test.cc", 145 "brillo/streams/stream_test.cc", 146 "brillo/streams/stream_utils_test.cc", 147 "brillo/strings/string_utils_test.cc", 148 "brillo/unittest_utils.cc", 149 "brillo/url_utils_test.cc", 150 "brillo/value_conversion_test.cc", 151] 152 153libbrillo_CFLAGS = [ 154 "-Wall", 155 "-Werror", 156 "-Wno-non-virtual-dtor", 157 "-Wno-unused-parameter", 158 "-Wno-unused-variable", 159] 160 161libbrillo_shared_libraries = ["libchrome"] 162 163// Main library, shared and static for host and target 164// ======================================================== 165cc_library { 166 name: "libbrillo", 167 host_supported: true, 168 recovery_available: true, 169 srcs: libbrillo_core_sources, 170 shared_libs: libbrillo_shared_libraries, 171 static_libs: [ 172 "libmodpb64", 173 ], 174 header_libs: ["libgtest_prod_headers"], 175 cflags: libbrillo_CFLAGS, 176 export_include_dirs: ["."], 177 178 target: { 179 host: { 180 cppflags: ["-D__ANDROID_HOST__"], 181 }, 182 android: { 183 srcs: libbrillo_linux_sources, 184 }, 185 darwin: { 186 enabled: false 187 } 188 }, 189} 190 191// Shared binder library for target 192// ======================================================== 193cc_library_shared { 194 name: "libbrillo-binder", 195 srcs: libbrillo_binder_sources, 196 shared_libs: libbrillo_shared_libraries + [ 197 "libbinder", 198 "libbrillo", 199 "libutils", 200 ], 201 header_libs: ["libgtest_prod_headers"], 202 cflags: libbrillo_CFLAGS, 203 export_include_dirs: ["."], 204} 205 206// Shared minijail library for target 207// ======================================================== 208cc_library_shared { 209 name: "libbrillo-minijail", 210 srcs: [ 211 "brillo/minijail/minijail.cc", 212 ], 213 shared_libs: [ 214 "libchrome", 215 "libbrillo", 216 "libminijail", 217 ], 218 header_libs: ["libgtest_prod_headers"], 219 cflags: libbrillo_CFLAGS, 220 export_include_dirs: ["."], 221} 222 223// Shared and static stream library for target and host 224// ======================================================== 225cc_library { 226 name: "libbrillo-stream", 227 srcs: libbrillo_stream_sources, 228 shared_libs: libbrillo_shared_libraries + [ 229 "libbrillo", 230 "libcrypto", 231 "libssl", 232 ], 233 header_libs: ["libgtest_prod_headers"], 234 cflags: libbrillo_CFLAGS, 235 export_include_dirs: ["."], 236 237 host_supported: true, 238 recovery_available: true, 239 target: { 240 darwin: { 241 enabled: false, 242 }, 243 windows: { 244 enabled: false, 245 }, 246 }, 247} 248 249// Shared http library for target and host 250// ======================================================== 251cc_library_shared { 252 name: "libbrillo-http", 253 srcs: libbrillo_http_sources, 254 shared_libs: libbrillo_shared_libraries + [ 255 "libbrillo", 256 "libbrillo-stream", 257 "libcurl", 258 ], 259 header_libs: ["libgtest_prod_headers"], 260 cflags: libbrillo_CFLAGS, 261 export_include_dirs: ["."], 262 263 host_supported: true, 264 target: { 265 darwin: { 266 enabled: false, 267 }, 268 windows: { 269 enabled: false, 270 }, 271 }, 272} 273 274// Shared policy library for target 275// ======================================================== 276cc_library_shared { 277 name: "libbrillo-policy", 278 srcs: libbrillo_policy_sources, 279 shared_libs: libbrillo_shared_libraries, 280 header_libs: ["libgtest_prod_headers"], 281 cflags: libbrillo_CFLAGS, 282 export_include_dirs: ["."], 283} 284 285 286// Static test-helpers library for target 287// ======================================================== 288cc_library_static { 289 name: "libbrillo-test-helpers", 290 srcs: libbrillo_test_helpers_sources, 291 static_libs: [ 292 "libgtest", 293 "libgmock", 294 ], 295 shared_libs: libbrillo_shared_libraries + [ 296 "libbrillo", 297 "libcurl", 298 "libbrillo-http", 299 "libbrillo-stream", 300 "libcrypto", 301 ], 302 cflags: libbrillo_CFLAGS, 303 cppflags: ["-Wno-sign-compare"], 304 export_include_dirs: ["."], 305} 306 307// Unit tests. 308// ======================================================== 309cc_test { 310 name: "libbrillo_test", 311 srcs: libbrillo_test_sources, 312 isolated: true, 313 static_libs: [ 314 "libgtest", 315 "libchrome_test_helpers", 316 "libbrillo-test-helpers", 317 "libgmock", 318 ], 319 shared_libs: libbrillo_shared_libraries + [ 320 "libbrillo", 321 "libcurl", 322 "libbrillo-http", 323 "libbrillo-stream", 324 "libcrypto", 325 "libprotobuf-cpp-lite", 326 ], 327 cflags: libbrillo_CFLAGS, 328 cppflags: ["-Wno-sign-compare"], 329} 330