blob: d8f693cdedcda3177d7103668f41507a110922eb [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",
Anton Hansson31fb58b2021-04-12 18:03:12 +010044 ],
45 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
Vinh Tran61e69fa2022-06-14 16:45:19 -040056 tool_files: [
57 ":libprotobuf-internal-protos",
58 ],
59
Anton Hansson31fb58b2021-04-12 18:03:12 +010060 cmd: "mkdir -p $(genDir) " +
61 "&& $(location aprotoc) " +
62 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010063 " --cppstream_out=$(genDir) " +
64 " -Iexternal/protobuf/src " +
65 " -I . " +
66 " $(in)",
67
68 srcs: [
69 ":ipconnectivity-proto-src",
70 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070071 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010072 "core/proto/**/*.proto",
73 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010074 ],
75
76 output_extension: "proto.h",
77}
78
79// ==== java proto host library ==============================
80java_library_host {
81 name: "platformprotos",
82 srcs: [
83 ":ipconnectivity-proto-src",
84 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070085 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010086 ":libstats_internal_protos",
87 ":statsd_internal_protos",
88 "cmds/am/proto/instrumentation_data.proto",
89 "cmds/statsd/src/**/*.proto",
90 "core/proto/**/*.proto",
91 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010092 ],
93 proto: {
94 include_dirs: [
95 "external/protobuf/src",
96 "frameworks/proto_logging/stats",
97 ],
98 type: "full",
99 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000100 // b/267831518: Pin tradefed and dependencies to Java 11.
101 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100102 // Protos have lots of MissingOverride and similar.
103 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000104 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100105 },
106}
107
108// ==== java proto device library (for test only) ==============================
109java_library {
110 name: "platformprotosnano",
111 proto: {
112 type: "nano",
113 output_params: ["store_unknown_fields=true"],
114 include_dirs: ["external/protobuf/src"],
115 },
116 exclude_srcs: [
117 "core/proto/android/privacy.proto",
118 "core/proto/android/section.proto",
119 "core/proto/android/typedef.proto",
120 ],
121 sdk_version: "9",
122 srcs: [
123 ":ipconnectivity-proto-src",
124 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700125 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100126 "core/proto/**/*.proto",
127 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100128 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000129 // Protos have lots of MissingOverride and similar.
130 errorprone: {
131 enabled: false,
132 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100133}
134
135// ==== java proto device library (for test only) ==============================
136java_library {
137 name: "platformprotoslite",
138 proto: {
139 type: "lite",
140 include_dirs: ["external/protobuf/src"],
141 },
142
143 srcs: [
144 ":ipconnectivity-proto-src",
145 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700146 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100147 "core/proto/**/*.proto",
148 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100149 ],
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: "core_current",
156 // Protos have lots of MissingOverride and similar.
157 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000158 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100159 },
160}
161
162// ==== c++ proto device library ==============================
163cc_defaults {
164 name: "libplatformprotos-defaults",
165
166 proto: {
167 export_proto_headers: true,
168 include_dirs: [
169 "external/protobuf/src",
170 ],
171 },
172
173 cflags: [
174 "-Wall",
175 "-Werror",
176 "-Wno-unused-parameter",
177 ],
178
179 srcs: [
180 ":ipconnectivity-proto-src",
181 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700182 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100183 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100184 ],
185}
186
187cc_library {
188 name: "libplatformprotos",
189 defaults: ["libplatformprotos-defaults"],
190 host_supported: true,
191
192 target: {
193 host: {
194 proto: {
195 type: "full",
196 },
197 },
198 android: {
199 proto: {
200 type: "lite",
201 },
202 shared_libs: [
203 "libprotobuf-cpp-lite",
204 ],
205 shared: {
206 enabled: false,
207 },
208 },
209 },
210}
211
212// This library is meant for vendor code that needs to output protobuf. It links
213// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
214// binary compatibility.
215cc_library {
216 name: "libplatformprotos-static",
217 defaults: ["libplatformprotos-defaults"],
218 host_supported: false,
219
220 // This is okay because this library is only built as a static library. The C++
221 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
222 // but is not authorized to be used outside of debugging.
223 vendor_available: true,
224
225 target: {
226 android: {
227 proto: {
228 type: "lite",
229 },
230 static_libs: [
231 "libprotobuf-cpp-lite",
232 ],
233 shared: {
234 enabled: false,
235 },
236 },
237 },
238}
239
240// This is the full proto version of libplatformprotos. It may only
241// be used by test code that is not shipped on the device.
242cc_library {
243 name: "libplatformprotos-test",
244 defaults: ["libplatformprotos-defaults"],
245 host_supported: false,
246
247 target: {
248 android: {
249 proto: {
250 type: "full",
251 },
252 shared: {
253 enabled: false,
254 },
255 },
256 },
257}