blob: fcff58187e8d238879b793b7df6a9a303670631d [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",
Anton Hansson31fb58b2021-04-12 18:03:12 +010084 ":libstats_internal_protos",
85 ":statsd_internal_protos",
86 "cmds/am/proto/instrumentation_data.proto",
87 "cmds/statsd/src/**/*.proto",
88 "core/proto/**/*.proto",
89 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010090 ],
91 proto: {
92 include_dirs: [
93 "external/protobuf/src",
94 "frameworks/proto_logging/stats",
95 ],
96 type: "full",
97 },
Sorin Basca1f887e12023-02-04 15:56:22 +000098 // b/267831518: Pin tradefed and dependencies to Java 11.
99 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100100 // Protos have lots of MissingOverride and similar.
101 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000102 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100103 },
104}
105
106// ==== java proto device library (for test only) ==============================
107java_library {
108 name: "platformprotosnano",
109 proto: {
110 type: "nano",
111 output_params: ["store_unknown_fields=true"],
112 include_dirs: ["external/protobuf/src"],
113 },
114 exclude_srcs: [
115 "core/proto/android/privacy.proto",
116 "core/proto/android/section.proto",
117 "core/proto/android/typedef.proto",
118 ],
119 sdk_version: "9",
120 srcs: [
121 ":ipconnectivity-proto-src",
122 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700123 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100124 "core/proto/**/*.proto",
125 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100126 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000127 // Protos have lots of MissingOverride and similar.
128 errorprone: {
129 enabled: false,
130 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100131}
132
133// ==== java proto device library (for test only) ==============================
134java_library {
135 name: "platformprotoslite",
136 proto: {
137 type: "lite",
138 include_dirs: ["external/protobuf/src"],
139 },
140
141 srcs: [
142 ":ipconnectivity-proto-src",
143 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700144 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100145 "core/proto/**/*.proto",
146 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100147 ],
148 exclude_srcs: [
149 "core/proto/android/privacy.proto",
150 "core/proto/android/section.proto",
151 "core/proto/android/typedef.proto",
152 ],
153 sdk_version: "core_current",
154 // Protos have lots of MissingOverride and similar.
155 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000156 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100157 },
158}
159
160// ==== c++ proto device library ==============================
161cc_defaults {
162 name: "libplatformprotos-defaults",
163
164 proto: {
165 export_proto_headers: true,
166 include_dirs: [
167 "external/protobuf/src",
168 ],
169 },
170
171 cflags: [
172 "-Wall",
173 "-Werror",
174 "-Wno-unused-parameter",
175 ],
176
177 srcs: [
178 ":ipconnectivity-proto-src",
179 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700180 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100181 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100182 ],
183}
184
185cc_library {
186 name: "libplatformprotos",
187 defaults: ["libplatformprotos-defaults"],
188 host_supported: true,
189
190 target: {
191 host: {
192 proto: {
193 type: "full",
194 },
195 },
196 android: {
197 proto: {
198 type: "lite",
199 },
200 shared_libs: [
201 "libprotobuf-cpp-lite",
202 ],
203 shared: {
204 enabled: false,
205 },
206 },
207 },
208}
209
210// This library is meant for vendor code that needs to output protobuf. It links
211// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
212// binary compatibility.
213cc_library {
214 name: "libplatformprotos-static",
215 defaults: ["libplatformprotos-defaults"],
216 host_supported: false,
217
218 // This is okay because this library is only built as a static library. The C++
219 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
220 // but is not authorized to be used outside of debugging.
221 vendor_available: true,
222
223 target: {
224 android: {
225 proto: {
226 type: "lite",
227 },
228 static_libs: [
229 "libprotobuf-cpp-lite",
230 ],
231 shared: {
232 enabled: false,
233 },
234 },
235 },
236}
237
238// This is the full proto version of libplatformprotos. It may only
239// be used by test code that is not shipped on the device.
240cc_library {
241 name: "libplatformprotos-test",
242 defaults: ["libplatformprotos-defaults"],
243 host_supported: false,
244
245 target: {
246 android: {
247 proto: {
248 type: "full",
249 },
250 shared: {
251 enabled: false,
252 },
253 },
254 },
255}