Debian Codegraph @

ProtoLibraries.bp

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