blob: de84792c45bb2d5e0de19d067653fb00d49945a6 [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: [
Aaron Huang623fe192022-02-14 21:26:44 +080038 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010039 ":ipconnectivity-proto-src",
40 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070041 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010042 ":libtombstone_proto-src",
43 "core/proto/**/*.proto",
44 "libs/incident/**/*.proto",
45 ":service-permission-protos",
46 ],
47 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
Vinh Tran61e69fa2022-06-14 16:45:19 -040058 tool_files: [
59 ":libprotobuf-internal-protos",
60 ],
61
Anton Hansson31fb58b2021-04-12 18:03:12 +010062 cmd: "mkdir -p $(genDir) " +
63 "&& $(location aprotoc) " +
64 " --plugin=$(location protoc-gen-cppstream) " +
Anton Hansson31fb58b2021-04-12 18:03:12 +010065 " --cppstream_out=$(genDir) " +
66 " -Iexternal/protobuf/src " +
67 " -I . " +
68 " $(in)",
69
70 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +080071 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010072 ":ipconnectivity-proto-src",
73 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070074 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010075 "core/proto/**/*.proto",
76 "libs/incident/**/*.proto",
77 ":service-permission-protos",
78 ],
79
80 output_extension: "proto.h",
81}
82
83// ==== java proto host library ==============================
84java_library_host {
85 name: "platformprotos",
86 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +080087 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010088 ":ipconnectivity-proto-src",
89 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -070090 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +010091 ":libstats_internal_protos",
92 ":statsd_internal_protos",
93 "cmds/am/proto/instrumentation_data.proto",
94 "cmds/statsd/src/**/*.proto",
95 "core/proto/**/*.proto",
96 "libs/incident/proto/**/*.proto",
97 ":service-permission-protos",
98 ],
99 proto: {
100 include_dirs: [
101 "external/protobuf/src",
102 "frameworks/proto_logging/stats",
103 ],
104 type: "full",
105 },
106 // Protos have lots of MissingOverride and similar.
107 errorprone: {
108 javacflags: ["-XepDisableAllChecks"],
109 },
110}
111
112// ==== java proto device library (for test only) ==============================
113java_library {
114 name: "platformprotosnano",
115 proto: {
116 type: "nano",
117 output_params: ["store_unknown_fields=true"],
118 include_dirs: ["external/protobuf/src"],
119 },
120 exclude_srcs: [
121 "core/proto/android/privacy.proto",
122 "core/proto/android/section.proto",
123 "core/proto/android/typedef.proto",
124 ],
125 sdk_version: "9",
126 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +0800127 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100128 ":ipconnectivity-proto-src",
129 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700130 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100131 "core/proto/**/*.proto",
132 "libs/incident/proto/android/os/**/*.proto",
133 ":service-permission-protos",
134 ],
135}
136
137// ==== java proto device library (for test only) ==============================
138java_library {
139 name: "platformprotoslite",
140 proto: {
141 type: "lite",
142 include_dirs: ["external/protobuf/src"],
143 },
144
145 srcs: [
Aaron Huang623fe192022-02-14 21:26:44 +0800146 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100147 ":ipconnectivity-proto-src",
148 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700149 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100150 "core/proto/**/*.proto",
151 "libs/incident/proto/android/os/**/*.proto",
152 ":service-permission-protos",
153 ],
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: {
162 javacflags: ["-XepDisableAllChecks"],
163 },
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: [
Aaron Huang623fe192022-02-14 21:26:44 +0800184 ":framework-connectivity-protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100185 ":ipconnectivity-proto-src",
186 ":libstats_atom_enum_protos",
Dichen Zhang3e5dae92021-04-14 12:03:45 -0700187 ":libstats_atom_message_protos",
Anton Hansson31fb58b2021-04-12 18:03:12 +0100188 "core/proto/**/*.proto",
189 ":service-permission-protos",
190 ],
191}
192
193cc_library {
194 name: "libplatformprotos",
195 defaults: ["libplatformprotos-defaults"],
196 host_supported: true,
197
198 target: {
199 host: {
200 proto: {
201 type: "full",
202 },
203 },
204 android: {
205 proto: {
206 type: "lite",
207 },
208 shared_libs: [
209 "libprotobuf-cpp-lite",
210 ],
211 shared: {
212 enabled: false,
213 },
214 },
215 },
216}
217
218// This library is meant for vendor code that needs to output protobuf. It links
219// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
220// binary compatibility.
221cc_library {
222 name: "libplatformprotos-static",
223 defaults: ["libplatformprotos-defaults"],
224 host_supported: false,
225
226 // This is okay because this library is only built as a static library. The C++
227 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
228 // but is not authorized to be used outside of debugging.
229 vendor_available: true,
230
231 target: {
232 android: {
233 proto: {
234 type: "lite",
235 },
236 static_libs: [
237 "libprotobuf-cpp-lite",
238 ],
239 shared: {
240 enabled: false,
241 },
242 },
243 },
244}
245
246// This is the full proto version of libplatformprotos. It may only
247// be used by test code that is not shipped on the device.
248cc_library {
249 name: "libplatformprotos-test",
250 defaults: ["libplatformprotos-defaults"],
251 host_supported: false,
252
253 target: {
254 android: {
255 proto: {
256 type: "full",
257 },
258 shared: {
259 enabled: false,
260 },
261 },
262 },
263}