- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / chrome_resources.gyp
1 # Copyright (c) 2012 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.
4 {
5   'variables': {
6     'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
7     'about_credits_file': '<(SHARED_INTERMEDIATE_DIR)/about_credits.html',
8     'additional_modules_list_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/internal/additional_modules_list.txt',
9     'repack_locales_cmd': ['python', 'tools/build/repack_locales.py'],
10   },
11   'targets': [
12     {
13       'target_name': 'chrome_extra_resources',
14       'type': 'none',
15       # These resources end up in resources.pak because they are resources
16       # used by internal pages.  Putting them in a separate pak file makes
17       # it easier for us to reference them internally.
18       'actions': [
19         {
20           'action_name': 'memory_internals_resources',
21           'variables': {
22             'grit_grd_file': 'browser/resources/memory_internals_resources.grd',
23           },
24           'includes': [ '../build/grit_action.gypi' ],
25         },
26         {
27           'action_name': 'net_internals_resources',
28           'variables': {
29             'grit_grd_file': 'browser/resources/net_internals_resources.grd',
30           },
31           'includes': [ '../build/grit_action.gypi' ],
32         },
33         {
34           'action_name': 'signin_internals_resources',
35           'variables': {
36             'grit_grd_file': 'browser/resources/signin_internals_resources.grd',
37             },
38           'includes': ['../build/grit_action.gypi' ],
39         },
40         {
41           'action_name': 'sync_internals_resources',
42           'variables': {
43             'grit_grd_file': 'browser/resources/sync_internals_resources.grd',
44           },
45           'includes': [ '../build/grit_action.gypi' ],
46         },
47         {
48           'action_name': 'translate_internals_resources',
49           'variables': {
50             'grit_grd_file': 'browser/resources/translate_internals_resources.grd',
51           },
52           'includes': [ '../build/grit_action.gypi' ],
53         },
54       ],
55       'includes': [ '../build/grit_target.gypi' ],
56       'conditions': [
57         ['OS != "ios"', {
58           'dependencies': [
59             '../components/components.gyp:dom_distiller_resources',
60             '../content/browser/devtools/devtools_resources.gyp:devtools_resources',
61             '../content/browser/tracing/tracing_resources.gyp:tracing_resources',
62           ],
63           'actions': [
64             {
65               'action_name': 'component_extension_resources',
66               'variables': {
67                 'grit_grd_file': 'browser/resources/component_extension_resources.grd',
68               },
69               'includes': [ '../build/grit_action.gypi' ],
70             },
71             {
72               'action_name': 'options_resources',
73               'variables': {
74                 'grit_grd_file': 'browser/resources/options_resources.grd',
75               },
76               'includes': [ '../build/grit_action.gypi' ],
77             },
78             {
79               'action_name': 'quota_internals_resources',
80               'variables': {
81                 'grit_grd_file': 'browser/resources/quota_internals_resources.grd',
82               },
83               'includes': [ '../build/grit_action.gypi' ],
84             },
85             {
86               'action_name': 'devtools_discovery_page_resources',
87               'variables': {
88                 'grit_grd_file':
89                    'browser/devtools/frontend/devtools_discovery_page_resources.grd',
90               },
91               'includes': [ '../build/grit_action.gypi' ]
92             },
93             {
94               'action_name': 'sync_file_system_internals_resources',
95               'variables': {
96                 'grit_grd_file': 'browser/resources/sync_file_system_internals_resources.grd',
97               },
98               'includes': [ '../build/grit_action.gypi' ],
99             },
100           ],
101           'copies': [
102             {
103               'destination': '<(PRODUCT_DIR)/resources/extension/demo',
104               'files': [
105                 'browser/resources/extension_resource/demo/library.js',
106               ],
107             },
108           ],
109         }],
110       ],
111     },
112     {
113       'target_name': 'chrome_internal_resources_gen',
114       'type': 'none',
115       'conditions': [
116         ['branding=="Chrome"', {
117           'actions': [
118             {
119               'action_name': 'transform_additional_modules_list',
120               'variables': {
121                 'additional_modules_input_path':
122                   'browser/internal/resources/additional_modules_list.input',
123                 'additional_modules_py_path':
124                   'browser/internal/transform_additional_modules_list.py',
125               },
126               'inputs': [
127                 '<(additional_modules_input_path)',
128               ],
129               'outputs': [
130                 '<(additional_modules_list_file)',
131               ],
132               'action': [
133                 'python',
134                 '<(additional_modules_py_path)',
135                 '<(additional_modules_input_path)',
136                 '<@(_outputs)',
137               ],
138               'message': 'Transforming additional modules list.',
139             }
140           ],
141         }],
142       ],
143     },
144     {
145       # TODO(mark): It would be better if each static library that needed
146       # to run grit would list its own .grd files, but unfortunately some
147       # of the static libraries currently have circular dependencies among
148       # generated headers.
149       'target_name': 'chrome_resources',
150       'type': 'none',
151       'dependencies': [
152         'about_credits',
153         'chrome_internal_resources_gen',
154       ],
155       'actions': [
156         # Data resources.
157         {
158           'action_name': 'browser_resources',
159           'variables': {
160             'grit_grd_file': 'browser/browser_resources.grd',
161             'grit_additional_defines': [
162               '-E', 'about_credits_file=<(about_credits_file)',
163               '-E', 'additional_modules_list_file=<(additional_modules_list_file)',
164             ],
165           },
166           'includes': [ '../build/grit_action.gypi' ],
167         },
168         {
169           'action_name': 'common_resources',
170           'variables': {
171             'grit_grd_file': 'common/common_resources.grd',
172           },
173           'includes': [ '../build/grit_action.gypi' ],
174         },
175         {
176           'action_name': 'renderer_resources',
177           'variables': {
178             'grit_grd_file': 'renderer/resources/renderer_resources.grd',
179           },
180           'includes': [ '../build/grit_action.gypi' ],
181         },
182       ],
183       'conditions': [
184         ['enable_extensions==1', {
185           'actions': [
186             {
187               'action_name': 'extensions_api_resources',
188               'variables': {
189                 'grit_grd_file': 'common/extensions_api_resources.grd',
190               },
191               'includes': [ '../build/grit_action.gypi' ],
192             }
193           ],
194         }],
195       ],
196       'includes': [ '../build/grit_target.gypi' ],
197     },
198     {
199       # TODO(mark): It would be better if each static library that needed
200       # to run grit would list its own .grd files, but unfortunately some
201       # of the static libraries currently have circular dependencies among
202       # generated headers.
203       'target_name': 'chrome_strings',
204       'type': 'none',
205       'actions': [
206         # Localizable resources.
207         {
208           'action_name': 'locale_settings',
209           'variables': {
210             'grit_grd_file': 'app/resources/locale_settings.grd',
211           },
212           'includes': [ '../build/grit_action.gypi' ],
213         },
214         {
215           'action_name': 'chromium_strings.grd',
216           'variables': {
217             'grit_grd_file': 'app/chromium_strings.grd',
218           },
219           'includes': [ '../build/grit_action.gypi' ],
220         },
221         {
222           'action_name': 'generated_resources',
223           'variables': {
224             'grit_grd_file': 'app/generated_resources.grd',
225           },
226           'includes': [ '../build/grit_action.gypi' ],
227         },
228         {
229           'action_name': 'google_chrome_strings',
230           'variables': {
231             'grit_grd_file': 'app/google_chrome_strings.grd',
232           },
233           'includes': [ '../build/grit_action.gypi' ],
234         },
235       ],
236       'includes': [ '../build/grit_target.gypi' ],
237     },
238     {
239       'target_name': 'platform_locale_settings',
240       'type': 'none',
241       'variables': {
242         'conditions': [
243           ['OS=="win"', {
244             'platform_locale_settings_grd':
245                 'app/resources/locale_settings_win.grd',
246           },],
247           ['OS=="linux"', {
248             'conditions': [
249               ['chromeos==1', {
250                 'conditions': [
251                   ['branding=="Chrome"', {
252                     'platform_locale_settings_grd':
253                         'app/resources/locale_settings_google_chromeos.grd',
254                   }, {  # branding!=Chrome
255                     'platform_locale_settings_grd':
256                         'app/resources/locale_settings_chromiumos.grd',
257                   }],
258                 ]
259               }, {  # chromeos==0
260                 'platform_locale_settings_grd':
261                     'app/resources/locale_settings_linux.grd',
262               }],
263             ],
264           },],
265           ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "linux"', {
266             'platform_locale_settings_grd':
267                 'app/resources/locale_settings_linux.grd',
268           },],
269           ['OS == "mac" or OS == "ios"', {
270             'platform_locale_settings_grd':
271                 'app/resources/locale_settings_mac.grd',
272           }],
273         ],  # conditions
274       },  # variables
275       'actions': [
276         {
277           'action_name': 'platform_locale_settings',
278           'variables': {
279             'grit_grd_file': '<(platform_locale_settings_grd)',
280           },
281           'includes': [ '../build/grit_action.gypi' ],
282         },
283       ],
284       'includes': [ '../build/grit_target.gypi' ],
285     },
286     {
287       'target_name': 'theme_resources_gen',
288       'type': 'none',
289       'actions': [
290         {
291           'action_name': 'theme_resources',
292           'variables': {
293             'grit_grd_file': 'app/theme/theme_resources.grd',
294           },
295           'includes': [ '../build/grit_action.gypi' ],
296         },
297       ],
298       'includes': [ '../build/grit_target.gypi' ],
299     },
300     {
301       'target_name': 'theme_resources',
302       'type': 'none',
303       'dependencies': [
304         'chrome_unscaled_resources',
305         'theme_resources_gen',
306         '<(DEPTH)/ui/ui.gyp:ui_resources',
307       ],
308     },
309     {
310       'target_name': 'packed_extra_resources',
311       'type': 'none',
312       'variables': {
313         'repack_path': '../tools/grit/grit/format/repack.py',
314       },
315       'dependencies': [
316         'chrome_extra_resources',
317         'packed_resources',
318       ],
319       'actions': [
320         {
321           'includes': ['chrome_repack_resources.gypi']
322         },
323       ],
324       'conditions': [
325         ['OS != "mac" and OS != "ios"', {
326           # We'll install the resource files to the product directory.  The Mac
327           # copies the results over as bundle resources in its own special way.
328           'copies': [
329             {
330               'destination': '<(PRODUCT_DIR)',
331               'files': [
332                 '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak'
333               ],
334             },
335           ],
336         }],
337       ],
338     },
339     {
340       'target_name': 'packed_resources',
341       'type': 'none',
342       'variables': {
343         'repack_path': '../tools/grit/grit/format/repack.py',
344       },
345       'dependencies': [
346         # MSVS needs the dependencies explictly named, Make is able to
347         # derive the dependencies from the output files.
348         'chrome_resources',
349         'chrome_strings',
350         'platform_locale_settings',
351         'theme_resources',
352         '<(DEPTH)/components/component_strings.gyp:component_strings',
353         '<(DEPTH)/net/net.gyp:net_resources',
354         '<(DEPTH)/ui/base/strings/ui_strings.gyp:ui_strings',
355         '<(DEPTH)/ui/ui.gyp:ui_resources',
356       ],
357       'actions': [
358         {
359           'includes': ['chrome_repack_chrome.gypi']
360         },
361         {
362           'includes': ['chrome_repack_locales.gypi']
363         },
364         {
365           'includes': ['chrome_repack_pseudo_locales.gypi']
366         },
367         {
368           'includes': ['chrome_repack_chrome_100_percent.gypi']
369         },
370         {
371           'includes': ['chrome_repack_chrome_200_percent.gypi']
372         },
373         {
374           'includes': ['chrome_repack_chrome_touch_100_percent.gypi']
375         },
376       ],
377       'conditions': [
378         ['OS != "ios"', {
379           'dependencies': [
380             # TODO(zork): Protect this with if use_aura==1
381             '<(DEPTH)/ash/ash_strings.gyp:ash_strings',
382             '<(DEPTH)/content/content_resources.gyp:content_resources',
383             '<(DEPTH)/device/bluetooth/bluetooth_strings.gyp:device_bluetooth_strings',
384             '<(DEPTH)/webkit/webkit_resources.gyp:webkit_resources',
385             '<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
386           ],
387         }],
388         ['use_ash==1', {
389           'dependencies': [
390              '<(DEPTH)/ash/ash.gyp:ash_resources',
391           ],
392         }],
393         ['OS != "mac" and OS != "ios"', {
394           # Copy pak files to the product directory. These files will be picked
395           # up by the following installer scripts:
396           #   - Windows: chrome/installer/mini_installer/chrome.release
397           #   - Linux: chrome/installer/linux/internal/common/installer.include
398           # Ensure that the above scripts are updated when adding or removing
399           # pak files.
400           # Copying files to the product directory is not needed on the Mac
401           # since the framework build phase will copy them into the framework
402           # bundle directly.
403           'copies': [
404             {
405               'destination': '<(PRODUCT_DIR)',
406               'files': [
407                 '<(SHARED_INTERMEDIATE_DIR)/repack/chrome.pak'
408               ],
409             },
410             {
411               'destination': '<(PRODUCT_DIR)',
412               'files': [
413                 '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_100_percent.pak'
414               ],
415             },
416             {
417               'destination': '<(PRODUCT_DIR)/locales',
418               'files': [
419                 '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))'
420               ],
421             },
422             {
423               'destination': '<(PRODUCT_DIR)/pseudo_locales',
424               'files': [
425                 '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(pseudo_locales))'
426               ],
427             },
428           ],
429           'conditions': [
430             ['branding=="Chrome"', {
431               'copies': [
432                 {
433                   # This location is for the Windows and Linux builds. For
434                   # Windows, the chrome.release file ensures that these files
435                   # are copied into the installer. Note that we have a separate
436                   # section in chrome_dll.gyp to copy these files for Mac, as it
437                   # needs to be dropped inside the framework.
438                   'destination': '<(PRODUCT_DIR)/default_apps',
439                   'files': ['<@(default_apps_list)']
440                 },
441               ],
442             }],
443             ['enable_hidpi == 1 and OS!="win"', {
444               'copies': [
445                 {
446                   'destination': '<(PRODUCT_DIR)',
447                   'files': [
448                     '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_200_percent.pak',
449                   ],
450                 },
451               ],
452             }],
453             ['enable_touch_ui==1', {
454               'copies': [
455                 {
456                   'destination': '<(PRODUCT_DIR)',
457                   'files': [
458                     '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_touch_100_percent.pak',
459                   ],
460                 },
461               ],
462             }],
463           ], # conditions
464         }], # end OS != "mac" and OS != "ios"
465       ], # conditions
466     },
467     {
468       'target_name': 'chrome_unscaled_resources',
469       'type': 'none',
470       'variables': {
471         'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
472       },
473       'actions': [
474         {
475           'action_name': 'chrome_unscaled_resources',
476           'variables': {
477             'grit_grd_file': 'app/theme/chrome_unscaled_resources.grd',
478           },
479           'includes': [ '../build/grit_action.gypi' ],
480         },
481       ],
482       'includes': [ '../build/grit_target.gypi' ],
483     },
484     {
485       'target_name': 'about_credits',
486       'type': 'none',
487       'actions': [
488         {
489           'variables': {
490             'generator_path': '../tools/licenses.py',
491           },
492           'action_name': 'generate_about_credits',
493           'inputs': [
494             # TODO(phajdan.jr): make licenses.py print inputs too.
495             '<(generator_path)',
496           ],
497           'outputs': [
498             '<(about_credits_file)',
499           ],
500           'hard_dependency': 1,
501           'action': ['python',
502                      '<(generator_path)',
503                      'credits',
504                      '<(about_credits_file)',
505           ],
506           'message': 'Generating about:credits',
507         },
508       ],
509     },
510   ], # targets
511 }