blob: a0944d40a5e3532af666b7b83658d60430855e5b [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 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000103 // b/267831518: Pin tradefed and dependencies to Java 11.
104 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100105 // Protos have lots of MissingOverride and similar.
106 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000107 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100108 },
109}
110
111// ==== java proto device library (for test only) ==============================
112java_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",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700128 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100129 "core/proto/**/*.proto",
130 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000131 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100132 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000133 // Protos have lots of MissingOverride and similar.
134 errorprone: {
135 enabled: false,
136 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100137}
138
139// ==== java proto device library (for test only) ==============================
140java_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",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700150 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100151 "core/proto/**/*.proto",
152 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000153 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100154 ],
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: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000163 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100164 },
165}
166
167// ==== c++ proto device library ==============================
168cc_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",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700187 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100188 "core/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000189 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100190 ],
191}
192
193cc_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.
221cc_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.
248cc_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}