Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2018 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | // ========================================================================= |
| 18 | // Native library to write stats log to statsd socket on Android R and later |
| 19 | // ========================================================================= |
Tej Singh | d78f4da | 2020-01-29 15:56:52 -0800 | [diff] [blame] | 20 | cc_defaults { |
| 21 | name: "libstatssocket_defaults", |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 22 | srcs: [ |
Muhammad Qureshi | 962cc23 | 2019-11-06 15:15:23 -0800 | [diff] [blame] | 23 | "stats_buffer_writer.c", |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 24 | "stats_event.c", |
Muhammad Qureshi | 2ebc2e3 | 2020-02-11 14:12:59 -0800 | [diff] [blame] | 25 | "stats_socket.c", |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 26 | "statsd_writer.c", |
| 27 | ], |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 28 | export_include_dirs: ["include"], |
Ruchir Rastogi | e1cff24 | 2020-02-14 12:03:35 -0800 | [diff] [blame] | 29 | static_libs: [ |
| 30 | "libcutils", // does not expose a stable C API |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 31 | ], |
Tom Cherry | 3d8b739 | 2020-09-16 11:32:47 -0700 | [diff] [blame] | 32 | header_libs: ["liblog_headers"], |
Tej Singh | d78f4da | 2020-01-29 15:56:52 -0800 | [diff] [blame] | 33 | cflags: [ |
| 34 | "-Wall", |
| 35 | "-Werror", |
| 36 | ], |
| 37 | } |
| 38 | |
| 39 | cc_library { |
| 40 | name: "libstatssocket", |
| 41 | defaults: [ |
| 42 | "libstatssocket_defaults", |
| 43 | ], |
| 44 | host_supported: true, |
| 45 | target: { |
| 46 | // On android, libstatssocket should only be linked as a shared lib |
| 47 | android: { |
| 48 | static: { |
| 49 | enabled: false, |
| 50 | }, |
| 51 | }, |
| 52 | host: { |
| 53 | shared: { |
| 54 | enabled: false, |
| 55 | }, |
| 56 | }, |
| 57 | }, |
Tej Singh | 5d8f770 | 2020-04-06 15:01:41 -0700 | [diff] [blame] | 58 | stl: "libc++_static", |
Ruchir Rastogi | 5dbcae5 | 2019-12-19 15:44:58 -0800 | [diff] [blame] | 59 | |
| 60 | // enumerate stable entry points for APEX use |
| 61 | stubs: { |
| 62 | symbol_file: "libstatssocket.map.txt", |
| 63 | versions: [ |
Tej Singh | a8fd39d | 2020-01-14 13:46:27 -0800 | [diff] [blame] | 64 | "30", |
Ruchir Rastogi | 5dbcae5 | 2019-12-19 15:44:58 -0800 | [diff] [blame] | 65 | ], |
Jeffrey Huang | b0a85dc | 2020-02-12 14:22:01 -0800 | [diff] [blame] | 66 | }, |
| 67 | apex_available: [ |
Muhammad Qureshi | 3a40ee5 | 2020-02-18 16:52:22 -0800 | [diff] [blame] | 68 | "com.android.os.statsd", |
| 69 | "test_com.android.os.statsd", |
Jeffrey Huang | b0a85dc | 2020-02-12 14:22:01 -0800 | [diff] [blame] | 70 | ], |
Muhammad Qureshi | a3dcefc | 2019-12-02 20:27:46 -0800 | [diff] [blame] | 71 | } |
Ruchir Rastogi | 926fa88 | 2019-12-10 18:46:23 -0800 | [diff] [blame] | 72 | |
Tej Singh | d78f4da | 2020-01-29 15:56:52 -0800 | [diff] [blame] | 73 | //TODO (b/149842105): Figure out if there is a better solution for this. |
| 74 | cc_test_library { |
| 75 | name: "libstatssocket_private", |
| 76 | defaults: [ |
| 77 | "libstatssocket_defaults", |
| 78 | ], |
| 79 | visibility: [ |
| 80 | "//frameworks/base/apex/statsd/tests/libstatspull", |
| 81 | "//frameworks/base/cmds/statsd", |
| 82 | ], |
| 83 | } |
| 84 | |
Ruchir Rastogi | 926fa88 | 2019-12-10 18:46:23 -0800 | [diff] [blame] | 85 | cc_library_headers { |
| 86 | name: "libstatssocket_headers", |
| 87 | export_include_dirs: ["include"], |
| 88 | host_supported: true, |
Jiyong Park | a6bcd48 | 2020-04-08 23:40:03 +0900 | [diff] [blame] | 89 | apex_available: ["com.android.resolv"], |
Jooyung Han | f2d4dc6 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 90 | min_sdk_version: "29", |
Ruchir Rastogi | 926fa88 | 2019-12-10 18:46:23 -0800 | [diff] [blame] | 91 | } |
Ruchir Rastogi | 79dd3ea | 2019-12-12 17:16:59 -0800 | [diff] [blame] | 92 | |
Ruchir Rastogi | 21c1f9c | 2020-01-07 09:36:04 -0800 | [diff] [blame] | 93 | cc_test { |
| 94 | name: "libstatssocket_test", |
Jeffrey Huang | 6cc1d41 | 2020-04-24 12:01:44 -0700 | [diff] [blame] | 95 | srcs: [ |
| 96 | "tests/stats_event_test.cpp", |
| 97 | "tests/stats_writer_test.cpp", |
| 98 | ], |
Ruchir Rastogi | 21c1f9c | 2020-01-07 09:36:04 -0800 | [diff] [blame] | 99 | cflags: [ |
| 100 | "-Wall", |
| 101 | "-Werror", |
| 102 | ], |
| 103 | static_libs: [ |
| 104 | "libgmock", |
Tej Singh | d78f4da | 2020-01-29 15:56:52 -0800 | [diff] [blame] | 105 | "libstatssocket_private", |
Ruchir Rastogi | 21c1f9c | 2020-01-07 09:36:04 -0800 | [diff] [blame] | 106 | ], |
| 107 | shared_libs: [ |
| 108 | "libcutils", |
Ruchir Rastogi | 21c1f9c | 2020-01-07 09:36:04 -0800 | [diff] [blame] | 109 | "libutils", |
| 110 | ], |
Jeffrey Huang | 2f51ad7 | 2020-04-22 17:09:30 -0700 | [diff] [blame] | 111 | test_suites: ["device-tests", "mts"], |
Chen Zhu | c724fb6 | 2020-05-20 13:06:24 -0700 | [diff] [blame] | 112 | test_config: "libstatssocket_test.xml", |
Ruchir Rastogi | f2a5ed0 | 2020-06-10 20:43:53 -0700 | [diff] [blame] | 113 | //TODO(b/153588990): Remove when the build system properly separates. |
Jeffrey Huang | 2f51ad7 | 2020-04-22 17:09:30 -0700 | [diff] [blame] | 114 | //32bit and 64bit architectures. |
| 115 | compile_multilib: "both", |
| 116 | multilib: { |
| 117 | lib64: { |
| 118 | suffix: "64", |
Chen Zhu | c724fb6 | 2020-05-20 13:06:24 -0700 | [diff] [blame] | 119 | }, |
| 120 | lib32: { |
| 121 | suffix: "32", |
| 122 | }, |
Jeffrey Huang | 2f51ad7 | 2020-04-22 17:09:30 -0700 | [diff] [blame] | 123 | }, |
Jeffrey Huang | 18d239c | 2020-04-24 10:43:08 -0700 | [diff] [blame] | 124 | require_root: true, |
Ruchir Rastogi | 21c1f9c | 2020-01-07 09:36:04 -0800 | [diff] [blame] | 125 | } |