blob: f6213b9cf983f7d1e352a3050c966b2c822e3c99 [file] [log] [blame]
Anton Hansson31fb58b2021-04-12 18:03:12 +01001// 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
15gensrcs {
16 name: "framework-javastream-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010017
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 Hansson31fb58b2021-04-12 18:03:12 +010027 " --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: [
Dennis Shendf531052024-05-15 18:16:44 +000034 ":aconfigd_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010035 ":ipconnectivity-proto-src",
36 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070037 ":libstats_atom_message_protos",
Siim Sammul59082d52024-01-18 15:40:24 +000038 ":libtombstone_proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +010039 "core/proto/**/*.proto",
40 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010041 ],
Liz Kammer2934d292023-06-09 14:04:26 -040042
43 data: [
44 ":libprotobuf-internal-protos",
45 ],
46
Anton Hansson31fb58b2021-04-12 18:03:12 +010047 output_extension: "srcjar",
48}
49
50gensrcs {
51 name: "framework-cppstream-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010052
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 Hansson31fb58b2021-04-12 18:03:12 +010061 " --cppstream_out=$(genDir) " +
62 " -Iexternal/protobuf/src " +
63 " -I . " +
64 " $(in)",
65
66 srcs: [
67 ":ipconnectivity-proto-src",
68 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070069 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010070 "core/proto/**/*.proto",
71 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010072 ],
73
Liz Kammer2934d292023-06-09 14:04:26 -040074 data: [
75 ":libprotobuf-internal-protos",
76 ],
77
Anton Hansson31fb58b2021-04-12 18:03:12 +010078 output_extension: "proto.h",
79}
80
Roshan Piusd1ad8ca2023-10-20 14:02:38 +000081// ==== nfc framework java library ==============================
82gensrcs {
83 name: "framework-nfc-javastream-protos",
84
85 tools: [
86 "aprotoc",
87 "protoc-gen-javastream",
88 "soong_zip",
89 ],
90
91 cmd: "mkdir -p $(genDir)/$(in) " +
92 "&& $(location aprotoc) " +
93 " --plugin=$(location protoc-gen-javastream) " +
94 " --javastream_out=$(genDir)/$(in) " +
95 " -Iexternal/protobuf/src " +
96 " -I . " +
97 " $(in) " +
98 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
99
100 srcs: [
101 "core/proto/android/app/pendingintent.proto",
102 "core/proto/android/content/component_name.proto",
103 "core/proto/android/content/intent.proto",
104 "core/proto/android/nfc/*.proto",
105 "core/proto/android/os/patternmatcher.proto",
106 "core/proto/android/os/persistablebundle.proto",
107 "core/proto/android/privacy.proto",
108 ],
109
110 data: [
111 ":libprotobuf-internal-protos",
112 ],
113
114 output_extension: "srcjar",
115}
116
Anton Hansson31fb58b2021-04-12 18:03:12 +0100117// ==== java proto host library ==============================
118java_library_host {
119 name: "platformprotos",
120 srcs: [
121 ":ipconnectivity-proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100122 ":libstats_internal_protos",
123 ":statsd_internal_protos",
124 "cmds/am/proto/instrumentation_data.proto",
125 "cmds/statsd/src/**/*.proto",
126 "core/proto/**/*.proto",
127 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100128 ],
129 proto: {
130 include_dirs: [
131 "external/protobuf/src",
132 "frameworks/proto_logging/stats",
133 ],
134 type: "full",
135 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000136 // b/267831518: Pin tradefed and dependencies to Java 11.
137 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100138 // Protos have lots of MissingOverride and similar.
139 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000140 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100141 },
142}
143
144// ==== java proto device library (for test only) ==============================
145java_library {
146 name: "platformprotosnano",
147 proto: {
148 type: "nano",
149 output_params: ["store_unknown_fields=true"],
150 include_dirs: ["external/protobuf/src"],
151 },
152 exclude_srcs: [
153 "core/proto/android/privacy.proto",
154 "core/proto/android/section.proto",
155 "core/proto/android/typedef.proto",
156 ],
157 sdk_version: "9",
158 srcs: [
159 ":ipconnectivity-proto-src",
160 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700161 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100162 "core/proto/**/*.proto",
163 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100164 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000165 // Protos have lots of MissingOverride and similar.
166 errorprone: {
167 enabled: false,
168 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100169}
170
171// ==== java proto device library (for test only) ==============================
172java_library {
173 name: "platformprotoslite",
174 proto: {
175 type: "lite",
176 include_dirs: ["external/protobuf/src"],
177 },
178
179 srcs: [
180 ":ipconnectivity-proto-src",
181 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700182 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100183 "core/proto/**/*.proto",
184 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100185 ],
186 exclude_srcs: [
187 "core/proto/android/privacy.proto",
188 "core/proto/android/section.proto",
189 "core/proto/android/typedef.proto",
190 ],
191 sdk_version: "core_current",
192 // Protos have lots of MissingOverride and similar.
193 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000194 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100195 },
196}
197
198// ==== c++ proto device library ==============================
199cc_defaults {
200 name: "libplatformprotos-defaults",
201
202 proto: {
203 export_proto_headers: true,
204 include_dirs: [
205 "external/protobuf/src",
206 ],
207 },
208
209 cflags: [
210 "-Wall",
211 "-Werror",
212 "-Wno-unused-parameter",
213 ],
214
215 srcs: [
216 ":ipconnectivity-proto-src",
217 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700218 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100219 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100220 ],
221}
222
223cc_library {
224 name: "libplatformprotos",
225 defaults: ["libplatformprotos-defaults"],
226 host_supported: true,
227
228 target: {
229 host: {
230 proto: {
231 type: "full",
232 },
233 },
234 android: {
235 proto: {
236 type: "lite",
237 },
238 shared_libs: [
239 "libprotobuf-cpp-lite",
240 ],
241 shared: {
242 enabled: false,
243 },
244 },
245 },
246}
247
248// This library is meant for vendor code that needs to output protobuf. It links
249// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
250// binary compatibility.
251cc_library {
252 name: "libplatformprotos-static",
253 defaults: ["libplatformprotos-defaults"],
254 host_supported: false,
255
256 // This is okay because this library is only built as a static library. The C++
257 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
258 // but is not authorized to be used outside of debugging.
259 vendor_available: true,
260
261 target: {
262 android: {
263 proto: {
264 type: "lite",
265 },
266 static_libs: [
267 "libprotobuf-cpp-lite",
268 ],
269 shared: {
270 enabled: false,
271 },
272 },
273 },
274}
275
276// This is the full proto version of libplatformprotos. It may only
277// be used by test code that is not shipped on the device.
278cc_library {
279 name: "libplatformprotos-test",
280 defaults: ["libplatformprotos-defaults"],
281 host_supported: false,
282
283 target: {
284 android: {
285 proto: {
286 type: "full",
287 },
288 shared: {
289 enabled: false,
290 },
291 },
292 },
293}