Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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 | |
| 15 | gensrcs { |
| 16 | name: "framework-javastream-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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) " + |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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: [ |
Dennis Shen | df53105 | 2024-05-15 18:16:44 +0000 | [diff] [blame] | 34 | ":aconfigd_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 35 | ":ipconnectivity-proto-src", |
| 36 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 37 | ":libstats_atom_message_protos", |
Siim Sammul | 59082d5 | 2024-01-18 15:40:24 +0000 | [diff] [blame] | 38 | ":libtombstone_proto-src", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 39 | "core/proto/**/*.proto", |
| 40 | "libs/incident/**/*.proto", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 41 | ], |
Liz Kammer | 2934d29 | 2023-06-09 14:04:26 -0400 | [diff] [blame] | 42 | |
| 43 | data: [ |
| 44 | ":libprotobuf-internal-protos", |
| 45 | ], |
| 46 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 47 | output_extension: "srcjar", |
| 48 | } |
| 49 | |
| 50 | gensrcs { |
| 51 | name: "framework-cppstream-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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) " + |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 61 | " --cppstream_out=$(genDir) " + |
| 62 | " -Iexternal/protobuf/src " + |
| 63 | " -I . " + |
| 64 | " $(in)", |
| 65 | |
| 66 | srcs: [ |
| 67 | ":ipconnectivity-proto-src", |
| 68 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 69 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 70 | "core/proto/**/*.proto", |
| 71 | "libs/incident/**/*.proto", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 72 | ], |
| 73 | |
Liz Kammer | 2934d29 | 2023-06-09 14:04:26 -0400 | [diff] [blame] | 74 | data: [ |
| 75 | ":libprotobuf-internal-protos", |
| 76 | ], |
| 77 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 78 | output_extension: "proto.h", |
| 79 | } |
| 80 | |
Roshan Pius | d1ad8ca | 2023-10-20 14:02:38 +0000 | [diff] [blame] | 81 | // ==== nfc framework java library ============================== |
| 82 | gensrcs { |
| 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 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 117 | // ==== java proto host library ============================== |
| 118 | java_library_host { |
| 119 | name: "platformprotos", |
| 120 | srcs: [ |
| 121 | ":ipconnectivity-proto-src", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 128 | ], |
| 129 | proto: { |
| 130 | include_dirs: [ |
| 131 | "external/protobuf/src", |
| 132 | "frameworks/proto_logging/stats", |
| 133 | ], |
| 134 | type: "full", |
| 135 | }, |
Sorin Basca | 1f887e1 | 2023-02-04 15:56:22 +0000 | [diff] [blame] | 136 | // b/267831518: Pin tradefed and dependencies to Java 11. |
| 137 | java_version: "11", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 138 | // Protos have lots of MissingOverride and similar. |
| 139 | errorprone: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 140 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 141 | }, |
| 142 | } |
| 143 | |
| 144 | // ==== java proto device library (for test only) ============================== |
| 145 | java_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", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 161 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 162 | "core/proto/**/*.proto", |
| 163 | "libs/incident/proto/android/os/**/*.proto", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 164 | ], |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 165 | // Protos have lots of MissingOverride and similar. |
| 166 | errorprone: { |
| 167 | enabled: false, |
| 168 | }, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | // ==== java proto device library (for test only) ============================== |
| 172 | java_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", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 182 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 183 | "core/proto/**/*.proto", |
| 184 | "libs/incident/proto/android/os/**/*.proto", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 194 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 195 | }, |
| 196 | } |
| 197 | |
| 198 | // ==== c++ proto device library ============================== |
| 199 | cc_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", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 218 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 219 | "core/proto/**/*.proto", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 220 | ], |
| 221 | } |
| 222 | |
| 223 | cc_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. |
| 251 | cc_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. |
| 278 | cc_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 | } |