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: [ 175 "libgtest_prod_headers", 176 ], 177 cflags: libbrillo_CFLAGS, 178 export_include_dirs: ["."], 179 180 target: { 181 host: { 182 cppflags: ["-D__ANDROID_HOST__"], 183 }, 184 android: { 185 srcs: libbrillo_linux_sources, 186 }, 187 darwin: { 188 enabled: false 189 } 190 }, 191} 192 193// Shared binder library for target 194// ======================================================== 195cc_library_shared { 196 name: "libbrillo-binder", 197 srcs: libbrillo_binder_sources, 198 shared_libs: libbrillo_shared_libraries + [ 199 "libbinder", 200 "libbrillo", 201 "libutils", 202 ], 203 header_libs: ["libgtest_prod_headers"], 204 cflags: libbrillo_CFLAGS, 205 export_include_dirs: ["."], 206} 207 208// Shared minijail library for target 209// ======================================================== 210cc_library_shared { 211 name: "libbrillo-minijail", 212 srcs: [ 213 "brillo/minijail/minijail.cc", 214 ], 215 shared_libs: [ 216 "libchrome", 217 "libbrillo", 218 "libminijail", 219 ], 220 header_libs: ["libgtest_prod_headers"], 221 cflags: libbrillo_CFLAGS, 222 export_include_dirs: ["."], 223} 224 225// Shared and static stream library for target and host 226// ======================================================== 227cc_library { 228 name: "libbrillo-stream", 229 srcs: libbrillo_stream_sources, 230 shared_libs: libbrillo_shared_libraries + [ 231 "libbrillo", 232 "libcrypto", 233 "libssl", 234 ], 235 header_libs: ["libgtest_prod_headers"], 236 cflags: libbrillo_CFLAGS, 237 export_include_dirs: ["."], 238 239 host_supported: true, 240 recovery_available: true, 241 target: { 242 darwin: { 243 enabled: false, 244 }, 245 windows: { 246 enabled: false, 247 }, 248 }, 249} 250 251// Shared http library for target and host 252// ======================================================== 253cc_library_shared { 254 name: "libbrillo-http", 255 srcs: libbrillo_http_sources, 256 shared_libs: libbrillo_shared_libraries + [ 257 "libbrillo", 258 "libbrillo-stream", 259 "libcurl", 260 ], 261 header_libs: ["libgtest_prod_headers"], 262 cflags: libbrillo_CFLAGS, 263 export_include_dirs: ["."], 264 265 host_supported: true, 266 target: { 267 darwin: { 268 enabled: false, 269 }, 270 windows: { 271 enabled: false, 272 }, 273 }, 274} 275 276// Shared policy library for target 277// ======================================================== 278cc_library_shared { 279 name: "libbrillo-policy", 280 srcs: libbrillo_policy_sources, 281 shared_libs: libbrillo_shared_libraries, 282 header_libs: ["libgtest_prod_headers"], 283 cflags: libbrillo_CFLAGS, 284 export_include_dirs: ["."], 285} 286 287 288// Static test-helpers library for target 289// ======================================================== 290cc_library_static { 291 name: "libbrillo-test-helpers", 292 srcs: libbrillo_test_helpers_sources, 293 static_libs: [ 294 "libgtest", 295 "libgmock", 296 ], 297 shared_libs: libbrillo_shared_libraries + [ 298 "libbrillo", 299 "libcurl", 300 "libbrillo-http", 301 "libbrillo-stream", 302 "libcrypto", 303 ], 304 cflags: libbrillo_CFLAGS, 305 cppflags: ["-Wno-sign-compare"], 306 export_include_dirs: ["."], 307} 308 309// Unit tests. 310// ======================================================== 311cc_test { 312 name: "libbrillo_test", 313 srcs: libbrillo_test_sources, 314 isolated: true, 315 static_libs: [ 316 "libgtest", 317 "libchrome_test_helpers", 318 "libbrillo-test-helpers", 319 "libgmock", 320 ], 321 shared_libs: libbrillo_shared_libraries + [ 322 "libbrillo", 323 "libcurl", 324 "libbrillo-http", 325 "libbrillo-stream", 326 "libcrypto", 327 "libprotobuf-cpp-lite", 328 ], 329 cflags: libbrillo_CFLAGS, 330 cppflags: ["-Wno-sign-compare"], 331} 332