1// Copyright (C) 2021 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 15gensrcs { 16 name: "framework-javastream-protos", 17 18 tools: [ 19 "aprotoc", 20 "protoc-gen-javastream", 21 "soong_zip", 22 ], 23 24 cmd: "mkdir -p $(genDir)/$(in) " + 25 "&& $(location aprotoc) " + 26 " --plugin=$(location protoc-gen-javastream) " + 27 " --javastream_out=$(genDir)/$(in) " + 28 " -Iexternal/protobuf/src " + 29 " -I . " + 30 " $(in) " + 31 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)", 32 33 srcs: [ 34 ":aconfigd_protos", 35 ":ipconnectivity-proto-src", 36 ":libstats_atom_enum_protos", 37 ":libstats_atom_message_protos", 38 ":libtombstone_proto-src", 39 "core/proto/**/*.proto", 40 "libs/incident/**/*.proto", 41 ], 42 43 data: [ 44 ":libprotobuf-internal-protos", 45 ], 46 47 output_extension: "srcjar", 48} 49 50gensrcs { 51 name: "framework-cppstream-protos", 52 53 tools: [ 54 "aprotoc", 55 "protoc-gen-cppstream", 56 ], 57 58 cmd: "mkdir -p $(genDir) " + 59 "&& $(location aprotoc) " + 60 " --plugin=$(location protoc-gen-cppstream) " + 61 " --cppstream_out=$(genDir) " + 62 " -Iexternal/protobuf/src " + 63 " -I . " + 64 " $(in)", 65 66 srcs: [ 67 ":ipconnectivity-proto-src", 68 ":libstats_atom_enum_protos", 69 ":libstats_atom_message_protos", 70 "core/proto/**/*.proto", 71 "libs/incident/**/*.proto", 72 ], 73 74 data: [ 75 ":libprotobuf-internal-protos", 76 ], 77 78 output_extension: "proto.h", 79} 80 81// ==== nfc framework java library ============================== 82gensrcs { 83 name: "framework-nfc-javastream-protos", 84 85 tools: [ 86 "aprotoc", 87 "protoc-gen-javastream", 88 "soong_zip", 89 ], 90 91 cmd: "mkdir -p $(genDir)/$(in) " + 92 "&& $(location aprotoc) " + 93 " --plugin=$(location protoc-gen-javastream) " + 94 " --javastream_out=$(genDir)/$(in) " + 95 " -Iexternal/protobuf/src " + 96 " -I . " + 97 " $(in) " + 98 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)", 99 100 srcs: [ 101 "core/proto/android/app/pendingintent.proto", 102 "core/proto/android/content/component_name.proto", 103 "core/proto/android/content/intent.proto", 104 "core/proto/android/nfc/*.proto", 105 "core/proto/android/os/patternmatcher.proto", 106 "core/proto/android/os/persistablebundle.proto", 107 "core/proto/android/privacy.proto", 108 ], 109 110 data: [ 111 ":libprotobuf-internal-protos", 112 ], 113 114 output_extension: "srcjar", 115} 116 117// ==== java proto host library ============================== 118java_library_host { 119 name: "platformprotos", 120 srcs: [ 121 ":ipconnectivity-proto-src", 122 ":libstats_internal_protos", 123 ":statsd_internal_protos", 124 "cmds/am/proto/instrumentation_data.proto", 125 "cmds/statsd/src/**/*.proto", 126 "core/proto/**/*.proto", 127 "libs/incident/proto/**/*.proto", 128 ], 129 proto: { 130 include_dirs: [ 131 "external/protobuf/src", 132 "frameworks/proto_logging/stats", 133 ], 134 type: "full", 135 }, 136 // b/267831518: Pin tradefed and dependencies to Java 11. 137 java_version: "11", 138 // Protos have lots of MissingOverride and similar. 139 errorprone: { 140 enabled: false, 141 }, 142} 143 144// ==== java proto device library (for test only) ============================== 145java_library { 146 name: "platformprotosnano", 147 proto: { 148 type: "nano", 149 output_params: ["store_unknown_fields=true"], 150 include_dirs: ["external/protobuf/src"], 151 }, 152 exclude_srcs: [ 153 "core/proto/android/privacy.proto", 154 "core/proto/android/section.proto", 155 "core/proto/android/typedef.proto", 156 ], 157 sdk_version: "9", 158 srcs: [ 159 ":ipconnectivity-proto-src", 160 ":libstats_atom_enum_protos", 161 ":libstats_atom_message_protos", 162 "core/proto/**/*.proto", 163 "libs/incident/proto/android/os/**/*.proto", 164 ], 165 // Protos have lots of MissingOverride and similar. 166 errorprone: { 167 enabled: false, 168 }, 169} 170 171// ==== java proto device library (for test only) ============================== 172java_library { 173 name: "platformprotoslite", 174 proto: { 175 type: "lite", 176 include_dirs: ["external/protobuf/src"], 177 }, 178 179 srcs: [ 180 ":ipconnectivity-proto-src", 181 ":libstats_atom_enum_protos", 182 ":libstats_atom_message_protos", 183 "core/proto/**/*.proto", 184 "libs/incident/proto/android/os/**/*.proto", 185 ], 186 exclude_srcs: [ 187 "core/proto/android/privacy.proto", 188 "core/proto/android/section.proto", 189 "core/proto/android/typedef.proto", 190 ], 191 sdk_version: "core_current", 192 // Protos have lots of MissingOverride and similar. 193 errorprone: { 194 enabled: false, 195 }, 196} 197 198// ==== c++ proto device library ============================== 199cc_defaults { 200 name: "libplatformprotos-defaults", 201 202 proto: { 203 export_proto_headers: true, 204 include_dirs: [ 205 "external/protobuf/src", 206 ], 207 }, 208 209 cflags: [ 210 "-Wall", 211 "-Werror", 212 "-Wno-unused-parameter", 213 ], 214 215 srcs: [ 216 ":ipconnectivity-proto-src", 217 ":libstats_atom_enum_protos", 218 ":libstats_atom_message_protos", 219 "core/proto/**/*.proto", 220 ], 221} 222 223cc_library { 224 name: "libplatformprotos", 225 defaults: ["libplatformprotos-defaults"], 226 host_supported: true, 227 228 target: { 229 host: { 230 proto: { 231 type: "full", 232 }, 233 }, 234 android: { 235 proto: { 236 type: "lite", 237 }, 238 shared_libs: [ 239 "libprotobuf-cpp-lite", 240 ], 241 shared: { 242 enabled: false, 243 }, 244 }, 245 }, 246} 247 248// This library is meant for vendor code that needs to output protobuf. It links 249// against the static version of libprotobuf-cpp-lite, for which we can not guarantee 250// binary compatibility. 251cc_library { 252 name: "libplatformprotos-static", 253 defaults: ["libplatformprotos-defaults"], 254 host_supported: false, 255 256 // This is okay because this library is only built as a static library. The C++ 257 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council, 258 // but is not authorized to be used outside of debugging. 259 vendor_available: true, 260 261 target: { 262 android: { 263 proto: { 264 type: "lite", 265 }, 266 static_libs: [ 267 "libprotobuf-cpp-lite", 268 ], 269 shared: { 270 enabled: false, 271 }, 272 }, 273 }, 274} 275 276// This is the full proto version of libplatformprotos. It may only 277// be used by test code that is not shipped on the device. 278cc_library { 279 name: "libplatformprotos-test", 280 defaults: ["libplatformprotos-defaults"], 281 host_supported: false, 282 283 target: { 284 android: { 285 proto: { 286 type: "full", 287 }, 288 shared: { 289 enabled: false, 290 }, 291 }, 292 }, 293} 294