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