Extract Builder and subclasses to separate module.
[chromium-blink-merge.git] / mojo / mojo_base.gyp
blobb06997fdfd96f9285a34bbedb5b064e898c59680
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # Essential components (and their tests) that are needed to build
6 # Chrome should be here.  Other components that are useful only in
7 # Mojo land like mojo_shell should be in mojo.gyp.
9   'includes': [
10     'mojo_public.gypi',
11     'mojo_public_tests.gypi',
12     'mojo_variables.gypi',
13   ],
14   'targets': [
15     {
16       'target_name': 'mojo_base',
17       'type': 'none',
18       'dependencies': [
19         'mojo_common_lib',
20         'mojo_common_unittests',
21         'mojo_cpp_bindings',
22         'mojo_js_bindings',
23         'mojo_js_unittests',
24         'mojo_message_generator',
25         'mojo_public_application_unittests',
26         'mojo_public_test_utils',
27         'mojo_public_bindings_unittests',
28         'mojo_public_environment_unittests',
29         'mojo_public_system_perftests',
30         'mojo_public_system_unittests',
31         'mojo_public_utility_unittests',
32         'mojo_system',
33         'mojo_system_impl',
34         'mojo_system_unittests',
35         'mojo_utility',
36       ],
37       'conditions': [
38         ['OS == "android"', {
39           'dependencies': [
40             'mojo_bindings_java',
41             'mojo_public_java',
42             'mojo_system_java',
43             'libmojo_system_java',
44             'mojo_test_apk',
45           ],
46         }],
47       ]
48     },
49     {
50       'target_name': 'mojo_none',
51       'type': 'none',
52     },
53     {
54       'target_name': 'mojo_run_all_unittests',
55       'type': 'static_library',
56       'dependencies': [
57         '../base/base.gyp:base',
58         '../base/base.gyp:test_support_base',
59         '../testing/gtest.gyp:gtest',
60         'mojo_system_impl',
61         'mojo_test_support',
62         'mojo_test_support_impl',
63       ],
64       'sources': [
65         'common/test/run_all_unittests.cc',
66       ],
67     },
68     {
69       'target_name': 'mojo_run_all_perftests',
70       'type': 'static_library',
71       'dependencies': [
72         '../base/base.gyp:test_support_base',
73         'mojo_system_impl',
74         'mojo_test_support',
75         'mojo_test_support_impl',
76       ],
77       'sources': [
78         'common/test/run_all_perftests.cc',
79       ],
80     },
81     {
82       # GN version: //mojo/system
83       'target_name': 'mojo_system_impl',
84       'type': '<(component)',
85       'dependencies': [
86         '../base/base.gyp:base',
87         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
88       ],
89       'defines': [
90         'MOJO_SYSTEM_IMPL_IMPLEMENTATION',
91         'MOJO_SYSTEM_IMPLEMENTATION',
92         'MOJO_USE_SYSTEM_IMPL',
93       ],
94       'sources': [
95         'embedder/channel_init.cc',
96         'embedder/channel_init.h',
97         'embedder/embedder.cc',
98         'embedder/embedder.h',
99         'embedder/platform_channel_pair.cc',
100         'embedder/platform_channel_pair.h',
101         'embedder/platform_channel_pair_posix.cc',
102         'embedder/platform_channel_pair_win.cc',
103         'embedder/platform_channel_utils_posix.cc',
104         'embedder/platform_channel_utils_posix.h',
105         'embedder/platform_handle.cc',
106         'embedder/platform_handle.h',
107         'embedder/platform_handle_utils.h',
108         'embedder/platform_handle_utils_posix.cc',
109         'embedder/platform_handle_utils_win.cc',
110         'embedder/platform_handle_vector.h',
111         'embedder/platform_shared_buffer.h',
112         'embedder/platform_support.h',
113         'embedder/scoped_platform_handle.h',
114         'embedder/simple_platform_shared_buffer.cc',
115         'embedder/simple_platform_shared_buffer.h',
116         'embedder/simple_platform_shared_buffer_posix.cc',
117         'embedder/simple_platform_shared_buffer_win.cc',
118         'embedder/simple_platform_support.cc',
119         'embedder/simple_platform_support.h',
120         'system/channel.cc',
121         'system/channel.h',
122         'system/constants.h',
123         'system/core.cc',
124         'system/core.h',
125         'system/data_pipe.cc',
126         'system/data_pipe.h',
127         'system/data_pipe_consumer_dispatcher.cc',
128         'system/data_pipe_consumer_dispatcher.h',
129         'system/data_pipe_producer_dispatcher.cc',
130         'system/data_pipe_producer_dispatcher.h',
131         'system/dispatcher.cc',
132         'system/dispatcher.h',
133         'system/entrypoints.cc',
134         'system/handle_signals_state.h',
135         'system/handle_table.cc',
136         'system/handle_table.h',
137         'system/local_data_pipe.cc',
138         'system/local_data_pipe.h',
139         'system/local_message_pipe_endpoint.cc',
140         'system/local_message_pipe_endpoint.h',
141         'system/mapping_table.cc',
142         'system/mapping_table.h',
143         'system/memory.cc',
144         'system/memory.h',
145         'system/message_in_transit.cc',
146         'system/message_in_transit.h',
147         'system/message_in_transit_queue.cc',
148         'system/message_in_transit_queue.h',
149         'system/message_pipe.cc',
150         'system/message_pipe.h',
151         'system/message_pipe_dispatcher.cc',
152         'system/message_pipe_dispatcher.h',
153         'system/message_pipe_endpoint.cc',
154         'system/message_pipe_endpoint.h',
155         'system/options_validation.h',
156         'system/platform_handle_dispatcher.cc',
157         'system/platform_handle_dispatcher.h',
158         'system/proxy_message_pipe_endpoint.cc',
159         'system/proxy_message_pipe_endpoint.h',
160         'system/raw_channel.cc',
161         'system/raw_channel.h',
162         'system/raw_channel_posix.cc',
163         'system/raw_channel_win.cc',
164         'system/shared_buffer_dispatcher.cc',
165         'system/shared_buffer_dispatcher.h',
166         'system/simple_dispatcher.cc',
167         'system/simple_dispatcher.h',
168         'system/transport_data.cc',
169         'system/transport_data.h',
170         'system/waiter.cc',
171         'system/waiter.h',
172         'system/waiter_list.cc',
173         'system/waiter_list.h',
174         # Test-only code:
175         # TODO(vtl): It's a little unfortunate that these end up in the same
176         # component as non-test-only code. In the static build, this code should
177         # hopefully be dead-stripped.
178         'embedder/test_embedder.cc',
179         'embedder/test_embedder.h',
180       ],
181       'all_dependent_settings': {
182         # Ensures that dependent projects import the core functions on Windows.
183         'defines': ['MOJO_USE_SYSTEM_IMPL'],
184       }
185     },
186     {
187       'target_name': 'mojo_system_unittests',
188       'type': 'executable',
189       'dependencies': [
190         '../base/base.gyp:base',
191         '../testing/gtest.gyp:gtest',
192         'mojo_common_test_support',
193         'mojo_system_impl',
194       ],
195       'sources': [
196         'embedder/embedder_unittest.cc',
197         'embedder/platform_channel_pair_posix_unittest.cc',
198         'embedder/simple_platform_shared_buffer_unittest.cc',
199         'system/channel_unittest.cc',
200         'system/core_unittest.cc',
201         'system/core_test_base.cc',
202         'system/core_test_base.h',
203         'system/data_pipe_unittest.cc',
204         'system/dispatcher_unittest.cc',
205         'system/local_data_pipe_unittest.cc',
206         'system/memory_unittest.cc',
207         'system/message_pipe_dispatcher_unittest.cc',
208         'system/message_pipe_unittest.cc',
209         'system/multiprocess_message_pipe_unittest.cc',
210         'system/options_validation_unittest.cc',
211         'system/platform_handle_dispatcher_unittest.cc',
212         'system/raw_channel_unittest.cc',
213         'system/remote_message_pipe_unittest.cc',
214         'system/run_all_unittests.cc',
215         'system/shared_buffer_dispatcher_unittest.cc',
216         'system/simple_dispatcher_unittest.cc',
217         'system/test_utils.cc',
218         'system/test_utils.h',
219         'system/waiter_list_unittest.cc',
220         'system/waiter_test_utils.cc',
221         'system/waiter_test_utils.h',
222         'system/waiter_unittest.cc',
223       ],
224     },
225     {
226       'target_name': 'mojo_test_support_impl',
227       'type': 'static_library',
228       'dependencies': [
229         '../base/base.gyp:base',
230       ],
231       'sources': [
232         'common/test/test_support_impl.cc',
233         'common/test/test_support_impl.h',
234       ],
235     },
236     {
237       # GN version: //mojo/common
238       'target_name': 'mojo_common_lib',
239       'type': '<(component)',
240       'defines': [
241         'MOJO_COMMON_IMPLEMENTATION',
242       ],
243       'dependencies': [
244         '../base/base.gyp:base',
245         '../url/url.gyp:url_lib',
246         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
247         '<(mojo_system_for_component)',
248       ],
249       'export_dependent_settings': [
250         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
251       ],
252       'sources': [
253         'common/common_type_converters.cc',
254         'common/common_type_converters.h',
255         'common/data_pipe_utils.cc',
256         'common/data_pipe_utils.h',
257         'common/handle_watcher.cc',
258         'common/handle_watcher.h',
259         'common/message_pump_mojo.cc',
260         'common/message_pump_mojo.h',
261         'common/message_pump_mojo_handler.h',
262         'common/time_helper.cc',
263         'common/time_helper.h',
264       ],
265     },
266     {
267       'target_name': 'mojo_common_test_support',
268       'type': 'static_library',
269       'dependencies': [
270         '../base/base.gyp:base',
271         '../base/base.gyp:test_support_base',
272         '../testing/gtest.gyp:gtest',
273         'mojo_system_impl',
274       ],
275       'sources': [
276         'common/test/multiprocess_test_helper.cc',
277         'common/test/multiprocess_test_helper.h',
278         'common/test/test_utils.h',
279         'common/test/test_utils_posix.cc',
280         'common/test/test_utils_win.cc',
281       ],
282     },
283     {
284       'target_name': 'mojo_common_unittests',
285       'type': 'executable',
286       'dependencies': [
287         '../base/base.gyp:base',
288         '../base/base.gyp:base_message_loop_tests',
289         '../testing/gtest.gyp:gtest',
290         '../url/url.gyp:url_lib',
291         'mojo_cpp_bindings',
292         'mojo_environment_chromium',
293         'mojo_common_lib',
294         'mojo_common_test_support',
295         'mojo_public_test_utils',
296         'mojo_run_all_unittests',
297       ],
298       'sources': [
299         'common/common_type_converters_unittest.cc',
300         'common/handle_watcher_unittest.cc',
301         'common/message_pump_mojo_unittest.cc',
302         'common/test/multiprocess_test_helper_unittest.cc',
303       ],
304     },
305     {
306       # GN version: //mojo/environment:chromium
307       'target_name': 'mojo_environment_chromium',
308       'type': 'static_library',
309       'dependencies': [
310         'mojo_environment_chromium_impl',
311       ],
312       'sources': [
313         'environment/environment.cc',
314         # TODO(vtl): This is kind of ugly. (See TODO in logging.h.)
315         "public/cpp/environment/logging.h",
316         "public/cpp/environment/lib/logging.cc",
317       ],
318       'include_dirs': [
319         '..',
320       ],
321       'export_dependent_settings': [
322         'mojo_environment_chromium_impl',
323       ],
324     },
325     {
326       # GN version: //mojo/environment:chromium_impl
327       'target_name': 'mojo_environment_chromium_impl',
328       'type': '<(component)',
329       'defines': [
330         'MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION',
331       ],
332       'dependencies': [
333         '../base/base.gyp:base',
334         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
335         'mojo_common_lib',
336         '<(mojo_system_for_component)',
337       ],
338       'sources': [
339         'environment/default_async_waiter_impl.cc',
340         'environment/default_async_waiter_impl.h',
341         'environment/default_logger_impl.cc',
342         'environment/default_logger_impl.h',
343       ],
344       'include_dirs': [
345         '..',
346       ],
347     },
348     {
349       # GN version: //mojo/services/gles2:interfaces (for files generated from
350       # the mojom file)
351       # GN version: //mojo/services/gles2:bindings
352       'target_name': 'mojo_gles2_bindings',
353       'type': 'static_library',
354       'sources': [
355         'services/gles2/command_buffer.mojom',
356         'services/gles2/command_buffer_type_conversions.cc',
357         'services/gles2/command_buffer_type_conversions.h',
358         'services/gles2/mojo_buffer_backing.cc',
359         'services/gles2/mojo_buffer_backing.h',
360       ],
361       'includes': [ 'public/tools/bindings/mojom_bindings_generator.gypi' ],
362       'export_dependent_settings': [
363         'mojo_cpp_bindings',
364       ],
365       'dependencies': [
366         'mojo_cpp_bindings',
367         '../gpu/gpu.gyp:command_buffer_common',
368       ],
369     },
370     {
371       # GN version: //mojo/gles2
372       'target_name': 'mojo_gles2_impl',
373       'type': '<(component)',
374       'dependencies': [
375         '../base/base.gyp:base',
376         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
377         '../gpu/gpu.gyp:command_buffer_client',
378         '../gpu/gpu.gyp:command_buffer_common',
379         '../gpu/gpu.gyp:gles2_cmd_helper',
380         '../gpu/gpu.gyp:gles2_implementation',
381         'mojo_environment_chromium',
382         'mojo_gles2_bindings',
383         '<(mojo_system_for_component)',
384       ],
385       'defines': [
386         'GLES2_USE_MOJO',
387         'GL_GLEXT_PROTOTYPES',
388         'MOJO_GLES2_IMPLEMENTATION',
389         'MOJO_GLES2_IMPL_IMPLEMENTATION',
390         'MOJO_USE_GLES2_IMPL'
391       ],
392       'direct_dependent_settings': {
393         'defines': [
394           'GLES2_USE_MOJO',
395         ],
396       },
397       'sources': [
398         'gles2/command_buffer_client_impl.cc',
399         'gles2/command_buffer_client_impl.h',
400         'gles2/gles2_impl_export.h',
401         'gles2/gles2_impl.cc',
402         'gles2/gles2_context.cc',
403         'gles2/gles2_context.h',
404       ],
405       'all_dependent_settings': {
406         # Ensures that dependent projects import the core functions on Windows.
407         'defines': ['MOJO_USE_GLES2_IMPL'],
408       }
409     },
410     {
411      'target_name': 'mojo_application_chromium',
412      'type': 'static_library',
413      'sources': [
414        'public/cpp/application/lib/application_impl_chromium.cc',
415       ],
416       'dependencies': [
417         'mojo_application_base',
418        ],
419       'export_dependent_settings': [
420         'mojo_application_base',
421        ],
422     },
423     {
424       # GN version: //mojo/bindings/js
425       'target_name': 'mojo_js_bindings_lib',
426       'type': 'static_library',
427       'dependencies': [
428         '../base/base.gyp:base',
429         '../gin/gin.gyp:gin',
430         '../v8/tools/gyp/v8.gyp:v8',
431         'mojo_common_lib',
432       ],
433       'export_dependent_settings': [
434         '../base/base.gyp:base',
435         '../gin/gin.gyp:gin',
436         'mojo_common_lib',
437       ],
438       'sources': [
439         # Sources list duplicated in GN build.
440         'bindings/js/core.cc',
441         'bindings/js/core.h',
442         'bindings/js/handle.cc',
443         'bindings/js/handle.h',
444         'bindings/js/support.cc',
445         'bindings/js/support.h',
446         'bindings/js/waiting_callback.cc',
447         'bindings/js/waiting_callback.h',
448       ],
449     },
450     {
451       'target_name': 'mojo_message_generator',
452       'type': 'executable',
453       'dependencies': [
454         '../base/base.gyp:base',
455         '../testing/gtest.gyp:gtest',
456         'mojo_common_lib',
457         'mojo_cpp_bindings',
458         'mojo_environment_chromium',
459         'mojo_system_impl',
460       ],
461       'sources': [
462         'tools/message_generator.cc',
463       ],
464     },
465   ],
466   'conditions': [
467     ['OS=="android"', {
468       'targets': [
469         {
470           'target_name': 'mojo_jni_headers',
471           'type': 'none',
472           'dependencies': [
473             'mojo_java_set_jni_headers',
474           ],
475           'sources': [
476             'android/javatests/src/org/chromium/mojo/MojoTestCase.java',
477             'android/system/src/org/chromium/mojo/system/impl/CoreImpl.java',
478             'services/native_viewport/android/src/org/chromium/mojo/PlatformViewportAndroid.java',
479             'shell/android/apk/src/org/chromium/mojo_shell_apk/MojoMain.java',
480           ],
481           'variables': {
482             'jni_gen_package': 'mojo',
483          },
484           'includes': [ '../build/jni_generator.gypi' ],
485         },
486         {
487           'target_name': 'mojo_java_set_jni_headers',
488           'type': 'none',
489           'variables': {
490             'jni_gen_package': 'mojo',
491             'input_java_class': 'java/util/HashSet.class',
492           },
493           'includes': [ '../build/jar_file_jni_generator.gypi' ],
494         },
495         {
496           'target_name': 'mojo_system_java',
497           'type': 'none',
498           'dependencies': [
499             '../base/base.gyp:base_java',
500             'mojo_public_java',
501           ],
502           'variables': {
503             'java_in_dir': '<(DEPTH)/mojo/android/system',
504           },
505           'includes': [ '../build/java.gypi' ],
506         },
507         {
508           'target_name': 'libmojo_system_java',
509           'type': 'static_library',
510           'dependencies': [
511             '../base/base.gyp:base',
512             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
513             'mojo_common_lib',
514             'mojo_environment_chromium',
515             'mojo_jni_headers',
516             'mojo_system_impl',
517           ],
518           'sources': [
519             'android/system/core_impl.cc',
520             'android/system/core_impl.h',
521           ],
522         },
523         {
524           'target_name': 'libmojo_java_unittest',
525           'type': 'shared_library',
526           'dependencies': [
527             '../base/base.gyp:base',
528             '../base/base.gyp:test_support_base',
529             'libmojo_system_java',
530             'mojo_jni_headers',
531           ],
532           'defines': [
533             'UNIT_TEST'  # As exported from testing/gtest.gyp:gtest.
534           ],
535           'sources': [
536             'android/javatests/mojo_test_case.cc',
537             'android/javatests/mojo_test_case.h',
538             'android/javatests/init_library.cc',
539           ],
540         },
541         {
542           'target_name': 'mojo_test_apk',
543           'type': 'none',
544           'dependencies': [
545             'mojo_bindings_java',
546             'mojo_public_test_interfaces',
547             'mojo_system_java',
548             '../base/base.gyp:base_java_test_support',
549           ],
550           'variables': {
551             'apk_name': 'MojoTest',
552             'java_in_dir': '<(DEPTH)/mojo/android/javatests',
553             'resource_dir': '<(DEPTH)/mojo/android/javatests/apk',
554             'native_lib_target': 'libmojo_java_unittest',
555             'is_test_apk': 1,
556             # Given that this apk tests itself, it needs to bring emma with it
557             # when instrumented.
558             'conditions': [
559               ['emma_coverage != 0', {
560                 'emma_instrument': 1,
561               }],
562             ],
563           },
564           'includes': [ '../build/java_apk.gypi' ],
565         },
566       ]
567     }],
568     ['test_isolation_mode != "noop"', {
569       'targets': [
570         {
571           'target_name': 'mojo_js_unittests_run',
572           'type': 'none',
573           'dependencies': [
574             'mojo_js_unittests',
575           ],
576           'includes': [
577             '../build/isolate.gypi',
578             'mojo_js_unittests.isolate',
579           ],
580           'sources': [
581             'mojo_js_unittests.isolate',
582           ],
583         },
584       ],
585     }],
586   ]