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