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 | |
Vinh Tran | 61e69fa | 2022-06-14 16:45:19 -0400 | [diff] [blame] | 24 | tool_files: [ |
| 25 | ":libprotobuf-internal-protos", |
| 26 | ], |
| 27 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 28 | cmd: "mkdir -p $(genDir)/$(in) " + |
| 29 | "&& $(location aprotoc) " + |
| 30 | " --plugin=$(location protoc-gen-javastream) " + |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 38 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 39 | ":ipconnectivity-proto-src", |
| 40 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 41 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 42 | ":libtombstone_proto-src", |
| 43 | "core/proto/**/*.proto", |
| 44 | "libs/incident/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 45 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 46 | ], |
| 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 | |
Vinh Tran | 61e69fa | 2022-06-14 16:45:19 -0400 | [diff] [blame] | 58 | tool_files: [ |
| 59 | ":libprotobuf-internal-protos", |
| 60 | ], |
| 61 | |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 62 | cmd: "mkdir -p $(genDir) " + |
| 63 | "&& $(location aprotoc) " + |
| 64 | " --plugin=$(location protoc-gen-cppstream) " + |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 65 | " --cppstream_out=$(genDir) " + |
| 66 | " -Iexternal/protobuf/src " + |
| 67 | " -I . " + |
| 68 | " $(in)", |
| 69 | |
| 70 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 71 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 72 | ":ipconnectivity-proto-src", |
| 73 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 74 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 75 | "core/proto/**/*.proto", |
| 76 | "libs/incident/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 77 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 78 | ], |
| 79 | |
| 80 | output_extension: "proto.h", |
| 81 | } |
| 82 | |
| 83 | // ==== java proto host library ============================== |
| 84 | java_library_host { |
| 85 | name: "platformprotos", |
| 86 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 87 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 88 | ":ipconnectivity-proto-src", |
| 89 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 90 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 91 | ":libstats_internal_protos", |
| 92 | ":statsd_internal_protos", |
| 93 | "cmds/am/proto/instrumentation_data.proto", |
| 94 | "cmds/statsd/src/**/*.proto", |
| 95 | "core/proto/**/*.proto", |
| 96 | "libs/incident/proto/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 97 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 98 | ], |
| 99 | proto: { |
| 100 | include_dirs: [ |
| 101 | "external/protobuf/src", |
| 102 | "frameworks/proto_logging/stats", |
| 103 | ], |
| 104 | type: "full", |
| 105 | }, |
| 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: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 127 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 128 | ":ipconnectivity-proto-src", |
| 129 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 130 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 131 | "core/proto/**/*.proto", |
| 132 | "libs/incident/proto/android/os/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 133 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 134 | ], |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 135 | // Protos have lots of MissingOverride and similar. |
| 136 | errorprone: { |
| 137 | enabled: false, |
| 138 | }, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | // ==== java proto device library (for test only) ============================== |
| 142 | java_library { |
| 143 | name: "platformprotoslite", |
| 144 | proto: { |
| 145 | type: "lite", |
| 146 | include_dirs: ["external/protobuf/src"], |
| 147 | }, |
| 148 | |
| 149 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 150 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 151 | ":ipconnectivity-proto-src", |
| 152 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 153 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 154 | "core/proto/**/*.proto", |
| 155 | "libs/incident/proto/android/os/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 156 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 157 | ], |
| 158 | exclude_srcs: [ |
| 159 | "core/proto/android/privacy.proto", |
| 160 | "core/proto/android/section.proto", |
| 161 | "core/proto/android/typedef.proto", |
| 162 | ], |
| 163 | sdk_version: "core_current", |
| 164 | // Protos have lots of MissingOverride and similar. |
| 165 | errorprone: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 166 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 167 | }, |
| 168 | } |
| 169 | |
| 170 | // ==== c++ proto device library ============================== |
| 171 | cc_defaults { |
| 172 | name: "libplatformprotos-defaults", |
| 173 | |
| 174 | proto: { |
| 175 | export_proto_headers: true, |
| 176 | include_dirs: [ |
| 177 | "external/protobuf/src", |
| 178 | ], |
| 179 | }, |
| 180 | |
| 181 | cflags: [ |
| 182 | "-Wall", |
| 183 | "-Werror", |
| 184 | "-Wno-unused-parameter", |
| 185 | ], |
| 186 | |
| 187 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 188 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 189 | ":ipconnectivity-proto-src", |
| 190 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 191 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 192 | "core/proto/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 193 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 194 | ], |
| 195 | } |
| 196 | |
| 197 | cc_library { |
| 198 | name: "libplatformprotos", |
| 199 | defaults: ["libplatformprotos-defaults"], |
| 200 | host_supported: true, |
| 201 | |
| 202 | target: { |
| 203 | host: { |
| 204 | proto: { |
| 205 | type: "full", |
| 206 | }, |
| 207 | }, |
| 208 | android: { |
| 209 | proto: { |
| 210 | type: "lite", |
| 211 | }, |
| 212 | shared_libs: [ |
| 213 | "libprotobuf-cpp-lite", |
| 214 | ], |
| 215 | shared: { |
| 216 | enabled: false, |
| 217 | }, |
| 218 | }, |
| 219 | }, |
| 220 | } |
| 221 | |
| 222 | // This library is meant for vendor code that needs to output protobuf. It links |
| 223 | // against the static version of libprotobuf-cpp-lite, for which we can not guarantee |
| 224 | // binary compatibility. |
| 225 | cc_library { |
| 226 | name: "libplatformprotos-static", |
| 227 | defaults: ["libplatformprotos-defaults"], |
| 228 | host_supported: false, |
| 229 | |
| 230 | // This is okay because this library is only built as a static library. The C++ |
| 231 | // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council, |
| 232 | // but is not authorized to be used outside of debugging. |
| 233 | vendor_available: true, |
| 234 | |
| 235 | target: { |
| 236 | android: { |
| 237 | proto: { |
| 238 | type: "lite", |
| 239 | }, |
| 240 | static_libs: [ |
| 241 | "libprotobuf-cpp-lite", |
| 242 | ], |
| 243 | shared: { |
| 244 | enabled: false, |
| 245 | }, |
| 246 | }, |
| 247 | }, |
| 248 | } |
| 249 | |
| 250 | // This is the full proto version of libplatformprotos. It may only |
| 251 | // be used by test code that is not shipped on the device. |
| 252 | cc_library { |
| 253 | name: "libplatformprotos-test", |
| 254 | defaults: ["libplatformprotos-defaults"], |
| 255 | host_supported: false, |
| 256 | |
| 257 | target: { |
| 258 | android: { |
| 259 | proto: { |
| 260 | type: "full", |
| 261 | }, |
| 262 | shared: { |
| 263 | enabled: false, |
| 264 | }, |
| 265 | }, |
| 266 | }, |
| 267 | } |