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