Android.bp revision a437be8e979352f93df2148728ec799444a3d3e1
1// Copyright 2017 Google Inc. All rights reserved.
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
15cc_defaults {
16    name: "trunks_defaults",
17    cflags: [
18        "-Wall",
19        "-Werror",
20        "-Wno-unused-parameter",
21        "-DUSE_BINDER_IPC",
22        "-fvisibility=hidden",
23    ],
24    shared_libs: [
25        "libbinder",
26        "libbinderwrapper",
27        "libbrillo",
28        "libbrillo-binder",
29        "libchrome",
30        "libchrome-crypto",
31        "libcrypto",
32        "libprotobuf-cpp-lite",
33        "libutils",
34    ],
35    include_dirs: [
36        "system/tpm",
37    ],
38}
39
40cc_library_static {
41    name: "libtrunks_generated",
42    defaults: ["trunks_defaults"],
43    srcs: [
44        "interface.proto",
45        "aidl/android/trunks/ITrunks.aidl",
46        "aidl/android/trunks/ITrunksClient.aidl",
47    ],
48    proto: {
49        export_proto_headers: true,
50    },
51    aidl: {
52        local_include_dirs: ["aidl"],
53        export_aidl_headers: true,
54    },
55}
56
57cc_library_static {
58    name: "libtrunks_common",
59    defaults: ["trunks_defaults"],
60    srcs: [
61      "background_command_transceiver.cc",
62      "blob_parser.cc",
63      "error_codes.cc",
64      "hmac_authorization_delegate.cc",
65      "hmac_session_impl.cc",
66      "password_authorization_delegate.cc",
67      "policy_session_impl.cc",
68      "scoped_key_handle.cc",
69      "session_manager_impl.cc",
70      "tpm_generated.cc",
71      "tpm_state_impl.cc",
72      "tpm_utility_impl.cc",
73      "trunks_factory_impl.cc",
74    ],
75    static_libs: [
76        "libtrunks_generated",
77    ],
78}
79
80cc_binary {
81    name: "trunksd",
82    defaults: ["trunks_defaults"],
83    srcs: [
84        "resource_manager.cc",
85        "tpm_handle.cc",
86        "tpm_simulator_handle.cc",
87        "trunks_binder_service.cc",
88        "trunksd.cc",
89    ],
90    required: [
91        "trunksd-seccomp.policy",
92    ],
93    init_rc: [
94        "trunksd.rc",
95    ],
96    shared_libs: [
97        "libbrillo-minijail",
98        "libminijail",
99    ],
100    static_libs: [
101        "libtrunks_generated",
102        "libtrunks_common",
103    ],
104}
105
106cc_library_shared {
107    name: "libtrunks",
108    defaults: ["trunks_defaults"],
109    srcs: [
110        "trunks_binder_proxy.cc",
111    ],
112    include_dirs: [
113        "system/tpm",
114    ],
115    shared_libs: [
116        "libbrillo-minijail",
117        "libminijail",
118    ],
119    whole_static_libs: [
120        "libtrunks_generated",
121        "libtrunks_common",
122    ]
123}
124
125cc_binary {
126    name: "trunks_client",
127    defaults: ["trunks_defaults"],
128    srcs: [
129        "trunks_client.cc",
130        "trunks_client_test.cc",
131    ],
132    shared_libs: [
133        "libbrillo-minijail",
134        "libminijail",
135        "libtrunks",
136    ],
137}
138
139cc_library_static {
140    name: "libtrunks_test",
141    defaults: ["trunks_defaults"],
142    shared_libs: [
143        "libbrillo-minijail",
144        "libminijail",
145    ],
146    srcs: [
147        "mock_authorization_delegate.cc",
148        "mock_blob_parser.cc",
149        "mock_command_transceiver.cc",
150        "mock_hmac_session.cc",
151        "mock_policy_session.cc",
152        "mock_session_manager.cc",
153        "mock_tpm.cc",
154        "mock_tpm_state.cc",
155        "mock_tpm_utility.cc",
156        "trunks_factory_for_test.cc",
157    ],
158    static_libs: ["libgmock"],
159}
160
161cc_test {
162    name: "trunks_test",
163    defaults: ["trunks_defaults"],
164    shared_libs: [
165        "libbrillo-minijail",
166        "libminijail",
167    ],
168    srcs: [
169        "mock_authorization_delegate.cc",
170        "mock_blob_parser.cc",
171        "mock_command_transceiver.cc",
172        "mock_hmac_session.cc",
173        "mock_policy_session.cc",
174        "mock_session_manager.cc",
175        "mock_tpm.cc",
176        "mock_tpm_state.cc",
177        "mock_tpm_utility.cc",
178        "trunks_factory_for_test.cc",
179    ],
180    static_libs: [
181        "libBionicGtestMain",
182        "libgmock",
183        "libtrunks_common",
184        "libtrunks_generated",
185        "libtrunks_test",
186    ],
187}
188