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 | ":libtombstone_proto-src", |
| 38 | "core/proto/**/*.proto", |
| 39 | "libs/incident/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 40 | ":service-permission-streaming-proto-sources", |
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", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 72 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 73 | ], |
| 74 | |
Liz Kammer | 2934d29 | 2023-06-09 14:04:26 -0400 | [diff] [blame^] | 75 | data: [ |
| 76 | ":libprotobuf-internal-protos", |
| 77 | ], |
| 78 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 79 | output_extension: "proto.h", |
| 80 | } |
| 81 | |
| 82 | // ==== java proto host library ============================== |
| 83 | java_library_host { |
| 84 | name: "platformprotos", |
| 85 | srcs: [ |
| 86 | ":ipconnectivity-proto-src", |
| 87 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 88 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 89 | ":libstats_internal_protos", |
| 90 | ":statsd_internal_protos", |
| 91 | "cmds/am/proto/instrumentation_data.proto", |
| 92 | "cmds/statsd/src/**/*.proto", |
| 93 | "core/proto/**/*.proto", |
| 94 | "libs/incident/proto/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 95 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 96 | ], |
| 97 | proto: { |
| 98 | include_dirs: [ |
| 99 | "external/protobuf/src", |
| 100 | "frameworks/proto_logging/stats", |
| 101 | ], |
| 102 | type: "full", |
| 103 | }, |
Sorin Basca | 1f887e1 | 2023-02-04 15:56:22 +0000 | [diff] [blame] | 104 | // b/267831518: Pin tradefed and dependencies to Java 11. |
| 105 | java_version: "11", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 106 | // Protos have lots of MissingOverride and similar. |
| 107 | errorprone: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 108 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 109 | }, |
| 110 | } |
| 111 | |
| 112 | // ==== java proto device library (for test only) ============================== |
| 113 | java_library { |
| 114 | name: "platformprotosnano", |
| 115 | proto: { |
| 116 | type: "nano", |
| 117 | output_params: ["store_unknown_fields=true"], |
| 118 | include_dirs: ["external/protobuf/src"], |
| 119 | }, |
| 120 | exclude_srcs: [ |
| 121 | "core/proto/android/privacy.proto", |
| 122 | "core/proto/android/section.proto", |
| 123 | "core/proto/android/typedef.proto", |
| 124 | ], |
| 125 | sdk_version: "9", |
| 126 | srcs: [ |
| 127 | ":ipconnectivity-proto-src", |
| 128 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 129 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 130 | "core/proto/**/*.proto", |
| 131 | "libs/incident/proto/android/os/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 132 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 133 | ], |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 134 | // Protos have lots of MissingOverride and similar. |
| 135 | errorprone: { |
| 136 | enabled: false, |
| 137 | }, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | // ==== java proto device library (for test only) ============================== |
| 141 | java_library { |
| 142 | name: "platformprotoslite", |
| 143 | proto: { |
| 144 | type: "lite", |
| 145 | include_dirs: ["external/protobuf/src"], |
| 146 | }, |
| 147 | |
| 148 | srcs: [ |
| 149 | ":ipconnectivity-proto-src", |
| 150 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 151 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 152 | "core/proto/**/*.proto", |
| 153 | "libs/incident/proto/android/os/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 154 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 155 | ], |
| 156 | exclude_srcs: [ |
| 157 | "core/proto/android/privacy.proto", |
| 158 | "core/proto/android/section.proto", |
| 159 | "core/proto/android/typedef.proto", |
| 160 | ], |
| 161 | sdk_version: "core_current", |
| 162 | // Protos have lots of MissingOverride and similar. |
| 163 | errorprone: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 164 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 165 | }, |
| 166 | } |
| 167 | |
| 168 | // ==== c++ proto device library ============================== |
| 169 | cc_defaults { |
| 170 | name: "libplatformprotos-defaults", |
| 171 | |
| 172 | proto: { |
| 173 | export_proto_headers: true, |
| 174 | include_dirs: [ |
| 175 | "external/protobuf/src", |
| 176 | ], |
| 177 | }, |
| 178 | |
| 179 | cflags: [ |
| 180 | "-Wall", |
| 181 | "-Werror", |
| 182 | "-Wno-unused-parameter", |
| 183 | ], |
| 184 | |
| 185 | srcs: [ |
| 186 | ":ipconnectivity-proto-src", |
| 187 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 188 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 189 | "core/proto/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 190 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 191 | ], |
| 192 | } |
| 193 | |
| 194 | cc_library { |
| 195 | name: "libplatformprotos", |
| 196 | defaults: ["libplatformprotos-defaults"], |
| 197 | host_supported: true, |
| 198 | |
| 199 | target: { |
| 200 | host: { |
| 201 | proto: { |
| 202 | type: "full", |
| 203 | }, |
| 204 | }, |
| 205 | android: { |
| 206 | proto: { |
| 207 | type: "lite", |
| 208 | }, |
| 209 | shared_libs: [ |
| 210 | "libprotobuf-cpp-lite", |
| 211 | ], |
| 212 | shared: { |
| 213 | enabled: false, |
| 214 | }, |
| 215 | }, |
| 216 | }, |
| 217 | } |
| 218 | |
| 219 | // This library is meant for vendor code that needs to output protobuf. It links |
| 220 | // against the static version of libprotobuf-cpp-lite, for which we can not guarantee |
| 221 | // binary compatibility. |
| 222 | cc_library { |
| 223 | name: "libplatformprotos-static", |
| 224 | defaults: ["libplatformprotos-defaults"], |
| 225 | host_supported: false, |
| 226 | |
| 227 | // This is okay because this library is only built as a static library. The C++ |
| 228 | // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council, |
| 229 | // but is not authorized to be used outside of debugging. |
| 230 | vendor_available: true, |
| 231 | |
| 232 | target: { |
| 233 | android: { |
| 234 | proto: { |
| 235 | type: "lite", |
| 236 | }, |
| 237 | static_libs: [ |
| 238 | "libprotobuf-cpp-lite", |
| 239 | ], |
| 240 | shared: { |
| 241 | enabled: false, |
| 242 | }, |
| 243 | }, |
| 244 | }, |
| 245 | } |
| 246 | |
| 247 | // This is the full proto version of libplatformprotos. It may only |
| 248 | // be used by test code that is not shipped on the device. |
| 249 | cc_library { |
| 250 | name: "libplatformprotos-test", |
| 251 | defaults: ["libplatformprotos-defaults"], |
| 252 | host_supported: false, |
| 253 | |
| 254 | target: { |
| 255 | android: { |
| 256 | proto: { |
| 257 | type: "full", |
| 258 | }, |
| 259 | shared: { |
| 260 | enabled: false, |
| 261 | }, |
| 262 | }, |
| 263 | }, |
| 264 | } |