blob: c12f5b4395ec07d8b74fda527cf3d97bf2a2d99f [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
Vinh Tran61e69fa2022-06-14 16:45:19 -040024 tool_files: [
25 ":libprotobuf-internal-protos",
26 ],
27
Anton Hansson31fb58b2021-04-12 18:03:12 +010028 cmd: "mkdir -p $(genDir)/$(in) " +
29 "&& $(location aprotoc) " +
30 " --plugin=$(location protoc-gen-javastream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010031 " --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",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070040 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010041 ":libtombstone_proto-src",
42 "core/proto/**/*.proto",
43 "libs/incident/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000044 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010045 ],
46 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
Vinh Tran61e69fa2022-06-14 16:45:19 -040057 tool_files: [
58 ":libprotobuf-internal-protos",
59 ],
60
Anton Hansson31fb58b2021-04-12 18:03:12 +010061 cmd: "mkdir -p $(genDir) " +
62 "&& $(location aprotoc) " +
63 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010064 " --cppstream_out=$(genDir) " +
65 " -Iexternal/protobuf/src " +
66 " -I . " +
67 " $(in)",
68
69 srcs: [
70 ":ipconnectivity-proto-src",
71 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070072 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010073 "core/proto/**/*.proto",
74 "libs/incident/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000075 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010076 ],
77
78 output_extension: "proto.h",
79}
80
81// ==== java proto host library ==============================
82java_library_host {
83 name: "platformprotos",
84 srcs: [
85 ":ipconnectivity-proto-src",
86 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070087 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010088 ":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",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000094 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010095 ],
96 proto: {
97 include_dirs: [
98 "external/protobuf/src",
99 "frameworks/proto_logging/stats",
100 ],
101 type: "full",
102 },
103 // Protos have lots of MissingOverride and similar.
104 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000105 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100106 },
107}
108
109// ==== java proto device library (for test only) ==============================
110java_library {
111 name: "platformprotosnano",
112 proto: {
113 type: "nano",
114 output_params: ["store_unknown_fields=true"],
115 include_dirs: ["external/protobuf/src"],
116 },
117 exclude_srcs: [
118 "core/proto/android/privacy.proto",
119 "core/proto/android/section.proto",
120 "core/proto/android/typedef.proto",
121 ],
122 sdk_version: "9",
123 srcs: [
124 ":ipconnectivity-proto-src",
125 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700126 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100127 "core/proto/**/*.proto",
128 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000129 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100130 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000131 // Protos have lots of MissingOverride and similar.
132 errorprone: {
133 enabled: false,
134 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100135}
136
137// ==== java proto device library (for test only) ==============================
138java_library {
139 name: "platformprotoslite",
140 proto: {
141 type: "lite",
142 include_dirs: ["external/protobuf/src"],
143 },
144
145 srcs: [
146 ":ipconnectivity-proto-src",
147 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700148 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100149 "core/proto/**/*.proto",
150 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000151 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100152 ],
153 exclude_srcs: [
154 "core/proto/android/privacy.proto",
155 "core/proto/android/section.proto",
156 "core/proto/android/typedef.proto",
157 ],
158 sdk_version: "core_current",
159 // Protos have lots of MissingOverride and similar.
160 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000161 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100162 },
163}
164
165// ==== c++ proto device library ==============================
166cc_defaults {
167 name: "libplatformprotos-defaults",
168
169 proto: {
170 export_proto_headers: true,
171 include_dirs: [
172 "external/protobuf/src",
173 ],
174 },
175
176 cflags: [
177 "-Wall",
178 "-Werror",
179 "-Wno-unused-parameter",
180 ],
181
182 srcs: [
183 ":ipconnectivity-proto-src",
184 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700185 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100186 "core/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000187 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100188 ],
189}
190
191cc_library {
192 name: "libplatformprotos",
193 defaults: ["libplatformprotos-defaults"],
194 host_supported: true,
195
196 target: {
197 host: {
198 proto: {
199 type: "full",
200 },
201 },
202 android: {
203 proto: {
204 type: "lite",
205 },
206 shared_libs: [
207 "libprotobuf-cpp-lite",
208 ],
209 shared: {
210 enabled: false,
211 },
212 },
213 },
214}
215
216// This library is meant for vendor code that needs to output protobuf. It links
217// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
218// binary compatibility.
219cc_library {
220 name: "libplatformprotos-static",
221 defaults: ["libplatformprotos-defaults"],
222 host_supported: false,
223
224 // This is okay because this library is only built as a static library. The C++
225 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
226 // but is not authorized to be used outside of debugging.
227 vendor_available: true,
228
229 target: {
230 android: {
231 proto: {
232 type: "lite",
233 },
234 static_libs: [
235 "libprotobuf-cpp-lite",
236 ],
237 shared: {
238 enabled: false,
239 },
240 },
241 },
242}
243
244// This is the full proto version of libplatformprotos. It may only
245// be used by test code that is not shipped on the device.
246cc_library {
247 name: "libplatformprotos-test",
248 defaults: ["libplatformprotos-defaults"],
249 host_supported: false,
250
251 target: {
252 android: {
253 proto: {
254 type: "full",
255 },
256 shared: {
257 enabled: false,
258 },
259 },
260 },
261}