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