blob: 29289dab262a58af97501fe332dfd214fc2125c4 [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
17// Build files need to go in these directories in order for protoc to generate
18// files with the correct paths
19subdirs = [
Andrew Scull599e7912017-09-14 14:00:36 +010020 "libnos",
Andrew Scull1c021e82017-09-20 17:04:55 +010021 "libnos_datagram",
22 "libnos_transport",
Andrew Scull1c02d642017-09-11 17:54:56 +010023 "nugget/services/avb",
nagendra modadugubdcfaa82017-09-17 17:11:36 -070024 "nugget/services/keymaster",
Andrew Scull1c02d642017-09-11 17:54:56 +010025 "nugget/services/weaver",
26]
27
28cc_library_headers {
29 name: "nos_headers",
30 defaults: ["nos_shared_cc_defaults"],
31 export_include_dirs: ["nugget/include"],
32}
33
34cc_defaults {
35 name: "nos_app_defaults",
Andrew Scull1a48a032017-09-26 17:33:22 +010036 cflags: [
37 "-Wno-extended-offsetof",
38 "-Wno-unused-parameter",
39 ],
Andrew Scull87a2caf2017-10-11 14:07:24 +010040 header_libs: ["nos_headers"],
41 shared_libs: ["libnos"]
Andrew Scull1c02d642017-09-11 17:54:56 +010042}
43
44cc_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.
59GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/libnos/nugget/proto"
60
61GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) "
62GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) "
63GEN_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.
74cc_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}