• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2008 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
15cc_library_headers {
16    name: "libutils_headers",
17    vendor_available: true,
18    recovery_available: true,
19    host_supported: true,
20    native_bridge_supported: true,
21    apex_available: [
22        "//apex_available:platform",
23        "//apex_available:anyapex",
24    ],
25    min_sdk_version: "apex_inherit",
26
27    header_libs: [
28        "liblog_headers",
29        "libsystem_headers",
30        "libcutils_headers",
31        "libprocessgroup_headers",
32    ],
33    export_header_lib_headers: [
34        "liblog_headers",
35        "libsystem_headers",
36        "libcutils_headers",
37        "libprocessgroup_headers",
38    ],
39    export_include_dirs: ["include"],
40
41    target: {
42        android: {
43            header_libs: ["libbacktrace_headers"],
44            export_header_lib_headers: ["libbacktrace_headers"],
45        },
46        linux_bionic: {
47            enabled: true,
48        },
49        windows: {
50            enabled: true,
51        },
52    },
53}
54
55cc_defaults {
56    name: "libutils_defaults",
57    vendor_available: true,
58    recovery_available: true,
59    vndk: {
60        enabled: true,
61        support_system_process: true,
62    },
63    host_supported: true,
64
65    cflags: [
66        "-Wall",
67        "-Werror",
68    ],
69    header_libs: [
70        "libbase_headers",
71        "libutils_headers",
72    ],
73    export_header_lib_headers: [
74        "libutils_headers",
75    ],
76
77    shared_libs: [
78        "libcutils",
79        "liblog",
80    ],
81
82    arch: {
83        mips: {
84            cflags: ["-DALIGN_DOUBLE"],
85        },
86    },
87
88    target: {
89        android: {
90            cflags: ["-fvisibility=protected"],
91
92            shared_libs: [
93                "libprocessgroup",
94                "libdl",
95                "libvndksupport",
96            ],
97
98            sanitize: {
99                misc_undefined: ["integer"],
100            },
101        },
102
103        recovery: {
104            exclude_shared_libs: ["libvndksupport"],
105        },
106
107        linux_bionic: {
108            enabled: true,
109        },
110
111        darwin: {
112            cflags: ["-Wno-unused-parameter"],
113        },
114
115        windows: {
116            cflags: [
117                // Under MinGW, ctype.h doesn't need multi-byte support
118                "-DMB_CUR_MAX=1",
119                "-Wno-unused-private-field",
120            ],
121
122            enabled: true,
123        },
124    },
125}
126
127cc_library {
128    name: "libutils",
129    defaults: ["libutils_defaults"],
130    native_bridge_supported: true,
131
132    srcs: [
133        "Errors.cpp",
134        "FileMap.cpp",
135        "JenkinsHash.cpp",
136        "NativeHandle.cpp",
137        "Printer.cpp",
138        "PropertyMap.cpp",
139        "RefBase.cpp",
140        "SharedBuffer.cpp",
141        "StopWatch.cpp",
142        "String8.cpp",
143        "String16.cpp",
144        "StrongPointer.cpp",
145        "SystemClock.cpp",
146        "Threads.cpp",
147        "Timers.cpp",
148        "Tokenizer.cpp",
149        "Unicode.cpp",
150        "VectorImpl.cpp",
151        "misc.cpp",
152    ],
153
154    target: {
155        android: {
156            srcs: [
157                "Trace.cpp",
158            ],
159        },
160        linux: {
161            header_libs: ["libbase_headers"],
162            srcs: [
163                "Looper.cpp",
164            ],
165        },
166    },
167
168    apex_available: [
169        "//apex_available:anyapex",
170        "//apex_available:platform",
171    ],
172    min_sdk_version: "apex_inherit",
173}
174
175cc_library {
176    name: "libutilscallstack",
177    defaults: ["libutils_defaults"],
178    // TODO(b/153609531): remove when no longer needed.
179    native_bridge_supported: true,
180
181    srcs: [
182        "CallStack.cpp",
183    ],
184
185    arch: {
186        mips: {
187            cflags: ["-DALIGN_DOUBLE"],
188        },
189    },
190
191    shared_libs: [
192         "libutils",
193         "libbacktrace",
194    ],
195
196    target: {
197        linux: {
198            srcs: [
199                "ProcessCallStack.cpp",
200            ],
201        },
202        darwin: {
203            enabled: false,
204        },
205        windows: {
206            enabled: false,
207        },
208    },
209}
210
211cc_test {
212    name: "libutils_test",
213    host_supported: true,
214
215    srcs: [
216        "BitSet_test.cpp",
217        "FileMap_test.cpp",
218        "LruCache_test.cpp",
219        "Mutex_test.cpp",
220        "SharedBuffer_test.cpp",
221        "String8_test.cpp",
222        "String16_test.cpp",
223        "StrongPointer_test.cpp",
224        "Unicode_test.cpp",
225        "Vector_test.cpp",
226    ],
227
228    target: {
229        android: {
230            srcs: [
231                "SystemClock_test.cpp",
232            ],
233            shared_libs: [
234                "libz",
235                "liblog",
236                "libcutils",
237                "libutils",
238                "libbase",
239            ],
240        },
241        linux: {
242            srcs: [
243                "Looper_test.cpp",
244                "RefBase_test.cpp",
245            ],
246        },
247        host: {
248            static_libs: [
249                "libutils",
250                "liblog",
251                "libbase",
252            ],
253        },
254    },
255
256    cflags: [
257        "-Wall",
258        "-Wextra",
259        "-Werror",
260        "-Wthread-safety",
261    ],
262
263    test_suites: ["device-tests"],
264}
265
266// TODO: the test infrastructure isn't yet capable of running this,
267// so it's broken out into its own test so that the main libutils_tests
268// can be in presubmit even if this can't.
269
270cc_test {
271    name: "libutils_singleton_test",
272    srcs: ["Singleton_test.cpp"],
273    cflags: [
274        "-Wall",
275        "-Werror",
276    ],
277    shared_libs: ["libbase"],
278
279    required: [
280        ":libutils_test_singleton1",
281        ":libutils_test_singleton2",
282    ],
283}
284
285cc_test_library {
286    name: "libutils_test_singleton1",
287    host_supported: true,
288    relative_install_path: "libutils_test",
289    srcs: ["Singleton_test1.cpp"],
290    cflags: [
291        "-Wall",
292        "-Werror",
293    ],
294}
295
296cc_test_library {
297    name: "libutils_test_singleton2",
298    host_supported: true,
299    relative_install_path: "libutils_test",
300    srcs: ["Singleton_test2.cpp"],
301    cflags: [
302        "-Wall",
303        "-Werror",
304    ],
305    shared_libs: ["libutils_test_singleton1"],
306}
307
308cc_benchmark {
309    name: "libutils_benchmark",
310    srcs: ["Vector_benchmark.cpp"],
311    shared_libs: ["libutils"],
312}
313