blob: 009de4c0649e5e24881158346c9bfbbdb612846c [file] [log] [blame]
Andrew Scull1c02d642017-09-11 17:54:56 +01001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Bob Badourf7878ea2021-02-12 14:47:58 -080017package {
18 default_applicable_licenses: ["external_nos_host_generic_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34// See: http://go/android-license-faq
35license {
36 name: "external_nos_host_generic_license",
37 visibility: [":__subpackages__"],
38 license_kinds: [
39 "SPDX-license-identifier-Apache-2.0",
40 "SPDX-license-identifier-BSD",
41 ],
42 license_text: [
43 "LICENSE",
44 ],
45}
46
Andrew Scull1c02d642017-09-11 17:54:56 +010047cc_library_headers {
48 name: "nos_headers",
Andrew Scull56ffcc42018-01-17 11:58:38 +000049 defaults: ["nos_cc_host_supported_defaults"],
Andrew Scull1c02d642017-09-11 17:54:56 +010050 export_include_dirs: ["nugget/include"],
51}
52
53cc_defaults {
Andrew Scullaf221e32017-10-12 13:00:53 +010054 name: "nos_proto_defaults",
Andrew Scull1a48a032017-09-26 17:33:22 +010055 cflags: [
Andrew Scull1a48a032017-09-26 17:33:22 +010056 "-Wno-unused-parameter",
57 ],
Andrew Scullaf221e32017-10-12 13:00:53 +010058}
59
60cc_defaults {
61 name: "nos_app_defaults",
62 defaults: ["nos_proto_defaults"],
Andrew Scull87a2caf2017-10-11 14:07:24 +010063 header_libs: ["nos_headers"],
Andrew Scullaf221e32017-10-12 13:00:53 +010064 shared_libs: [
65 "libnos",
66 "libprotobuf-cpp-full",
67 ],
Andrew Scull1c02d642017-09-11 17:54:56 +010068}
69
70cc_defaults {
71 name: "nos_app_service_defaults",
72 defaults: [
73 "nos_app_defaults",
Andrew Scull56ffcc42018-01-17 11:58:38 +000074 "nos_cc_defaults",
Andrew Scull1c02d642017-09-11 17:54:56 +010075 ],
Andrew Scullaf221e32017-10-12 13:00:53 +010076 shared_libs: ["libnosprotos"],
77 export_shared_lib_headers: ["libnosprotos"],
Andrew Scull1c02d642017-09-11 17:54:56 +010078}
79
80// Soong doesn't allow adding plugins to a protobuf compilation so we need to
81// invoke it directly. If we could pass a plugin, it could use insertion points
82// in the .pb.{cc,h} files rather than needing to generate new .client.{cpp,h}
83// files for each service.
Garret Kelly844f4e12019-09-20 16:13:24 -040084GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/nos/host/generic/nugget/proto"
Andrew Scull1c02d642017-09-11 17:54:56 +010085
86GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) "
87GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) "
88GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) "
Andrew Sculld9b1de22018-03-26 14:18:35 +010089
90// A special target to be statically linkeed into recovery which is a system
91// (not vendor) component.
92cc_library_static {
93 name: "libnos_for_recovery",
94 cflags: [
95 "-Wall",
96 "-Wextra",
97 "-Werror",
98 "-Wno-zero-length-array",
99 ],
100 export_include_dirs: [
101 "nugget/include",
102 "libnos/include",
103 "libnos_datagram/include",
104 "libnos_transport/include",
105 ],
106 srcs: [
107 "libnos/debug.cpp",
108 "libnos_transport/transport.c",
Andrew Scull3fc6cfe2018-02-22 11:09:51 -0800109 "libnos_transport/crc16.c",
110 ],
111 static_libs: [
112 "libbase",
Andrew Sculld9b1de22018-03-26 14:18:35 +0100113 ],
114}
Garret Kelly844f4e12019-09-20 16:13:24 -0400115
josephjang64a6c362020-09-23 11:02:16 +0800116// A special target to be statically linkeed into fastboot hal.
117cc_library_static {
118 name: "libnos_for_fastboot",
119 recovery: true,
120 cflags: [
121 "-Wall",
122 "-Wextra",
123 "-Werror",
124 "-Wno-zero-length-array",
125 ],
126 export_include_dirs: [
127 "nugget/include",
128 "libnos/include",
129 "libnos_datagram/include",
130 "libnos_transport/include",
131 ],
132 srcs: [
133 "libnos/debug.cpp",
134 "libnos_transport/transport.c",
135 "libnos_transport/crc16.c",
136 ],
137 static_libs: [
138 "libbase",
139 ],
140}
141
Garret Kelly844f4e12019-09-20 16:13:24 -0400142// A special target to be statically linkeed into recovery which is a system
143// (not vendor) component.
144cc_library_static {
145 name: "libnos_citadel_for_recovery",
146 cflags: [
147 "-Wall",
148 "-Wextra",
149 "-Werror",
150 ],
151 srcs: [
152 ":libnos_client",
153 "libnos_datagram/citadel.c",
154 ],
155 static_libs: [
156 "libnos_for_recovery",
157 ],
158}
159
josephjang64a6c362020-09-23 11:02:16 +0800160// A special target to be statically linkeed into fastboot hal.
161cc_library_static {
162 name: "libnos_citadel_for_fastboot",
163 recovery: true,
164 cflags: [
165 "-Wall",
166 "-Wextra",
167 "-Werror",
168 ],
169 srcs: [
170 ":libnos_client",
171 "libnos_datagram/citadel.c",
172 ],
173 static_libs: [
174 "libnos_for_fastboot",
175 ],
176}
177
Garret Kelly844f4e12019-09-20 16:13:24 -0400178// Language and vendor related defaults
179cc_defaults {
180 name: "nos_cc_defaults",
Alix0e999da2022-04-18 04:06:31 +0000181
Garret Kelly844f4e12019-09-20 16:13:24 -0400182 cflags: [
183 "-pedantic",
184 "-Wall",
185 "-Wextra",
186 "-Werror",
Haibo Huang75c57342020-03-02 18:38:06 -0800187 "-Wno-gnu-zero-variadic-macro-arguments",
Garret Kelly844f4e12019-09-20 16:13:24 -0400188 "-Wno-zero-length-array",
189 ],
190 conlyflags: [
191 "-std=c11",
192 ],
193 vendor: true,
194 owner: "google",
195}
196
197// Defaults for components under the hw subdirectory
198cc_defaults {
199 name: "nos_cc_hw_defaults",
200 defaults: ["nos_cc_defaults"],
201 relative_install_path: "hw",
202}
203
204// Defaults for components shared between the host and device
205cc_defaults {
206 name: "nos_cc_host_supported_defaults",
207 defaults: ["nos_cc_defaults"],
208 host_supported: true,
209}
210
211cc_library {
212 name: "libnos_client_citadel",
213 srcs: [":libnos_client"],
214 defaults: [
215 "libnos_client_defaults",
216 "nos_cc_defaults",
217 ],
218 shared_libs: ["libnos_datagram_citadel"],
219}