Refactoring devtools_bridge JNI_OnLoad
[chromium-blink-merge.git] / chromecast / chromecast.gyp
blob6543a00752599b1b568bb9c53850100d21c3b884
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.
6   'variables': {
7     'android_support_v13_target%':
8         '../third_party/android_tools/android_tools.gyp:android_support_v13_javalib',
9     'cast_build_release': 'internal/build/cast_build_release',
10     'chromium_code': 1,
11     'chromecast_branding%': 'Chromium',
12     'disable_display%': 0,
13     'use_chromecast_webui%': 0,
14   },
15   'includes': [
16     'chromecast_tests.gypi',
17   ],
18   'target_defaults': {
19     'include_dirs': [
20       '..',  # Root of Chromium checkout
21     ],
22     'conditions': [
23       ['disable_display==1', {
24         'defines': ['DISABLE_DISPLAY'],
25       }],
26     ],
27   },
28   'targets': [
29     # TODO(gunsch): Remove this fake target once it's either added or no
30     # longer referenced from internal code.
31     {'target_name': 'cast_media_audio', 'type': 'none'},
33     {
34       'target_name': 'cast_base',
35       'type': '<(component)',
36       'dependencies': [
37         '../base/base.gyp:base',
38       ],
39       'sources': [
40         'base/metrics/cast_histograms.h',
41         'base/metrics/cast_metrics_helper.cc',
42         'base/metrics/cast_metrics_helper.h',
43         'base/metrics/grouped_histogram.cc',
44         'base/metrics/grouped_histogram.h'
45       ],
46     },  # end of target 'cast_base'
47     {
48       'target_name': 'cast_crash_client',
49       'type': '<(component)',
50       'dependencies': [
51         '../breakpad/breakpad.gyp:breakpad_client',
52         '../components/components.gyp:crash_component',
53       ],
54       'sources': [
55         'crash/cast_crash_keys.cc',
56         'crash/cast_crash_keys.h',
57         'crash/cast_crash_reporter_client.cc',
58         'crash/cast_crash_reporter_client.h',
59       ],
60       'conditions': [
61         ['chromecast_branding=="Chrome"', {
62           'dependencies': [
63             '<(cast_internal_gyp):crash_internal',
64           ],
65         }, {
66           'sources': [
67             'crash/cast_crash_reporter_client_simple.cc',
68           ],
69         }],
70       ]
71     },  # end of target 'cast_crash_client'
72     {
73       'target_name': 'cast_net',
74       'type': '<(component)',
75       'sources': [
76         'net/connectivity_checker.cc',
77         'net/connectivity_checker.h',
78         'net/net_switches.cc',
79         'net/net_switches.h',
80       ],
81     },
82     {
83       'target_name': 'cast_shell_resources',
84       'type': 'none',
85       'variables': {
86         'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chromecast',
87       },
88       'actions': [
89         {
90           'action_name': 'cast_shell_resources',
91           'variables': {
92             'grit_grd_file': 'app/resources/shell_resources.grd',
93             'grit_resource_ids': 'app/resources/resource_ids',
94           },
95           'includes': [ '../build/grit_action.gypi' ],
96         },
97       ],
98       'includes': [ '../build/grit_target.gypi' ],
99     },
100     {
101       'target_name': 'cast_shell_pak',
102       'type': 'none',
103       'dependencies': [
104         'cast_shell_resources',
105         '../content/app/resources/content_resources.gyp:content_resources',
106         '../content/app/strings/content_strings.gyp:content_strings',
107         '../net/net.gyp:net_resources',
108         '../third_party/WebKit/public/blink_resources.gyp:blink_resources',
109         '../ui/resources/ui_resources.gyp:ui_resources',
110         '../ui/strings/ui_strings.gyp:ui_strings',
111       ],
112       'actions': [
113         {
114           'action_name': 'repack_cast_shell_pak',
115           'variables': {
116             'pak_inputs': [
117               '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak',
118               '<(SHARED_INTERMEDIATE_DIR)/chromecast/shell_resources.pak',
119               '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
120               '<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_100_percent.pak',
121               '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_en-US.pak',
122               '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
123               '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak',
124               '<(SHARED_INTERMEDIATE_DIR)/ui/resources/webui_resources.pak',
125               '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak',
126               '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak',
127             ],
128             'conditions': [
129               ['chromecast_branding=="Chrome" and use_chromecast_webui==1', {
130                 'pak_inputs': [
131                   '<(SHARED_INTERMEDIATE_DIR)/chromecast/app_resources.pak',
132                   '<(SHARED_INTERMEDIATE_DIR)/chromecast/cast_webui_resources.pak',
133                 ],
134               }],
135             ],
136             'pak_output': '<(PRODUCT_DIR)/assets/cast_shell.pak',
137           },
138           'includes': [ '../build/repack_action.gypi' ],
139         },
140       ],
141       'conditions': [
142         ['chromecast_branding=="Chrome" and use_chromecast_webui==1', {
143           'dependencies': [
144             'internal/chromecast_resources.gyp:chromecast_app_resources',
145             'internal/chromecast_resources.gyp:chromecast_webui_resources',
146           ],
147         }],
148       ],
149     },  # end of target 'cast_shell_pak'
150     # This target contains all content-embedder implementation that is
151     # non-platform-specific.
152     {
153       'target_name': 'cast_shell_common',
154       'type': '<(component)',
155       'dependencies': [
156         'cast_base',
157         'cast_crash_client',
158         'cast_net',
159         'cast_shell_pak',
160         'cast_shell_resources',
161         'cast_version_header',
162         'chromecast_locales.gyp:chromecast_locales_pak',
163         'chromecast_locales.gyp:chromecast_settings',
164         'media/media.gyp:media_base',
165         '../base/base.gyp:base',
166         '../components/components.gyp:breakpad_host',
167         '../components/components.gyp:cdm_renderer',
168         '../components/components.gyp:component_metrics_proto',
169         '../components/components.gyp:crash_component',
170         '../components/components.gyp:network_hints_browser',
171         '../components/components.gyp:network_hints_renderer',
172         '../components/components.gyp:metrics',
173         '../components/components.gyp:metrics_gpu',
174         '../components/components.gyp:metrics_net',
175         '../components/components.gyp:metrics_profiler',
176         '../content/content.gyp:content',
177         '../content/content.gyp:content_app_both',
178         '../skia/skia.gyp:skia',
179         '../third_party/WebKit/public/blink.gyp:blink',
180         '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
181       ],
182       'sources': [
183         'app/cast_main_delegate.cc',
184         'app/cast_main_delegate.h',
185         'browser/cast_browser_context.cc',
186         'browser/cast_browser_context.h',
187         'browser/cast_browser_main_parts.cc',
188         'browser/cast_browser_main_parts.h',
189         'browser/cast_browser_process.cc',
190         'browser/cast_browser_process.h',
191         'browser/cast_content_browser_client.cc',
192         'browser/cast_content_browser_client.h',
193         'browser/cast_content_window.cc',
194         'browser/cast_content_window.h',
195         'browser/cast_download_manager_delegate.cc',
196         'browser/cast_download_manager_delegate.h',
197         'browser/cast_http_user_agent_settings.cc',
198         'browser/cast_http_user_agent_settings.h',
199         'browser/cast_network_delegate.cc',
200         'browser/cast_network_delegate.h',
201         'browser/cast_resource_dispatcher_host_delegate.cc',
202         'browser/cast_resource_dispatcher_host_delegate.h',
203         'browser/devtools/cast_dev_tools_delegate.cc',
204         'browser/devtools/cast_dev_tools_delegate.h',
205         'browser/devtools/remote_debugging_server.cc',
206         'browser/devtools/remote_debugging_server.h',
207         'browser/geolocation/cast_access_token_store.cc',
208         'browser/geolocation/cast_access_token_store.h',
209         'browser/metrics/cast_metrics_prefs.cc',
210         'browser/metrics/cast_metrics_prefs.h',
211         'browser/metrics/cast_metrics_service_client.cc',
212         'browser/metrics/cast_metrics_service_client.h',
213         'browser/metrics/cast_stability_metrics_provider.cc',
214         'browser/metrics/cast_stability_metrics_provider.h',
215         'browser/metrics/platform_metrics_providers.h',
216         'browser/pref_service_helper.cc',
217         'browser/pref_service_helper.h',
218         'browser/service/cast_service.cc',
219         'browser/service/cast_service.h',
220         'browser/url_request_context_factory.cc',
221         'browser/url_request_context_factory.h',
222         'common/cast_content_client.cc',
223         'common/cast_content_client.h',
224         'common/cast_paths.cc',
225         'common/cast_paths.h',
226         'common/cast_resource_delegate.cc',
227         'common/cast_resource_delegate.h',
228         'common/chromecast_switches.cc',
229         'common/chromecast_switches.h',
230         'common/media/cast_messages.h',
231         'common/media/cast_message_generator.cc',
232         'common/media/cast_message_generator.h',
233         'common/platform_client_auth.h',
234         'common/pref_names.cc',
235         'common/pref_names.h',
236         'renderer/cast_content_renderer_client.cc',
237         'renderer/cast_content_renderer_client.h',
238         'renderer/cast_media_load_deferrer.cc',
239         'renderer/cast_media_load_deferrer.h',
240         'renderer/cast_render_process_observer.cc',
241         'renderer/cast_render_process_observer.h',
242         'renderer/key_systems_cast.cc',
243         'renderer/key_systems_cast.h',
244         'renderer/media/capabilities_message_filter.cc',
245         'renderer/media/capabilities_message_filter.h',
246       ],
247       'conditions': [
248         ['chromecast_branding=="Chrome"', {
249           'dependencies': [
250             '<(cast_internal_gyp):cast_shell_internal',
251           ],
252         }, {
253           'sources': [
254             'browser/cast_content_browser_client_simple.cc',
255             'browser/cast_network_delegate_simple.cc',
256             'browser/devtools/remote_debugging_server_simple.cc',
257             'browser/media/cast_browser_cdm_factory_simple.cc',
258             'browser/metrics/platform_metrics_providers_simple.cc',
259             'browser/pref_service_helper_simple.cc',
260             'common/platform_client_auth_simple.cc',
261             'renderer/cast_content_renderer_client_simple.cc',
262             'renderer/key_systems_cast_simple.cc',
263           ],
264           'conditions': [
265             ['OS=="android"', {
266               'sources': [
267                 'browser/service/cast_service_android.cc',
268                 'browser/service/cast_service_android.h',
269               ],
270             }, {
271               'sources': [
272                 'browser/service/cast_service_simple.cc',
273                 'browser/service/cast_service_simple.h',
274               ],
275             }],
276           ],
277         }],
278         # ExternalMetrics not necessary on Android and (as of this writing) uses
279         # non-portable filesystem operations. Also webcrypto is not used on
280         # Android either.
281         ['OS=="linux"', {
282           'sources': [
283             'browser/metrics/external_metrics.cc',
284             'browser/metrics/external_metrics.h',
285           ],
286           'dependencies': [
287             '../components/components.gyp:metrics_serialization',
288           ],
289         }],
290       ],
291     },
292     {
293       'target_name': 'cast_version_header',
294       'type': 'none',
295       'direct_dependent_settings': {
296         'include_dirs': [
297           '<(SHARED_INTERMEDIATE_DIR)',
298         ],
299       },
300       'actions': [
301         {
302           'action_name': 'version_header',
303           'message': 'Generating version header file: <@(_outputs)',
304           'inputs': [
305             '<(version_path)',
306             'common/version.h.in',
307           ],
308           'outputs': [
309             '<(SHARED_INTERMEDIATE_DIR)/chromecast/common/version.h',
310           ],
311           'action': [
312             'python',
313             '<(version_py_path)',
314             '-e', 'VERSION_FULL="<(version_full)"',
315             # CAST_BUILD_INCREMENTAL is taken from buildbot if available;
316             # otherwise, a dev string is used.
317             '-e', 'CAST_BUILD_INCREMENTAL="<!(echo ${CAST_BUILD_INCREMENTAL:="<!(date +%Y%m%d.%H%M%S)"})"',
318             # CAST_BUILD_RELEASE is taken from cast_build_release file if exist;
319             # otherwise, a dev string is used.
320             '-e', 'CAST_BUILD_RELEASE="<!(if test -f <(cast_build_release); then cat <(cast_build_release); else echo eng.${USER}; fi)"',
321             '-e', 'CAST_IS_DEBUG_BUILD=1 if "<(CONFIGURATION_NAME)" == "Debug" else 0',
322             'common/version.h.in',
323             '<@(_outputs)',
324           ],
325           'includes': [
326             '../build/util/version.gypi',
327           ],
328         },
329       ],
330     },
331   ],  # end of targets
333   # Targets for Android receiver.
334   'conditions': [
335     ['OS=="android"', {
336       'targets': [
337         {
338           'target_name': 'cast_shell_icudata',
339           'type': 'none',
340           'dependencies': [
341             '../third_party/icu/icu.gyp:icudata',
342           ],
343           'copies': [{
344             'destination': '<(PRODUCT_DIR)/assets',
345             'files': ['<(PRODUCT_DIR)/icudtl.dat'],
346           }],
347         },
348         {
349           'target_name': 'libcast_shell_android',
350           'type': 'shared_library',
351           'dependencies': [
352             'cast_jni_headers',
353             'cast_shell_common',
354             'cast_shell_icudata',
355             'cast_shell_pak',
356             'cast_version_header',
357             '../base/base.gyp:base',
358             '../breakpad/breakpad.gyp:breakpad_client',
359             '../components/components.gyp:breakpad_host',
360             '../components/components.gyp:crash_component',
361             '../content/content.gyp:content',
362             '../skia/skia.gyp:skia',
363             '../ui/gfx/gfx.gyp:gfx',
364             '../ui/gl/gl.gyp:gl',
365           ],
366           'include_dirs': [
367             '../breakpad/src',
368           ],
369           'sources': [
370             'android/cast_jni_registrar.cc',
371             'android/cast_jni_registrar.h',
372             'android/chromecast_config_android.cc',
373             'android/chromecast_config_android.h',
374             'android/platform_jni_loader.h',
375             'app/android/cast_jni_loader.cc',
376             'browser/android/cast_window_android.cc',
377             'browser/android/cast_window_android.h',
378             'browser/android/cast_window_manager.cc',
379             'browser/android/cast_window_manager.h',
380             'browser/android/external_video_surface_container_impl.cc',
381             'browser/android/external_video_surface_container_impl.h',
382             'crash/android/cast_crash_reporter_client_android.cc',
383             'crash/android/cast_crash_reporter_client_android.h',
384             'crash/android/crash_handler.cc',
385             'crash/android/crash_handler.h',
386           ],
387           'conditions': [
388             ['chromecast_branding=="Chrome"', {
389               'dependencies': [
390                 '<(cast_internal_gyp):cast_shell_android_internal'
391               ],
392             }, {
393               'sources': [
394                 'android/chromecast_config_android_stub.cc',
395                 'android/platform_jni_loader_stub.cc',
396               ],
397             }]
398           ],
399         },  # end of target 'libcast_shell_android'
400         {
401           'target_name': 'cast_shell_java',
402           'type': 'none',
403           'dependencies': [
404             '<(android_support_v13_target)',
405             '../base/base.gyp:base_java',
406             '../content/content.gyp:content_java',
407             '../media/media.gyp:media_java',
408             '../net/net.gyp:net_java',
409             '../ui/android/ui_android.gyp:ui_java',
410           ],
411           'variables': {
412             'has_java_resources': 1,
413             'java_in_dir': 'browser/android/apk',
414             'resource_dir': 'browser/android/apk/res',
415             'R_package': 'org.chromium.chromecast.shell',
416           },
417           'includes': ['../build/java.gypi'],
418         },  # end of target 'cast_shell_java'
419         {
420           'target_name': 'cast_shell_manifest',
421           'type': 'none',
422           'variables': {
423             'jinja_inputs': ['browser/android/apk/AndroidManifest.xml.jinja2'],
424             'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/cast_shell_manifest/AndroidManifest.xml',
425           },
426           'includes': [ '../build/android/jinja_template.gypi' ],
427         },
428         {
429           'target_name': 'cast_shell_apk',
430           'type': 'none',
431           'dependencies': [
432             'cast_shell_java',
433             'libcast_shell_android',
434           ],
435           'variables': {
436             'apk_name': 'CastShell',
437             'manifest_package_name': 'org.chromium.chromecast.shell',
438             # Note(gunsch): there are no Java files in the android/ directory.
439             # Unfortunately, the java_apk.gypi target rigidly insists on having
440             # a java_in_dir directory, but complains about duplicate classes
441             # from the common cast_shell_java target (shared with internal APK)
442             # if the actual Java path is used.
443             # This will hopefully be removable after the great GN migration.
444             'java_in_dir': 'android',
445             'android_manifest_path': '<(SHARED_INTERMEDIATE_DIR)/cast_shell_manifest/AndroidManifest.xml',
446             'package_name': 'org.chromium.chromecast.shell',
447             'native_lib_target': 'libcast_shell_android',
448             'asset_location': '<(PRODUCT_DIR)/assets',
449             'additional_input_paths': ['<(PRODUCT_DIR)/assets/cast_shell.pak'],
450           },
451           'includes': [ '../build/java_apk.gypi' ],
452         },
453         {
454           'target_name': 'cast_jni_headers',
455           'type': 'none',
456           'sources': [
457             'browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java',
458             'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java',
459             'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java',
460             'browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java',
461           ],
462           'direct_dependent_settings': {
463             'include_dirs': [
464               '<(SHARED_INTERMEDIATE_DIR)/chromecast',
465             ],
466           },
467           'variables': {
468             'jni_gen_package': 'chromecast',
469           },
470           'includes': [ '../build/jni_generator.gypi' ],
471         },
472       ],  # end of targets
473     }, {  # OS != "android"
474       'targets': [
475         {
476           'target_name': 'cast_shell_media',
477           'type': '<(component)',
478           'dependencies': [
479             'media/media.gyp:cast_media',
480             '../content/content.gyp:content',
481             '../ipc/ipc.gyp:ipc',
482             '../media/media.gyp:media',
483           ],
484           'sources': [
485             'browser/media/cast_browser_cdm_factory.cc',
486             'browser/media/cast_browser_cdm_factory.h',
487             'browser/media/cma_message_filter_host.cc',
488             'browser/media/cma_message_filter_host.h',
489             'browser/media/cma_message_loop.cc',
490             'browser/media/cma_message_loop.h',
491             'browser/media/media_pipeline_host.cc',
492             'browser/media/media_pipeline_host.h',
493             'common/media/cma_ipc_common.h',
494             'common/media/cma_messages.h',
495             'common/media/cma_message_generator.cc',
496             'common/media/cma_message_generator.h',
497             'common/media/cma_param_traits.cc',
498             'common/media/cma_param_traits.h',
499             'common/media/shared_memory_chunk.cc',
500             'common/media/shared_memory_chunk.h',
501             'renderer/media/audio_pipeline_proxy.cc',
502             'renderer/media/audio_pipeline_proxy.h',
503             'renderer/media/chromecast_media_renderer_factory.cc',
504             'renderer/media/chromecast_media_renderer_factory.h',
505             'renderer/media/cma_message_filter_proxy.cc',
506             'renderer/media/cma_message_filter_proxy.h',
507             'renderer/media/media_channel_proxy.cc',
508             'renderer/media/media_channel_proxy.h',
509             'renderer/media/media_pipeline_proxy.cc',
510             'renderer/media/media_pipeline_proxy.h',
511             'renderer/media/video_pipeline_proxy.cc',
512             'renderer/media/video_pipeline_proxy.h',
513           ],
514         },  # end of target 'cast_shell_media'
515         # This target contains all of the primary code of |cast_shell|, except
516         # for |main|. This allows end-to-end tests using |cast_shell|.
517         # This also includes all targets that cannot be built on Android.
518         {
519           'target_name': 'cast_shell_core',
520           'type': '<(component)',
521           'dependencies': [
522             'cast_shell_media',
523             'cast_shell_common',
524             'media/media.gyp:cast_media',
525             '../ui/aura/aura.gyp:aura_test_support',
526           ],
527           'conditions': [
528             ['chromecast_branding=="Chrome"', {
529               'dependencies': [
530                 '<(cast_internal_gyp):cast_gfx_internal',
531               ],
532             }, {
533               'dependencies': [
534                 '../ui/ozone/ozone.gyp:eglplatform_shim_x11',
535               ],
536             }],
537           ],
538         },
539         {
540           'target_name': 'cast_shell',
541           'type': 'executable',
542           'dependencies': [
543             'cast_shell_core',
544           ],
545           'sources': [
546             'app/cast_main.cc',
547           ],
548           # TODO(dougsteed): remove when Chromecast moves to boringssl.
549           # Allow the cast shell to find the NSS module in the same directory.
550           'ldflags': [
551             '-Wl,-rpath=\$$ORIGIN'
552           ],
553         },
554       ],  # end of targets
555     }],
556   ],  # end of conditions