1// 2// Copyright (C) 2019 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 register a pull atom callback with statsd 19// ========================================================== 20package { 21 default_applicable_licenses: ["Android-Apache-2.0"], 22 default_team: "trendy_team_android_telemetry_client_infra", 23} 24 25cc_defaults { 26 name: "libstatspull_defaults", 27 srcs: [ 28 "stats_subscription.cpp", 29 "stats_provider.cpp", 30 "stats_pull_atom_callback.cpp", 31 ], 32 cflags: [ 33 "-Wall", 34 "-Werror", 35 "-Wthread-safety", 36 ], 37 export_include_dirs: ["include"], 38 shared_libs: [ 39 "libbinder_ndk", 40 "liblog", 41 "libstatssocket#impl", 42 ], 43 static_libs: [ 44 "libutils", 45 "statsd-aidl-ndk", 46 ], 47} 48 49cc_library_shared { 50 name: "libstatspull", 51 defaults: [ 52 "libstatspull_defaults", 53 ], 54 host_supported: true, 55 target: { 56 darwin: { 57 enabled: false, 58 }, 59 }, 60 // enumerate stable entry points for APEX use 61 version_script: "libstatspull.map.txt", 62 stubs: { 63 symbol_file: "libstatspull.map.txt", 64 versions: [ 65 "30", 66 ], 67 }, 68 apex_available: [ 69 "com.android.os.statsd", 70 "test_com.android.os.statsd", 71 ], 72 min_sdk_version: "30", 73 static_libs: [ 74 "statsd_flags_c_lib", 75 ], 76 stl: "libc++_static", 77} 78 79cc_library_headers { 80 name: "libstatspull_headers", 81 export_include_dirs: ["include"], 82} 83 84filegroup { 85 name: "libstatspull_test_default_map", 86 srcs: ["libstatspull_test_default.map"], 87} 88 89// Note: These unit tests only test PullAtomMetadata and subscriptions 90// For full E2E tests of pullers, use LibStatsPullTests 91cc_test { 92 name: "libstatspull_test", 93 srcs: [ 94 ":libprotobuf-internal-descriptor-proto", 95 ":libstats_log_protos", 96 ":libstats_subscription_protos", 97 "tests/pull_atom_metadata_test.cpp", 98 "tests/stats_subscription_test.cpp", 99 ], 100 proto: { 101 type: "lite", 102 include_dirs: [ 103 "external/protobuf/src", 104 ], 105 static: true, 106 }, 107 shared_libs: [ 108 "libstatspull", 109 "libstatssocket", 110 "libbinder", 111 "libutils", 112 "liblog", 113 ], 114 static_libs: [ 115 "libbase", 116 "libgmock", 117 "libstatsgtestmatchers", 118 "libstatslog_statsdtest", 119 "libprotobuf-cpp-lite", 120 ], 121 test_suites: [ 122 "general-tests", 123 "mts-statsd", 124 ], 125 test_config: "libstatspull_test.xml", 126 127 // This test runs on older platform versions, so many libraries (such as libbase and libc++) 128 // need to be linked statically. The test also needs to be linked with a version script to 129 // ensure that the statically-linked library isn't exported from the executable, where it 130 // would override the shared libraries that the platform itself uses. 131 // See http://b/333438055 for an example of what goes wrong when libc++ is partially exported 132 // from an executable. 133 version_script: ":libstatspull_test_default_map", 134 stl: "libc++_static", 135 136 //TODO(b/153588990): Remove when the build system properly separates 137 //32bit and 64bit architectures. 138 compile_multilib: "both", 139 multilib: { 140 lib64: { 141 suffix: "64", 142 }, 143 lib32: { 144 suffix: "32", 145 }, 146 }, 147 cflags: [ 148 "-Wall", 149 "-Werror", 150 "-Wno-missing-field-initializers", 151 "-Wno-unused-variable", 152 "-Wno-unused-function", 153 "-Wno-unused-parameter", 154 "-Wno-deprecated-declarations", 155 "-Wthread-safety", 156 ], 157 require_root: true, 158 min_sdk_version: "30", 159} 160