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