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