blob: 8a10dc892d41901a83377830ecb75db07c3ae92f [file] [log] [blame]
Alex Deymo7a4643f2017-07-10 16:22:31 +02001// 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
Bob Badoura40b7ac2021-02-12 17:53:42 -080019package {
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
Alex Deymo7a4643f2017-07-10 16:22:31 +020049libbrillo_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 = [
Qijiang Fane2e0f822020-06-30 22:20:54 +0900117 "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",
Alex Deymo7a4643f2017-07-10 16:22:31 +0200148 "brillo/unittest_utils.cc",
Qijiang Fane2e0f822020-06-30 22:20:54 +0900149 "brillo/url_utils_test.cc",
150 "brillo/value_conversion_test.cc",
Alex Deymo7a4643f2017-07-10 16:22:31 +0200151]
152
153libbrillo_CFLAGS = [
154 "-Wall",
155 "-Werror",
Qijiang Fane2e0f822020-06-30 22:20:54 +0900156 "-Wno-non-virtual-dtor",
157 "-Wno-unused-parameter",
158 "-Wno-unused-variable",
Alex Deymo7a4643f2017-07-10 16:22:31 +0200159]
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,
Dan Willemsenf6035ae2018-10-23 13:45:43 -0700168 recovery_available: true,
Alex Deymo631c6622017-07-17 16:57:05 +0200169 srcs: libbrillo_core_sources,
Alex Deymo7a4643f2017-07-10 16:22:31 +0200170 shared_libs: libbrillo_shared_libraries,
171 static_libs: [
172 "libmodpb64",
Alex Deymo7a4643f2017-07-10 16:22:31 +0200173 ],
Elliott Hughes73635992021-04-22 13:39:54 -0700174 header_libs: ["libgtest_prod_headers"],
Alex Deymo7a4643f2017-07-10 16:22:31 +0200175 cflags: libbrillo_CFLAGS,
176 export_include_dirs: ["."],
177
178 target: {
179 host: {
180 cppflags: ["-D__ANDROID_HOST__"],
181 },
Alex Deymo631c6622017-07-17 16:57:05 +0200182 android: {
183 srcs: libbrillo_linux_sources,
184 },
Hidehiko Abe5b67e342018-02-06 15:50:43 +0900185 darwin: {
186 enabled: false
187 }
Alex Deymo7a4643f2017-07-10 16:22:31 +0200188 },
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 ],
Elliott Hughes73635992021-04-22 13:39:54 -0700201 header_libs: ["libgtest_prod_headers"],
Alex Deymo7a4643f2017-07-10 16:22:31 +0200202 cflags: libbrillo_CFLAGS,
203 export_include_dirs: ["."],
204}
205
Nan Zhangf85de062017-11-28 17:25:25 -0800206// 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 ],
Elliott Hughes73635992021-04-22 13:39:54 -0700218 header_libs: ["libgtest_prod_headers"],
Nan Zhangf85de062017-11-28 17:25:25 -0800219 cflags: libbrillo_CFLAGS,
220 export_include_dirs: ["."],
221}
222
Alex Deymo7a4643f2017-07-10 16:22:31 +0200223// 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 ],
Elliott Hughes73635992021-04-22 13:39:54 -0700233 header_libs: ["libgtest_prod_headers"],
Alex Deymo7a4643f2017-07-10 16:22:31 +0200234 cflags: libbrillo_CFLAGS,
235 export_include_dirs: ["."],
236
237 host_supported: true,
Dan Willemsenf6035ae2018-10-23 13:45:43 -0700238 recovery_available: true,
Alex Deymo7a4643f2017-07-10 16:22:31 +0200239 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 ],
Elliott Hughes73635992021-04-22 13:39:54 -0700259 header_libs: ["libgtest_prod_headers"],
Alex Deymo7a4643f2017-07-10 16:22:31 +0200260 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,
Elliott Hughes73635992021-04-22 13:39:54 -0700280 header_libs: ["libgtest_prod_headers"],
Alex Deymo7a4643f2017-07-10 16:22:31 +0200281 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,
Christopher Ferrisa53a1862018-08-22 19:35:37 -0700312 isolated: true,
Alex Deymo7a4643f2017-07-10 16:22:31 +0200313 static_libs: [
314 "libgtest",
315 "libchrome_test_helpers",
316 "libbrillo-test-helpers",
317 "libgmock",
Alex Deymo7a4643f2017-07-10 16:22:31 +0200318 ],
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}