blob: d03bbd249b0075a7209ead0d6545564793a02354 [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",
Anton Hansson31fb58b2021-04-12 18:03:12 +010037 "core/proto/**/*.proto",
38 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010039 ],
Liz Kammer2934d292023-06-09 14:04:26 -040040
41 data: [
42 ":libprotobuf-internal-protos",
43 ],
44
Anton Hansson31fb58b2021-04-12 18:03:12 +010045 output_extension: "srcjar",
46}
47
48gensrcs {
49 name: "framework-cppstream-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010050
51 tools: [
52 "aprotoc",
53 "protoc-gen-cppstream",
54 ],
55
56 cmd: "mkdir -p $(genDir) " +
57 "&& $(location aprotoc) " +
58 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010059 " --cppstream_out=$(genDir) " +
60 " -Iexternal/protobuf/src " +
61 " -I . " +
62 " $(in)",
63
64 srcs: [
65 ":ipconnectivity-proto-src",
66 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070067 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010068 "core/proto/**/*.proto",
69 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010070 ],
71
Liz Kammer2934d292023-06-09 14:04:26 -040072 data: [
73 ":libprotobuf-internal-protos",
74 ],
75
Anton Hansson31fb58b2021-04-12 18:03:12 +010076 output_extension: "proto.h",
77}
78
Roshan Piusd1ad8ca2023-10-20 14:02:38 +000079// ==== nfc framework java library ==============================
80gensrcs {
81 name: "framework-nfc-javastream-protos",
82
83 tools: [
84 "aprotoc",
85 "protoc-gen-javastream",
86 "soong_zip",
87 ],
88
89 cmd: "mkdir -p $(genDir)/$(in) " +
90 "&& $(location aprotoc) " +
91 " --plugin=$(location protoc-gen-javastream) " +
92 " --javastream_out=$(genDir)/$(in) " +
93 " -Iexternal/protobuf/src " +
94 " -I . " +
95 " $(in) " +
96 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
97
98 srcs: [
99 "core/proto/android/app/pendingintent.proto",
100 "core/proto/android/content/component_name.proto",
101 "core/proto/android/content/intent.proto",
102 "core/proto/android/nfc/*.proto",
103 "core/proto/android/os/patternmatcher.proto",
104 "core/proto/android/os/persistablebundle.proto",
105 "core/proto/android/privacy.proto",
106 ],
107
108 data: [
109 ":libprotobuf-internal-protos",
110 ],
111
112 output_extension: "srcjar",
113}
114
Anton Hansson31fb58b2021-04-12 18:03:12 +0100115// ==== java proto host library ==============================
116java_library_host {
117 name: "platformprotos",
118 srcs: [
119 ":ipconnectivity-proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100120 ":libstats_internal_protos",
121 ":statsd_internal_protos",
122 "cmds/am/proto/instrumentation_data.proto",
123 "cmds/statsd/src/**/*.proto",
124 "core/proto/**/*.proto",
125 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100126 ],
127 proto: {
128 include_dirs: [
129 "external/protobuf/src",
130 "frameworks/proto_logging/stats",
131 ],
132 type: "full",
133 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000134 // b/267831518: Pin tradefed and dependencies to Java 11.
135 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100136 // Protos have lots of MissingOverride and similar.
137 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000138 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100139 },
140}
141
142// ==== java proto device library (for test only) ==============================
143java_library {
144 name: "platformprotosnano",
145 proto: {
146 type: "nano",
147 output_params: ["store_unknown_fields=true"],
148 include_dirs: ["external/protobuf/src"],
149 },
150 exclude_srcs: [
151 "core/proto/android/privacy.proto",
152 "core/proto/android/section.proto",
153 "core/proto/android/typedef.proto",
154 ],
155 sdk_version: "9",
156 srcs: [
157 ":ipconnectivity-proto-src",
158 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700159 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100160 "core/proto/**/*.proto",
161 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100162 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000163 // Protos have lots of MissingOverride and similar.
164 errorprone: {
165 enabled: false,
166 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100167}
168
169// ==== java proto device library (for test only) ==============================
170java_library {
171 name: "platformprotoslite",
172 proto: {
173 type: "lite",
174 include_dirs: ["external/protobuf/src"],
175 },
176
177 srcs: [
178 ":ipconnectivity-proto-src",
179 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700180 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100181 "core/proto/**/*.proto",
182 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100183 ],
184 exclude_srcs: [
185 "core/proto/android/privacy.proto",
186 "core/proto/android/section.proto",
187 "core/proto/android/typedef.proto",
188 ],
189 sdk_version: "core_current",
190 // Protos have lots of MissingOverride and similar.
191 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000192 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100193 },
194}
195
196// ==== c++ proto device library ==============================
197cc_defaults {
198 name: "libplatformprotos-defaults",
199
200 proto: {
201 export_proto_headers: true,
202 include_dirs: [
203 "external/protobuf/src",
204 ],
205 },
206
207 cflags: [
208 "-Wall",
209 "-Werror",
210 "-Wno-unused-parameter",
211 ],
212
213 srcs: [
214 ":ipconnectivity-proto-src",
215 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700216 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100217 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100218 ],
219}
220
221cc_library {
222 name: "libplatformprotos",
223 defaults: ["libplatformprotos-defaults"],
224 host_supported: true,
225
226 target: {
227 host: {
228 proto: {
229 type: "full",
230 },
231 },
232 android: {
233 proto: {
234 type: "lite",
235 },
236 shared_libs: [
237 "libprotobuf-cpp-lite",
238 ],
239 shared: {
240 enabled: false,
241 },
242 },
243 },
244}
245
246// This library is meant for vendor code that needs to output protobuf. It links
247// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
248// binary compatibility.
249cc_library {
250 name: "libplatformprotos-static",
251 defaults: ["libplatformprotos-defaults"],
252 host_supported: false,
253
254 // This is okay because this library is only built as a static library. The C++
255 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
256 // but is not authorized to be used outside of debugging.
257 vendor_available: true,
258
259 target: {
260 android: {
261 proto: {
262 type: "lite",
263 },
264 static_libs: [
265 "libprotobuf-cpp-lite",
266 ],
267 shared: {
268 enabled: false,
269 },
270 },
271 },
272}
273
274// This is the full proto version of libplatformprotos. It may only
275// be used by test code that is not shipped on the device.
276cc_library {
277 name: "libplatformprotos-test",
278 defaults: ["libplatformprotos-defaults"],
279 host_supported: false,
280
281 target: {
282 android: {
283 proto: {
284 type: "full",
285 },
286 shared: {
287 enabled: false,
288 },
289 },
290 },
291}