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", |
| 17 | depfile: true, |
| 18 | |
| 19 | tools: [ |
| 20 | "aprotoc", |
| 21 | "protoc-gen-javastream", |
| 22 | "soong_zip", |
| 23 | ], |
| 24 | |
| 25 | cmd: "mkdir -p $(genDir)/$(in) " + |
| 26 | "&& $(location aprotoc) " + |
| 27 | " --plugin=$(location protoc-gen-javastream) " + |
| 28 | " --dependency_out=$(depfile) " + |
| 29 | " --javastream_out=$(genDir)/$(in) " + |
| 30 | " -Iexternal/protobuf/src " + |
| 31 | " -I . " + |
| 32 | " $(in) " + |
| 33 | "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)", |
| 34 | |
| 35 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 36 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 37 | ":ipconnectivity-proto-src", |
| 38 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 39 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 40 | ":libtombstone_proto-src", |
| 41 | "core/proto/**/*.proto", |
| 42 | "libs/incident/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 43 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 44 | ], |
| 45 | output_extension: "srcjar", |
| 46 | } |
| 47 | |
| 48 | gensrcs { |
| 49 | name: "framework-cppstream-protos", |
| 50 | depfile: true, |
| 51 | |
| 52 | tools: [ |
| 53 | "aprotoc", |
| 54 | "protoc-gen-cppstream", |
| 55 | ], |
| 56 | |
| 57 | cmd: "mkdir -p $(genDir) " + |
| 58 | "&& $(location aprotoc) " + |
| 59 | " --plugin=$(location protoc-gen-cppstream) " + |
| 60 | " --dependency_out=$(depfile) " + |
| 61 | " --cppstream_out=$(genDir) " + |
| 62 | " -Iexternal/protobuf/src " + |
| 63 | " -I . " + |
| 64 | " $(in)", |
| 65 | |
| 66 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 67 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 68 | ":ipconnectivity-proto-src", |
| 69 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 70 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 71 | "core/proto/**/*.proto", |
| 72 | "libs/incident/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 73 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 74 | ], |
| 75 | |
| 76 | output_extension: "proto.h", |
| 77 | } |
| 78 | |
| 79 | // ==== java proto host library ============================== |
| 80 | java_library_host { |
| 81 | name: "platformprotos", |
| 82 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 83 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 84 | ":ipconnectivity-proto-src", |
| 85 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 86 | ":libstats_atom_message_protos", |
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 | }, |
| 102 | // Protos have lots of MissingOverride and similar. |
| 103 | errorprone: { |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 104 | enabled: false, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 105 | }, |
| 106 | } |
| 107 | |
| 108 | // ==== java proto device library (for test only) ============================== |
| 109 | java_library { |
| 110 | name: "platformprotosnano", |
| 111 | proto: { |
| 112 | type: "nano", |
| 113 | output_params: ["store_unknown_fields=true"], |
| 114 | include_dirs: ["external/protobuf/src"], |
| 115 | }, |
| 116 | exclude_srcs: [ |
| 117 | "core/proto/android/privacy.proto", |
| 118 | "core/proto/android/section.proto", |
| 119 | "core/proto/android/typedef.proto", |
| 120 | ], |
| 121 | sdk_version: "9", |
| 122 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 123 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 124 | ":ipconnectivity-proto-src", |
| 125 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 126 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 127 | "core/proto/**/*.proto", |
| 128 | "libs/incident/proto/android/os/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 129 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 130 | ], |
Cole Faust | 2fd661b | 2021-06-19 00:54:23 +0000 | [diff] [blame] | 131 | // Protos have lots of MissingOverride and similar. |
| 132 | errorprone: { |
| 133 | enabled: false, |
| 134 | }, |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | // ==== java proto device library (for test only) ============================== |
| 138 | java_library { |
| 139 | name: "platformprotoslite", |
| 140 | proto: { |
| 141 | type: "lite", |
| 142 | include_dirs: ["external/protobuf/src"], |
| 143 | }, |
| 144 | |
| 145 | srcs: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 146 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 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: [ |
Aaron Huang | d87c9cb | 2022-02-14 21:26:44 +0800 | [diff] [blame] | 184 | ":framework-connectivity-protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 185 | ":ipconnectivity-proto-src", |
| 186 | ":libstats_atom_enum_protos", |
Dichen Zhang | c2ae00b | 2021-04-13 15:24:22 -0700 | [diff] [blame] | 187 | ":libstats_atom_message_protos", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 188 | "core/proto/**/*.proto", |
Tyler Dewey | 4c5d89e | 2022-03-01 16:12:56 +0000 | [diff] [blame] | 189 | ":service-permission-streaming-proto-sources", |
Anton Hansson | 31fb58b | 2021-04-12 18:03:12 +0100 | [diff] [blame] | 190 | ], |
| 191 | } |
| 192 | |
| 193 | cc_library { |
| 194 | name: "libplatformprotos", |
| 195 | defaults: ["libplatformprotos-defaults"], |
| 196 | host_supported: true, |
| 197 | |
| 198 | target: { |
| 199 | host: { |
| 200 | proto: { |
| 201 | type: "full", |
| 202 | }, |
| 203 | }, |
| 204 | android: { |
| 205 | proto: { |
| 206 | type: "lite", |
| 207 | }, |
| 208 | shared_libs: [ |
| 209 | "libprotobuf-cpp-lite", |
| 210 | ], |
| 211 | shared: { |
| 212 | enabled: false, |
| 213 | }, |
| 214 | }, |
| 215 | }, |
| 216 | } |
| 217 | |
| 218 | // This library is meant for vendor code that needs to output protobuf. It links |
| 219 | // against the static version of libprotobuf-cpp-lite, for which we can not guarantee |
| 220 | // binary compatibility. |
| 221 | cc_library { |
| 222 | name: "libplatformprotos-static", |
| 223 | defaults: ["libplatformprotos-defaults"], |
| 224 | host_supported: false, |
| 225 | |
| 226 | // This is okay because this library is only built as a static library. The C++ |
| 227 | // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council, |
| 228 | // but is not authorized to be used outside of debugging. |
| 229 | vendor_available: true, |
| 230 | |
| 231 | target: { |
| 232 | android: { |
| 233 | proto: { |
| 234 | type: "lite", |
| 235 | }, |
| 236 | static_libs: [ |
| 237 | "libprotobuf-cpp-lite", |
| 238 | ], |
| 239 | shared: { |
| 240 | enabled: false, |
| 241 | }, |
| 242 | }, |
| 243 | }, |
| 244 | } |
| 245 | |
| 246 | // This is the full proto version of libplatformprotos. It may only |
| 247 | // be used by test code that is not shipped on the device. |
| 248 | cc_library { |
| 249 | name: "libplatformprotos-test", |
| 250 | defaults: ["libplatformprotos-defaults"], |
| 251 | host_supported: false, |
| 252 | |
| 253 | target: { |
| 254 | android: { |
| 255 | proto: { |
| 256 | type: "full", |
| 257 | }, |
| 258 | shared: { |
| 259 | enabled: false, |
| 260 | }, |
| 261 | }, |
| 262 | }, |
| 263 | } |