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