blob: d18154a761ec30815c274e34a69357bcfadfd080 [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",
17 depfile: true,
18
19 tools: [
20 "aprotoc",
21 "protoc-gen-javastream",
22 "soong_zip",
23 ],
24
25 cmd: "mkdir -p $(genDir)/$(in) " +
26 "&& $(location aprotoc) " +
27 " --plugin=$(location protoc-gen-javastream) " +
28 " --dependency_out=$(depfile) " +
29 " --javastream_out=$(genDir)/$(in) " +
30 " -Iexternal/protobuf/src " +
31 " -I . " +
32 " $(in) " +
33 "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
34
35 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +080036 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010037 ":ipconnectivity-proto-src",
38 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070039 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010040 ":libtombstone_proto-src",
41 "core/proto/**/*.proto",
42 "libs/incident/**/*.proto",
43 ":service-permission-protos",
44 ],
45 output_extension: "srcjar",
46}
47
48gensrcs {
49 name: "framework-cppstream-protos",
50 depfile: true,
51
52 tools: [
53 "aprotoc",
54 "protoc-gen-cppstream",
55 ],
56
57 cmd: "mkdir -p $(genDir) " +
58 "&& $(location aprotoc) " +
59 " --plugin=$(location protoc-gen-cppstream) " +
60 " --dependency_out=$(depfile) " +
61 " --cppstream_out=$(genDir) " +
62 " -Iexternal/protobuf/src " +
63 " -I . " +
64 " $(in)",
65
66 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +080067 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010068 ":ipconnectivity-proto-src",
69 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070070 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010071 "core/proto/**/*.proto",
72 "libs/incident/**/*.proto",
73 ":service-permission-protos",
74 ],
75
76 output_extension: "proto.h",
77}
78
79// ==== java proto host library ==============================
80java_library_host {
81 name: "platformprotos",
82 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +080083 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010084 ":ipconnectivity-proto-src",
85 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070086 ":libstats_atom_message_protos",
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",
93 ":service-permission-protos",
94 ],
95 proto: {
96 include_dirs: [
97 "external/protobuf/src",
98 "frameworks/proto_logging/stats",
99 ],
100 type: "full",
101 },
102 // Protos have lots of MissingOverride and similar.
103 errorprone: {
104 javacflags: ["-XepDisableAllChecks"],
105 },
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: [
Aaron Huang623fe192022-02-14 21:26:44 +0800123 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100124 ":ipconnectivity-proto-src",
125 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700126 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100127 "core/proto/**/*.proto",
128 "libs/incident/proto/android/os/**/*.proto",
129 ":service-permission-protos",
130 ],
131}
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: [
Aaron Huang623fe192022-02-14 21:26:44 +0800142 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100143 ":ipconnectivity-proto-src",
144 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700145 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100146 "core/proto/**/*.proto",
147 "libs/incident/proto/android/os/**/*.proto",
148 ":service-permission-protos",
149 ],
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: {
158 javacflags: ["-XepDisableAllChecks"],
159 },
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: [
Aaron Huang623fe192022-02-14 21:26:44 +0800180 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100181 ":ipconnectivity-proto-src",
182 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700183 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100184 "core/proto/**/*.proto",
185 ":service-permission-protos",
186 ],
187}
188
189cc_library {
190 name: "libplatformprotos",
191 defaults: ["libplatformprotos-defaults"],
192 host_supported: true,
193
194 target: {
195 host: {
196 proto: {
197 type: "full",
198 },
199 },
200 android: {
201 proto: {
202 type: "lite",
203 },
204 shared_libs: [
205 "libprotobuf-cpp-lite",
206 ],
207 shared: {
208 enabled: false,
209 },
210 },
211 },
212}
213
214// This library is meant for vendor code that needs to output protobuf. It links
215// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
216// binary compatibility.
217cc_library {
218 name: "libplatformprotos-static",
219 defaults: ["libplatformprotos-defaults"],
220 host_supported: false,
221
222 // This is okay because this library is only built as a static library. The C++
223 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
224 // but is not authorized to be used outside of debugging.
225 vendor_available: true,
226
227 target: {
228 android: {
229 proto: {
230 type: "lite",
231 },
232 static_libs: [
233 "libprotobuf-cpp-lite",
234 ],
235 shared: {
236 enabled: false,
237 },
238 },
239 },
240}
241
242// This is the full proto version of libplatformprotos. It may only
243// be used by test code that is not shipped on the device.
244cc_library {
245 name: "libplatformprotos-test",
246 defaults: ["libplatformprotos-defaults"],
247 host_supported: false,
248
249 target: {
250 android: {
251 proto: {
252 type: "full",
253 },
254 shared: {
255 enabled: false,
256 },
257 },
258 },
259}