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