blob: 45bb161840692de730884ea7b522787ec5d8953c [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",
Anton Hansson31fb58b2021-04-12 18:03:12 +010040 ],
Liz Kammer2934d292023-06-09 14:04:26 -040041
42 data: [
43 ":libprotobuf-internal-protos",
44 ],
45
Anton Hansson31fb58b2021-04-12 18:03:12 +010046 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
57 cmd: "mkdir -p $(genDir) " +
58 "&& $(location aprotoc) " +
59 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010060 " --cppstream_out=$(genDir) " +
61 " -Iexternal/protobuf/src " +
62 " -I . " +
63 " $(in)",
64
65 srcs: [
66 ":ipconnectivity-proto-src",
67 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -070068 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010069 "core/proto/**/*.proto",
70 "libs/incident/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010071 ],
72
Liz Kammer2934d292023-06-09 14:04:26 -040073 data: [
74 ":libprotobuf-internal-protos",
75 ],
76
Anton Hansson31fb58b2021-04-12 18:03:12 +010077 output_extension: "proto.h",
78}
79
80// ==== java proto host library ==============================
81java_library_host {
82 name: "platformprotos",
83 srcs: [
84 ":ipconnectivity-proto-src",
Anton Hansson31fb58b2021-04-12 18:03:12 +010085 ":libstats_internal_protos",
86 ":statsd_internal_protos",
87 "cmds/am/proto/instrumentation_data.proto",
88 "cmds/statsd/src/**/*.proto",
89 "core/proto/**/*.proto",
90 "libs/incident/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +010091 ],
92 proto: {
93 include_dirs: [
94 "external/protobuf/src",
95 "frameworks/proto_logging/stats",
96 ],
97 type: "full",
98 },
Sorin Basca1f887e12023-02-04 15:56:22 +000099 // b/267831518: Pin tradefed and dependencies to Java 11.
100 java_version: "11",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100101 // Protos have lots of MissingOverride and similar.
102 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000103 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100104 },
105}
106
107// ==== java proto device library (for test only) ==============================
108java_library {
109 name: "platformprotosnano",
110 proto: {
111 type: "nano",
112 output_params: ["store_unknown_fields=true"],
113 include_dirs: ["external/protobuf/src"],
114 },
115 exclude_srcs: [
116 "core/proto/android/privacy.proto",
117 "core/proto/android/section.proto",
118 "core/proto/android/typedef.proto",
119 ],
120 sdk_version: "9",
121 srcs: [
122 ":ipconnectivity-proto-src",
123 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700124 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100125 "core/proto/**/*.proto",
126 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100127 ],
Cole Faust2fd661b2021-06-19 00:54:23 +0000128 // Protos have lots of MissingOverride and similar.
129 errorprone: {
130 enabled: false,
131 },
Anton Hansson31fb58b2021-04-12 18:03:12 +0100132}
133
134// ==== java proto device library (for test only) ==============================
135java_library {
136 name: "platformprotoslite",
137 proto: {
138 type: "lite",
139 include_dirs: ["external/protobuf/src"],
140 },
141
142 srcs: [
143 ":ipconnectivity-proto-src",
144 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700145 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100146 "core/proto/**/*.proto",
147 "libs/incident/proto/android/os/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100148 ],
149 exclude_srcs: [
150 "core/proto/android/privacy.proto",
151 "core/proto/android/section.proto",
152 "core/proto/android/typedef.proto",
153 ],
154 sdk_version: "core_current",
155 // Protos have lots of MissingOverride and similar.
156 errorprone: {
Cole Faust2fd661b2021-06-19 00:54:23 +0000157 enabled: false,
Anton Hansson31fb58b2021-04-12 18:03:12 +0100158 },
159}
160
161// ==== c++ proto device library ==============================
162cc_defaults {
163 name: "libplatformprotos-defaults",
164
165 proto: {
166 export_proto_headers: true,
167 include_dirs: [
168 "external/protobuf/src",
169 ],
170 },
171
172 cflags: [
173 "-Wall",
174 "-Werror",
175 "-Wno-unused-parameter",
176 ],
177
178 srcs: [
179 ":ipconnectivity-proto-src",
180 ":libstats_atom_enum_protos",
Dichen Zhangc2ae00b2021-04-13 15:24:22 -0700181 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100182 "core/proto/**/*.proto",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100183 ],
184}
185
186cc_library {
187 name: "libplatformprotos",
188 defaults: ["libplatformprotos-defaults"],
189 host_supported: true,
190
191 target: {
192 host: {
193 proto: {
194 type: "full",
195 },
196 },
197 android: {
198 proto: {
199 type: "lite",
200 },
201 shared_libs: [
202 "libprotobuf-cpp-lite",
203 ],
204 shared: {
205 enabled: false,
206 },
207 },
208 },
209}
210
211// This library is meant for vendor code that needs to output protobuf. It links
212// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
213// binary compatibility.
214cc_library {
215 name: "libplatformprotos-static",
216 defaults: ["libplatformprotos-defaults"],
217 host_supported: false,
218
219 // This is okay because this library is only built as a static library. The C++
220 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
221 // but is not authorized to be used outside of debugging.
222 vendor_available: true,
223
224 target: {
225 android: {
226 proto: {
227 type: "lite",
228 },
229 static_libs: [
230 "libprotobuf-cpp-lite",
231 ],
232 shared: {
233 enabled: false,
234 },
235 },
236 },
237}
238
239// This is the full proto version of libplatformprotos. It may only
240// be used by test code that is not shipped on the device.
241cc_library {
242 name: "libplatformprotos-test",
243 defaults: ["libplatformprotos-defaults"],
244 host_supported: false,
245
246 target: {
247 android: {
248 proto: {
249 type: "full",
250 },
251 shared: {
252 enabled: false,
253 },
254 },
255 },
256}