Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 1 | // |
| 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 Badour | f7878ea | 2021-02-12 14:47:58 -0800 | [diff] [blame] | 17 | package { |
| 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 |
| 35 | license { |
| 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 Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 47 | cc_library_headers { |
| 48 | name: "nos_headers", |
Andrew Scull | 56ffcc4 | 2018-01-17 11:58:38 +0000 | [diff] [blame] | 49 | defaults: ["nos_cc_host_supported_defaults"], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 50 | export_include_dirs: ["nugget/include"], |
| 51 | } |
| 52 | |
| 53 | cc_defaults { |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 54 | name: "nos_proto_defaults", |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 55 | cflags: [ |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 56 | "-Wno-unused-parameter", |
| 57 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | cc_defaults { |
| 61 | name: "nos_app_defaults", |
| 62 | defaults: ["nos_proto_defaults"], |
Andrew Scull | 87a2caf | 2017-10-11 14:07:24 +0100 | [diff] [blame] | 63 | header_libs: ["nos_headers"], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 64 | shared_libs: [ |
| 65 | "libnos", |
| 66 | "libprotobuf-cpp-full", |
| 67 | ], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | cc_defaults { |
| 71 | name: "nos_app_service_defaults", |
| 72 | defaults: [ |
| 73 | "nos_app_defaults", |
Andrew Scull | 56ffcc4 | 2018-01-17 11:58:38 +0000 | [diff] [blame] | 74 | "nos_cc_defaults", |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 75 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 76 | shared_libs: ["libnosprotos"], |
| 77 | export_shared_lib_headers: ["libnosprotos"], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 78 | } |
| 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 Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 84 | GEN_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 Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 85 | |
| 86 | GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) " |
| 87 | GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) " |
| 88 | GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) " |
Andrew Scull | d9b1de2 | 2018-03-26 14:18:35 +0100 | [diff] [blame] | 89 | |
| 90 | // A special target to be statically linkeed into recovery which is a system |
| 91 | // (not vendor) component. |
| 92 | cc_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 Scull | 3fc6cfe | 2018-02-22 11:09:51 -0800 | [diff] [blame] | 109 | "libnos_transport/crc16.c", |
| 110 | ], |
| 111 | static_libs: [ |
| 112 | "libbase", |
Andrew Scull | d9b1de2 | 2018-03-26 14:18:35 +0100 | [diff] [blame] | 113 | ], |
| 114 | } |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 115 | |
josephjang | 64a6c36 | 2020-09-23 11:02:16 +0800 | [diff] [blame] | 116 | // A special target to be statically linkeed into fastboot hal. |
| 117 | cc_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 Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 142 | // A special target to be statically linkeed into recovery which is a system |
| 143 | // (not vendor) component. |
| 144 | cc_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 | |
josephjang | 64a6c36 | 2020-09-23 11:02:16 +0800 | [diff] [blame] | 160 | // A special target to be statically linkeed into fastboot hal. |
| 161 | cc_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 Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 178 | // Language and vendor related defaults |
| 179 | cc_defaults { |
| 180 | name: "nos_cc_defaults", |
Alix | 0e999da | 2022-04-18 04:06:31 +0000 | [diff] [blame] | 181 | |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 182 | cflags: [ |
| 183 | "-pedantic", |
| 184 | "-Wall", |
| 185 | "-Wextra", |
| 186 | "-Werror", |
Haibo Huang | 75c5734 | 2020-03-02 18:38:06 -0800 | [diff] [blame] | 187 | "-Wno-gnu-zero-variadic-macro-arguments", |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 188 | "-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 |
| 198 | cc_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 |
| 205 | cc_defaults { |
| 206 | name: "nos_cc_host_supported_defaults", |
| 207 | defaults: ["nos_cc_defaults"], |
| 208 | host_supported: true, |
| 209 | } |
| 210 | |
| 211 | cc_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 | } |