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