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 | |
| 17 | // Build files need to go in these directories in order for protoc to generate |
| 18 | // files with the correct paths |
| 19 | subdirs = [ |
Andrew Scull | 599e791 | 2017-09-14 14:00:36 +0100 | [diff] [blame] | 20 | "libnos", |
Andrew Scull | 1c021e8 | 2017-09-20 17:04:55 +0100 | [diff] [blame] | 21 | "libnos_datagram", |
| 22 | "libnos_transport", |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 23 | "nugget/services/avb", |
nagendra modadugu | bdcfaa8 | 2017-09-17 17:11:36 -0700 | [diff] [blame] | 24 | "nugget/services/keymaster", |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 25 | "nugget/services/weaver", |
| 26 | ] |
| 27 | |
| 28 | cc_library_headers { |
| 29 | name: "nos_headers", |
| 30 | defaults: ["nos_shared_cc_defaults"], |
| 31 | export_include_dirs: ["nugget/include"], |
| 32 | } |
| 33 | |
| 34 | cc_defaults { |
| 35 | name: "nos_app_defaults", |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 36 | cflags: [ |
| 37 | "-Wno-extended-offsetof", |
| 38 | "-Wno-unused-parameter", |
| 39 | ], |
Andrew Scull | 87a2caf | 2017-10-11 14:07:24 +0100 | [diff] [blame^] | 40 | header_libs: ["nos_headers"], |
| 41 | shared_libs: ["libnos"] |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | cc_defaults { |
| 45 | name: "nos_app_service_defaults", |
| 46 | defaults: [ |
| 47 | "nos_app_defaults", |
| 48 | "nos_cc_defaults", |
| 49 | ], |
| 50 | proto: { export_proto_headers: true }, |
| 51 | static_libs: ["nos_proto_options"], |
| 52 | export_static_lib_headers: ["nos_proto_options"], |
| 53 | } |
| 54 | |
| 55 | // Soong doesn't allow adding plugins to a protobuf compilation so we need to |
| 56 | // invoke it directly. If we could pass a plugin, it could use insertion points |
| 57 | // in the .pb.{cc,h} files rather than needing to generate new .client.{cpp,h} |
| 58 | // files for each service. |
| 59 | GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/libnos/nugget/proto" |
| 60 | |
| 61 | GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) " |
| 62 | GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) " |
| 63 | GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) " |
| 64 | |
| 65 | // The options proto is pre-generated as the Android build generates from the |
| 66 | // repo root which causes the repo path to be included in the generated files. |
| 67 | // Generating manually from util/protobuf means the paths are relative to the |
| 68 | // protobuf root which is the expected behaviour. |
| 69 | // |
| 70 | // protoc --cpp_out=nugget/proto -I/usr/include -Inugget/proto nugget/proto/nugget/protobuf/options.proto |
| 71 | // |
| 72 | // This can't be a shared library as that causes double import of the standard |
| 73 | // proto descriptors resulting an assetion failing. |
| 74 | cc_library_static { |
| 75 | name: "nos_proto_options", |
| 76 | srcs: ["nugget/proto/nugget/protobuf/options.pb.cc"], |
| 77 | defaults: ["nos_shared_cc_defaults"], |
| 78 | shared_libs: ["libprotobuf-cpp-full"], |
| 79 | export_include_dirs: ["nugget/proto"], |
| 80 | } |