blob: 18c562bc9b1126b18689ff020b1df7c2d110e670 [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 ":libtombstone_proto-src",
38 "core/proto/**/*.proto",
39 "libs/incident/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000040 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010041 ],
Liz Kammer2934d292023-06-09 14:04:26 -040042
43 data: [
44 ":libprotobuf-internal-protos",
45 ],
46
Anton Hansson31fb58b2021-04-12 18:03:12 +010047 output_extension: "srcjar",
48}
49
50gensrcs {
51 name: "framework-cppstream-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010052
53 tools: [
54 "aprotoc",
55 "protoc-gen-cppstream",
56 ],
57
58 cmd: "mkdir -p $(genDir) " +
59 "&& $(location aprotoc) " +
60 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010061 " --cppstream_out=$(genDir) " +
62 " -Iexternal/protobuf/src " +
63 " -I . " +
64 " $(in)",
65
66 srcs: [
67 ":ipconnectivity-proto-src",
68 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070069 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010070 "core/proto/**/*.proto",
71 "libs/incident/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000072 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010073 ],
74
Liz Kammer2934d292023-06-09 14:04:26 -040075 data: [
76 ":libprotobuf-internal-protos",
77 ],
78
Anton Hansson31fb58b2021-04-12 18:03:12 +010079 output_extension: "proto.h",
80}
81
82// ==== java proto host library ==============================
83java_library_host {
84 name: "platformprotos",
85 srcs: [
86 ":ipconnectivity-proto-src",
87 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070088 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010089 ":libstats_internal_protos",
90 ":statsd_internal_protos",
91 "cmds/am/proto/instrumentation_data.proto",
92 "cmds/statsd/src/**/*.proto",
93 "core/proto/**/*.proto",
94 "libs/incident/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000095 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010096 ],
97 proto: {
98 include_dirs: [
99 "external/protobuf/src",
100 "frameworks/proto_logging/stats",
101 ],
102 type: "full",
103 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000104 // b/267831518: Pin tradefed and dependencies to Java 11.
105 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100106 // Protos have lots of MissingOverride and similar.
107 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000108 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100109 },
110}
111
112// ==== java proto device library (for test only) ==============================
113java_library {
114 name: "platformprotosnano",
115 proto: {
116 type: "nano",
117 output_params: ["store_unknown_fields=true"],
118 include_dirs: ["external/protobuf/src"],
119 },
120 exclude_srcs: [
121 "core/proto/android/privacy.proto",
122 "core/proto/android/section.proto",
123 "core/proto/android/typedef.proto",
124 ],
125 sdk_version: "9",
126 srcs: [
127 ":ipconnectivity-proto-src",
128 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700129 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100130 "core/proto/**/*.proto",
131 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000132 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100133 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000134 // Protos have lots of MissingOverride and similar.
135 errorprone: {
136 enabled: false,
137 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100138}
139
140// ==== java proto device library (for test only) ==============================
141java_library {
142 name: "platformprotoslite",
143 proto: {
144 type: "lite",
145 include_dirs: ["external/protobuf/src"],
146 },
147
148 srcs: [
149 ":ipconnectivity-proto-src",
150 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700151 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100152 "core/proto/**/*.proto",
153 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000154 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100155 ],
156 exclude_srcs: [
157 "core/proto/android/privacy.proto",
158 "core/proto/android/section.proto",
159 "core/proto/android/typedef.proto",
160 ],
161 sdk_version: "core_current",
162 // Protos have lots of MissingOverride and similar.
163 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000164 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100165 },
166}
167
168// ==== c++ proto device library ==============================
169cc_defaults {
170 name: "libplatformprotos-defaults",
171
172 proto: {
173 export_proto_headers: true,
174 include_dirs: [
175 "external/protobuf/src",
176 ],
177 },
178
179 cflags: [
180 "-Wall",
181 "-Werror",
182 "-Wno-unused-parameter",
183 ],
184
185 srcs: [
186 ":ipconnectivity-proto-src",
187 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700188 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100189 "core/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000190 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100191 ],
192}
193
194cc_library {
195 name: "libplatformprotos",
196 defaults: ["libplatformprotos-defaults"],
197 host_supported: true,
198
199 target: {
200 host: {
201 proto: {
202 type: "full",
203 },
204 },
205 android: {
206 proto: {
207 type: "lite",
208 },
209 shared_libs: [
210 "libprotobuf-cpp-lite",
211 ],
212 shared: {
213 enabled: false,
214 },
215 },
216 },
217}
218
219// This library is meant for vendor code that needs to output protobuf. It links
220// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
221// binary compatibility.
222cc_library {
223 name: "libplatformprotos-static",
224 defaults: ["libplatformprotos-defaults"],
225 host_supported: false,
226
227 // This is okay because this library is only built as a static library. The C++
228 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
229 // but is not authorized to be used outside of debugging.
230 vendor_available: true,
231
232 target: {
233 android: {
234 proto: {
235 type: "lite",
236 },
237 static_libs: [
238 "libprotobuf-cpp-lite",
239 ],
240 shared: {
241 enabled: false,
242 },
243 },
244 },
245}
246
247// This is the full proto version of libplatformprotos. It may only
248// be used by test code that is not shipped on the device.
249cc_library {
250 name: "libplatformprotos-test",
251 defaults: ["libplatformprotos-defaults"],
252 host_supported: false,
253
254 target: {
255 android: {
256 proto: {
257 type: "full",
258 },
259 shared: {
260 enabled: false,
261 },
262 },
263 },
264}