1{
2  'target_defaults': {
3    'variables': {
4      'deps': [
5        'libchrome-<(libbase_ver)'
6      ],
7      'USE_dbus%': '1',
8    },
9    'include_dirs': [
10      '../libbrillo',
11    ],
12    'defines': [
13      'USE_DBUS=<(USE_dbus)',
14      'USE_RTTI_FOR_TYPE_TAGS',
15    ],
16  },
17  'targets': [
18    {
19      'target_name': 'libbrillo-<(libbase_ver)',
20      'type': 'none',
21      'dependencies': [
22        'libbrillo-core-<(libbase_ver)',
23        'libbrillo-cryptohome-<(libbase_ver)',
24        'libbrillo-http-<(libbase_ver)',
25        'libbrillo-minijail-<(libbase_ver)',
26        'libbrillo-streams-<(libbase_ver)',
27        'libpolicy-<(libbase_ver)',
28      ],
29      'direct_dependent_settings': {
30        'include_dirs': [
31          '../libbrillo',
32        ],
33      },
34      'includes': ['../common-mk/deps.gypi'],
35    },
36    {
37      'target_name': 'libbrillo-core-<(libbase_ver)',
38      'type': 'shared_library',
39      'variables': {
40        'exported_deps': [
41          'dbus-1',
42        ],
43        'deps': ['<@(exported_deps)'],
44      },
45      'all_dependent_settings': {
46        'variables': {
47          'deps': [
48            '<@(exported_deps)',
49          ],
50        },
51      },
52      'libraries': ['-lmodp_b64'],
53      #TODO(deymo): Split DBus code from libbrillo-core the same way is split in
54      # the Android.mk, based on the <(USE_dbus) variable.
55      'sources': [
56        'brillo/any.cc',
57        'brillo/asynchronous_signal_handler.cc',
58        'brillo/backoff_entry.cc',
59        'brillo/daemons/dbus_daemon.cc',
60        'brillo/daemons/daemon.cc',
61        'brillo/data_encoding.cc',
62        'brillo/dbus/async_event_sequencer.cc',
63        'brillo/dbus/data_serialization.cc',
64        'brillo/dbus/dbus_connection.cc',
65        'brillo/dbus/dbus_method_invoker.cc',
66        'brillo/dbus/dbus_method_response.cc',
67        'brillo/dbus/dbus_object.cc',
68        'brillo/dbus/dbus_service_watcher.cc',
69        'brillo/dbus/dbus_signal.cc',
70        'brillo/dbus/exported_object_manager.cc',
71        'brillo/dbus/exported_property_set.cc',
72        'brillo/dbus/utils.cc',
73        'brillo/errors/error.cc',
74        'brillo/errors/error_codes.cc',
75        'brillo/file_utils.cc',
76        'brillo/flag_helper.cc',
77        'brillo/key_value_store.cc',
78        'brillo/message_loops/base_message_loop.cc',
79        'brillo/message_loops/message_loop.cc',
80        'brillo/message_loops/message_loop_utils.cc',
81        'brillo/mime_utils.cc',
82        'brillo/osrelease_reader.cc',
83        'brillo/process.cc',
84        'brillo/process_reaper.cc',
85        'brillo/process_information.cc',
86        'brillo/secure_blob.cc',
87        'brillo/strings/string_utils.cc',
88        'brillo/syslog_logging.cc',
89        'brillo/type_name_undecorate.cc',
90        'brillo/url_utils.cc',
91        'brillo/userdb_utils.cc',
92        'brillo/value_conversion.cc',
93      ],
94    },
95    {
96      'target_name': 'libbrillo-http-<(libbase_ver)',
97      'type': 'shared_library',
98      'dependencies': [
99        'libbrillo-core-<(libbase_ver)',
100        'libbrillo-streams-<(libbase_ver)',
101      ],
102      'variables': {
103        'exported_deps': [
104          'libcurl',
105        ],
106        'deps': ['<@(exported_deps)'],
107      },
108      'all_dependent_settings': {
109        'variables': {
110          'deps': [
111            '<@(exported_deps)',
112          ],
113        },
114      },
115      'sources': [
116        'brillo/http/curl_api.cc',
117        'brillo/http/http_connection_curl.cc',
118        'brillo/http/http_form_data.cc',
119        'brillo/http/http_request.cc',
120        'brillo/http/http_transport.cc',
121        'brillo/http/http_transport_curl.cc',
122        'brillo/http/http_utils.cc',
123      ],
124    },
125    {
126      'target_name': 'libbrillo-streams-<(libbase_ver)',
127      'type': 'shared_library',
128      'dependencies': [
129        'libbrillo-core-<(libbase_ver)',
130      ],
131      'variables': {
132        'exported_deps': [
133          'openssl',
134        ],
135        'deps': ['<@(exported_deps)'],
136      },
137      'all_dependent_settings': {
138        'variables': {
139          'deps': [
140            '<@(exported_deps)',
141          ],
142        },
143      },
144      'sources': [
145        'brillo/streams/file_stream.cc',
146        'brillo/streams/input_stream_set.cc',
147        'brillo/streams/memory_containers.cc',
148        'brillo/streams/memory_stream.cc',
149        'brillo/streams/openssl_stream_bio.cc',
150        'brillo/streams/stream.cc',
151        'brillo/streams/stream_errors.cc',
152        'brillo/streams/stream_utils.cc',
153        'brillo/streams/tls_stream.cc',
154      ],
155    },
156    {
157      'target_name': 'libbrillo-test-<(libbase_ver)',
158      'type': 'static_library',
159      'standalone_static_library': 1,
160      'dependencies': [
161        'libbrillo-http-<(libbase_ver)',
162      ],
163      'sources': [
164        'brillo/http/http_connection_fake.cc',
165        'brillo/http/http_transport_fake.cc',
166        'brillo/message_loops/fake_message_loop.cc',
167        'brillo/streams/fake_stream.cc',
168        'brillo/unittest_utils.cc',
169      ],
170      'includes': ['../common-mk/deps.gypi'],
171    },
172    {
173      'target_name': 'libbrillo-cryptohome-<(libbase_ver)',
174      'type': 'shared_library',
175      'variables': {
176        'exported_deps': [
177          'openssl',
178        ],
179        'deps': ['<@(exported_deps)'],
180      },
181      'all_dependent_settings': {
182        'variables': {
183          'deps': [
184            '<@(exported_deps)',
185          ],
186        },
187      },
188      'sources': [
189        'brillo/cryptohome.cc',
190      ],
191    },
192    {
193      'target_name': 'libbrillo-minijail-<(libbase_ver)',
194      'type': 'shared_library',
195      'variables': {
196        'exported_deps': [
197          'libminijail',
198        ],
199        'deps': ['<@(exported_deps)'],
200      },
201      'all_dependent_settings': {
202        'variables': {
203          'deps': [
204            '<@(exported_deps)',
205          ],
206        },
207      },
208      'cflags': [
209        '-fvisibility=default',
210      ],
211      'sources': [
212        'brillo/minijail/minijail.cc',
213      ],
214    },
215    {
216      'target_name': 'libpolicy-<(libbase_ver)',
217      'type': 'shared_library',
218      'dependencies': [
219        'libpolicy-includes',
220        '../common-mk/external_dependencies.gyp:policy-protos',
221      ],
222      'variables': {
223        'exported_deps': [
224          'openssl',
225          'protobuf-lite',
226        ],
227        'deps': ['<@(exported_deps)'],
228      },
229      'all_dependent_settings': {
230        'variables': {
231          'deps': [
232            '<@(exported_deps)',
233          ],
234        },
235      },
236      'ldflags': [
237        '-Wl,--version-script,<(platform2_root)/libbrillo/libpolicy.ver',
238      ],
239      'sources': [
240        'policy/device_policy.cc',
241        'policy/device_policy_impl.cc',
242        'policy/libpolicy.cc',
243      ],
244    },
245    {
246      'target_name': 'libbrillo-glib-<(libbase_ver)',
247      'type': 'shared_library',
248      'dependencies': [
249          'libbrillo-<(libbase_ver)',
250      ],
251      'variables': {
252        'exported_deps': [
253          'dbus-1',
254          'dbus-glib-1',
255          'glib-2.0',
256          'gobject-2.0',
257        ],
258        'deps': ['<@(exported_deps)'],
259      },
260      'cflags': [
261        # glib uses the deprecated "register" attribute in some header files.
262        '-Wno-deprecated-register',
263      ],
264      'all_dependent_settings': {
265        'variables': {
266          'deps': [
267            '<@(exported_deps)',
268          ],
269        },
270      },
271      'sources': [
272        'brillo/glib/abstract_dbus_service.cc',
273        'brillo/glib/dbus.cc',
274        'brillo/message_loops/glib_message_loop.cc',
275      ],
276      'includes': ['../common-mk/deps.gypi'],
277    },
278  ],
279  'conditions': [
280    ['USE_test == 1', {
281      'targets': [
282        {
283          'target_name': 'libbrillo-<(libbase_ver)_unittests',
284          'type': 'executable',
285          'dependencies': [
286            'libbrillo-<(libbase_ver)',
287            'libbrillo-test-<(libbase_ver)',
288            'libbrillo-glib-<(libbase_ver)',
289          ],
290          'variables': {
291            'deps': [
292              'libchrome-test-<(libbase_ver)',
293            ],
294            'proto_in_dir': 'brillo/dbus',
295            'proto_out_dir': 'include/brillo/dbus',
296          },
297          'includes': [
298            '../common-mk/common_test.gypi',
299            '../common-mk/protoc.gypi',
300          ],
301          'cflags': [
302            '-Wno-format-zero-length',
303          ],
304          'conditions': [
305            ['debug == 1', {
306              'cflags': [
307                '-fprofile-arcs',
308                '-ftest-coverage',
309                '-fno-inline',
310              ],
311              'libraries': [
312                '-lgcov',
313              ],
314            }],
315          ],
316          'sources': [
317            'brillo/any_unittest.cc',
318            'brillo/any_internal_impl_unittest.cc',
319            'brillo/asynchronous_signal_handler_unittest.cc',
320            'brillo/backoff_entry_unittest.cc',
321            'brillo/data_encoding_unittest.cc',
322            'brillo/dbus/async_event_sequencer_unittest.cc',
323            'brillo/dbus/data_serialization_unittest.cc',
324            'brillo/dbus/dbus_method_invoker_unittest.cc',
325            'brillo/dbus/dbus_object_unittest.cc',
326            'brillo/dbus/dbus_param_reader_unittest.cc',
327            'brillo/dbus/dbus_param_writer_unittest.cc',
328            'brillo/dbus/dbus_signal_handler_unittest.cc',
329            'brillo/dbus/exported_object_manager_unittest.cc',
330            'brillo/dbus/exported_property_set_unittest.cc',
331            'brillo/errors/error_codes_unittest.cc',
332            'brillo/errors/error_unittest.cc',
333            'brillo/file_utils_unittest.cc',
334            'brillo/flag_helper_unittest.cc',
335            'brillo/glib/object_unittest.cc',
336            'brillo/http/http_connection_curl_unittest.cc',
337            'brillo/http/http_form_data_unittest.cc',
338            'brillo/http/http_request_unittest.cc',
339            'brillo/http/http_transport_curl_unittest.cc',
340            'brillo/http/http_utils_unittest.cc',
341            'brillo/key_value_store_unittest.cc',
342            'brillo/map_utils_unittest.cc',
343            'brillo/message_loops/base_message_loop_unittest.cc',
344            'brillo/message_loops/fake_message_loop_unittest.cc',
345            'brillo/message_loops/glib_message_loop_unittest.cc',
346            'brillo/message_loops/message_loop_unittest.cc',
347            'brillo/mime_utils_unittest.cc',
348            'brillo/osrelease_reader_unittest.cc',
349            'brillo/process_reaper_unittest.cc',
350            'brillo/process_unittest.cc',
351            'brillo/secure_blob_unittest.cc',
352            'brillo/streams/fake_stream_unittest.cc',
353            'brillo/streams/file_stream_unittest.cc',
354            'brillo/streams/input_stream_set_unittest.cc',
355            'brillo/streams/memory_containers_unittest.cc',
356            'brillo/streams/memory_stream_unittest.cc',
357            'brillo/streams/openssl_stream_bio_unittests.cc',
358            'brillo/streams/stream_unittest.cc',
359            'brillo/streams/stream_utils_unittest.cc',
360            'brillo/strings/string_utils_unittest.cc',
361            'brillo/type_name_undecorate_unittest.cc',
362            'brillo/unittest_utils.cc',
363            'brillo/url_utils_unittest.cc',
364            'brillo/variant_dictionary_unittest.cc',
365            'brillo/value_conversion_unittest.cc',
366            'testrunner.cc',
367            '<(proto_in_dir)/test.proto',
368          ]
369        },
370        {
371          'target_name': 'libpolicy-<(libbase_ver)_unittests',
372          'type': 'executable',
373          'dependencies': ['libpolicy-<(libbase_ver)'],
374          'includes': ['../common-mk/common_test.gypi'],
375          'sources': [
376            'policy/tests/libpolicy_unittest.cc',
377          ]
378        },
379      ],
380    }],
381  ],
382}
383