blob: 14415dbed877b0da4de9f9a22613d2cde7731eb3 [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: [
36 ":ipconnectivity-proto-src",
37 ":libstats_atom_enum_protos",
38 ":libtombstone_proto-src",
39 "core/proto/**/*.proto",
40 "libs/incident/**/*.proto",
41 ":service-permission-protos",
42 ],
43 output_extension: "srcjar",
44}
45
46gensrcs {
47 name: "framework-cppstream-protos",
48 depfile: true,
49
50 tools: [
51 "aprotoc",
52 "protoc-gen-cppstream",
53 ],
54
55 cmd: "mkdir -p $(genDir) " +
56 "&& $(location aprotoc) " +
57 " --plugin=$(location protoc-gen-cppstream) " +
58 " --dependency_out=$(depfile) " +
59 " --cppstream_out=$(genDir) " +
60 " -Iexternal/protobuf/src " +
61 " -I . " +
62 " $(in)",
63
64 srcs: [
65 ":ipconnectivity-proto-src",
66 ":libstats_atom_enum_protos",
67 "core/proto/**/*.proto",
68 "libs/incident/**/*.proto",
69 ":service-permission-protos",
70 ],
71
72 output_extension: "proto.h",
73}
74
75// ==== java proto host library ==============================
76java_library_host {
77 name: "platformprotos",
78 srcs: [
79 ":ipconnectivity-proto-src",
80 ":libstats_atom_enum_protos",
81 ":libstats_internal_protos",
82 ":statsd_internal_protos",
83 "cmds/am/proto/instrumentation_data.proto",
84 "cmds/statsd/src/**/*.proto",
85 "core/proto/**/*.proto",
86 "libs/incident/proto/**/*.proto",
87 ":service-permission-protos",
88 ],
89 proto: {
90 include_dirs: [
91 "external/protobuf/src",
92 "frameworks/proto_logging/stats",
93 ],
94 type: "full",
95 },
96 // Protos have lots of MissingOverride and similar.
97 errorprone: {
98 javacflags: ["-XepDisableAllChecks"],
99 },
100}
101
102// ==== java proto device library (for test only) ==============================
103java_library {
104 name: "platformprotosnano",
105 proto: {
106 type: "nano",
107 output_params: ["store_unknown_fields=true"],
108 include_dirs: ["external/protobuf/src"],
109 },
110 exclude_srcs: [
111 "core/proto/android/privacy.proto",
112 "core/proto/android/section.proto",
113 "core/proto/android/typedef.proto",
114 ],
115 sdk_version: "9",
116 srcs: [
117 ":ipconnectivity-proto-src",
118 ":libstats_atom_enum_protos",
119 "core/proto/**/*.proto",
120 "libs/incident/proto/android/os/**/*.proto",
121 ":service-permission-protos",
122 ],
123}
124
125// ==== java proto device library (for test only) ==============================
126java_library {
127 name: "platformprotoslite",
128 proto: {
129 type: "lite",
130 include_dirs: ["external/protobuf/src"],
131 },
132
133 srcs: [
134 ":ipconnectivity-proto-src",
135 ":libstats_atom_enum_protos",
136 "core/proto/**/*.proto",
137 "libs/incident/proto/android/os/**/*.proto",
138 ":service-permission-protos",
139 ],
140 exclude_srcs: [
141 "core/proto/android/privacy.proto",
142 "core/proto/android/section.proto",
143 "core/proto/android/typedef.proto",
144 ],
145 sdk_version: "core_current",
146 // Protos have lots of MissingOverride and similar.
147 errorprone: {
148 javacflags: ["-XepDisableAllChecks"],
149 },
150}
151
152// ==== c++ proto device library ==============================
153cc_defaults {
154 name: "libplatformprotos-defaults",
155
156 proto: {
157 export_proto_headers: true,
158 include_dirs: [
159 "external/protobuf/src",
160 ],
161 },
162
163 cflags: [
164 "-Wall",
165 "-Werror",
166 "-Wno-unused-parameter",
167 ],
168
169 srcs: [
170 ":ipconnectivity-proto-src",
171 ":libstats_atom_enum_protos",
172 "core/proto/**/*.proto",
173 ":service-permission-protos",
174 ],
175}
176
177cc_library {
178 name: "libplatformprotos",
179 defaults: ["libplatformprotos-defaults"],
180 host_supported: true,
181
182 target: {
183 host: {
184 proto: {
185 type: "full",
186 },
187 },
188 android: {
189 proto: {
190 type: "lite",
191 },
192 shared_libs: [
193 "libprotobuf-cpp-lite",
194 ],
195 shared: {
196 enabled: false,
197 },
198 },
199 },
200}
201
202// This library is meant for vendor code that needs to output protobuf. It links
203// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
204// binary compatibility.
205cc_library {
206 name: "libplatformprotos-static",
207 defaults: ["libplatformprotos-defaults"],
208 host_supported: false,
209
210 // This is okay because this library is only built as a static library. The C++
211 // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
212 // but is not authorized to be used outside of debugging.
213 vendor_available: true,
214
215 target: {
216 android: {
217 proto: {
218 type: "lite",
219 },
220 static_libs: [
221 "libprotobuf-cpp-lite",
222 ],
223 shared: {
224 enabled: false,
225 },
226 },
227 },
228}
229
230// This is the full proto version of libplatformprotos. It may only
231// be used by test code that is not shipped on the device.
232cc_library {
233 name: "libplatformprotos-test",
234 defaults: ["libplatformprotos-defaults"],
235 host_supported: false,
236
237 target: {
238 android: {
239 proto: {
240 type: "full",
241 },
242 shared: {
243 enabled: false,
244 },
245 },
246 },
247}