blob: 4b8ad38b26d54b1043d6c276e075c336fc715be3 [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",
Anton Hansson31fb58b2021-04-12 18:03:12 +010087 ":libstats_internal_protos",
88 ":statsd_internal_protos",
89 "cmds/am/proto/instrumentation_data.proto",
90 "cmds/statsd/src/**/*.proto",
91 "core/proto/**/*.proto",
92 "libs/incident/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +000093 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +010094 ],
95 proto: {
96 include_dirs: [
97 "external/protobuf/src",
98 "frameworks/proto_logging/stats",
99 ],
100 type: "full",
101 },
Sorin Basca1f887e12023-02-04 15:56:22 +0000102 // b/267831518: Pin tradefed and dependencies to Java 11.
103 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100104 // Protos have lots of MissingOverride and similar.
105 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000106 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100107 },
108}
109
110// ==== java proto device library (for test only) ==============================
111java_library {
112 name: "platformprotosnano",
113 proto: {
114 type: "nano",
115 output_params: ["store_unknown_fields=true"],
116 include_dirs: ["external/protobuf/src"],
117 },
118 exclude_srcs: [
119 "core/proto/android/privacy.proto",
120 "core/proto/android/section.proto",
121 "core/proto/android/typedef.proto",
122 ],
123 sdk_version: "9",
124 srcs: [
125 ":ipconnectivity-proto-src",
126 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700127 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100128 "core/proto/**/*.proto",
129 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000130 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100131 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000132 // Protos have lots of MissingOverride and similar.
133 errorprone: {
134 enabled: false,
135 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100136}
137
138// ==== java proto device library (for test only) ==============================
139java_library {
140 name: "platformprotoslite",
141 proto: {
142 type: "lite",
143 include_dirs: ["external/protobuf/src"],
144 },
145
146 srcs: [
147 ":ipconnectivity-proto-src",
148 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700149 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100150 "core/proto/**/*.proto",
151 "libs/incident/proto/android/os/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000152 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100153 ],
154 exclude_srcs: [
155 "core/proto/android/privacy.proto",
156 "core/proto/android/section.proto",
157 "core/proto/android/typedef.proto",
158 ],
159 sdk_version: "core_current",
160 // Protos have lots of MissingOverride and similar.
161 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000162 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100163 },
164}
165
166// ==== c++ proto device library ==============================
167cc_defaults {
168 name: "libplatformprotos-defaults",
169
170 proto: {
171 export_proto_headers: true,
172 include_dirs: [
173 "external/protobuf/src",
174 ],
175 },
176
177 cflags: [
178 "-Wall",
179 "-Werror",
180 "-Wno-unused-parameter",
181 ],
182
183 srcs: [
184 ":ipconnectivity-proto-src",
185 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700186 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100187 "core/proto/**/*.proto",
Tyler Dewey4c5d89e2022-03-01 16:12:56 +0000188 ":service-permission-streaming-proto-sources",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100189 ],
190}
191
192cc_library {
193 name: "libplatformprotos",
194 defaults: ["libplatformprotos-defaults"],
195 host_supported: true,
196
197 target: {
198 host: {
199 proto: {
200 type: "full",
201 },
202 },
203 android: {
204 proto: {
205 type: "lite",
206 },
207 shared_libs: [
208 "libprotobuf-cpp-lite",
209 ],
210 shared: {
211 enabled: false,
212 },
213 },
214 },
215}
216
217// This library is meant for vendor code that needs to output protobuf. It links
218// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
219// binary compatibility.
220cc_library {
221 name: "libplatformprotos-static",
222 defaults: ["libplatformprotos-defaults"],
223 host_supported: false,
224
225 // This is okay because this library is only built as a static library. The C++
226 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
227 // but is not authorized to be used outside of debugging.
228 vendor_available: true,
229
230 target: {
231 android: {
232 proto: {
233 type: "lite",
234 },
235 static_libs: [
236 "libprotobuf-cpp-lite",
237 ],
238 shared: {
239 enabled: false,
240 },
241 },
242 },
243}
244
245// This is the full proto version of libplatformprotos. It may only
246// be used by test code that is not shipped on the device.
247cc_library {
248 name: "libplatformprotos-test",
249 defaults: ["libplatformprotos-defaults"],
250 host_supported: false,
251
252 target: {
253 android: {
254 proto: {
255 type: "full",
256 },
257 shared: {
258 enabled: false,
259 },
260 },
261 },
262}