blob: e7adf203334e509c615dfbe626d3986cc02eaa21 [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: [
34 ":ipconnectivity-proto-src",
35 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070036 ":libstats_atom_message_protos",
Siim Sammul59082d52024-01-18 15:40:24 +000037 ":libtombstone_proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +010038 "core/proto/**/*.proto",
39 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010040 ],
Liz Kammer2934d292023-06-09 14:04:26 -040041
42 data: [
43 ":libprotobuf-internal-protos",
44 ],
45
Anton Hansson31fb58b2021-04-12 18:03:12 +010046 output_extension: "srcjar",
47}
48
49gensrcs {
50 name: "framework-cppstream-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010051
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 Hansson31fb58b2021-04-12 18:03:12 +010060 " --cppstream_out=$(genDir) " +
61 " -Iexternal/protobuf/src " +
62 " -I . " +
63 " $(in)",
64
65 srcs: [
66 ":ipconnectivity-proto-src",
67 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070068 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010069 "core/proto/**/*.proto",
70 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010071 ],
72
Liz Kammer2934d292023-06-09 14:04:26 -040073 data: [
74 ":libprotobuf-internal-protos",
75 ],
76
Anton Hansson31fb58b2021-04-12 18:03:12 +010077 output_extension: "proto.h",
78}
79
Roshan Piusd1ad8ca2023-10-20 14:02:38 +000080// ==== nfc framework java library ==============================
81gensrcs {
82 name: "framework-nfc-javastream-protos",
83
84 tools: [
85 "aprotoc",
86 "protoc-gen-javastream",
87 "soong_zip",
88 ],
89
90 cmd: "mkdir -p $(genDir)/$(in) " +
91 "&& $(location aprotoc) " +
92 " --plugin=$(location protoc-gen-javastream) " +
93 " --javastream_out=$(genDir)/$(in) " +
94 " -Iexternal/protobuf/src " +
95 " -I . " +
96 " $(in) " +
97 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
98
99 srcs: [
100 "core/proto/android/app/pendingintent.proto",
101 "core/proto/android/content/component_name.proto",
102 "core/proto/android/content/intent.proto",
103 "core/proto/android/nfc/*.proto",
104 "core/proto/android/os/patternmatcher.proto",
105 "core/proto/android/os/persistablebundle.proto",
106 "core/proto/android/privacy.proto",
107 ],
108
109 data: [
110 ":libprotobuf-internal-protos",
111 ],
112
113 output_extension: "srcjar",
114}
115
Anton Hansson31fb58b2021-04-12 18:03:12 +0100116// ==== java proto host library ==============================
117java_library_host {
118 name: "platformprotos",
119 srcs: [
120 ":ipconnectivity-proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100121 ":libstats_internal_protos",
122 ":statsd_internal_protos",
123 "cmds/am/proto/instrumentation_data.proto",
124 "cmds/statsd/src/**/*.proto",
125 "core/proto/**/*.proto",
126 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100127 ],
128 proto: {
129 include_dirs: [
130 "external/protobuf/src",
131 "frameworks/proto_logging/stats",
132 ],
133 type: "full",
134 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000135 // b/267831518: Pin tradefed and dependencies to Java 11.
136 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100137 // Protos have lots of MissingOverride and similar.
138 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000139 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100140 },
141}
142
143// ==== java proto device library (for test only) ==============================
144java_library {
145 name: "platformprotosnano",
146 proto: {
147 type: "nano",
148 output_params: ["store_unknown_fields=true"],
149 include_dirs: ["external/protobuf/src"],
150 },
151 exclude_srcs: [
152 "core/proto/android/privacy.proto",
153 "core/proto/android/section.proto",
154 "core/proto/android/typedef.proto",
155 ],
156 sdk_version: "9",
157 srcs: [
158 ":ipconnectivity-proto-src",
159 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700160 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100161 "core/proto/**/*.proto",
162 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100163 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000164 // Protos have lots of MissingOverride and similar.
165 errorprone: {
166 enabled: false,
167 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100168}
169
170// ==== java proto device library (for test only) ==============================
171java_library {
172 name: "platformprotoslite",
173 proto: {
174 type: "lite",
175 include_dirs: ["external/protobuf/src"],
176 },
177
178 srcs: [
179 ":ipconnectivity-proto-src",
180 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700181 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100182 "core/proto/**/*.proto",
183 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100184 ],
185 exclude_srcs: [
186 "core/proto/android/privacy.proto",
187 "core/proto/android/section.proto",
188 "core/proto/android/typedef.proto",
189 ],
190 sdk_version: "core_current",
191 // Protos have lots of MissingOverride and similar.
192 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000193 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100194 },
195}
196
197// ==== c++ proto device library ==============================
198cc_defaults {
199 name: "libplatformprotos-defaults",
200
201 proto: {
202 export_proto_headers: true,
203 include_dirs: [
204 "external/protobuf/src",
205 ],
206 },
207
208 cflags: [
209 "-Wall",
210 "-Werror",
211 "-Wno-unused-parameter",
212 ],
213
214 srcs: [
215 ":ipconnectivity-proto-src",
216 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700217 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100218 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100219 ],
220}
221
222cc_library {
223 name: "libplatformprotos",
224 defaults: ["libplatformprotos-defaults"],
225 host_supported: true,
226
227 target: {
228 host: {
229 proto: {
230 type: "full",
231 },
232 },
233 android: {
234 proto: {
235 type: "lite",
236 },
237 shared_libs: [
238 "libprotobuf-cpp-lite",
239 ],
240 shared: {
241 enabled: false,
242 },
243 },
244 },
245}
246
247// This library is meant for vendor code that needs to output protobuf. It links
248// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
249// binary compatibility.
250cc_library {
251 name: "libplatformprotos-static",
252 defaults: ["libplatformprotos-defaults"],
253 host_supported: false,
254
255 // This is okay because this library is only built as a static library. The C++
256 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
257 // but is not authorized to be used outside of debugging.
258 vendor_available: true,
259
260 target: {
261 android: {
262 proto: {
263 type: "lite",
264 },
265 static_libs: [
266 "libprotobuf-cpp-lite",
267 ],
268 shared: {
269 enabled: false,
270 },
271 },
272 },
273}
274
275// This is the full proto version of libplatformprotos. It may only
276// be used by test code that is not shipped on the device.
277cc_library {
278 name: "libplatformprotos-test",
279 defaults: ["libplatformprotos-defaults"],
280 host_supported: false,
281
282 target: {
283 android: {
284 proto: {
285 type: "full",
286 },
287 shared: {
288 enabled: false,
289 },
290 },
291 },
292}