summaryrefslogtreecommitdiffstats
path: root/chrome/policy_templates.gypi
blob: c577f8f72aa3420e0db7b724d5b26e95bc8ea3a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'targets': [
    {
      'target_name': 'pack_policy_templates',
      'type': 'none',
      'conditions': [
        ['OS=="win" or OS=="mac" or OS=="linux"', {
          'dependencies': [
            '../components/components.gyp:policy_templates',
          ],
        }],
        ['OS=="win"', {
          'variables': {
            'version_path': '<(grit_out_dir)/app/policy/VERSION',
          },
          'actions': [
            {
              'action_name': 'add_version',
              'inputs': [
                'VERSION',
              ],
              'outputs': [
                '<(version_path)',
              ],
              'action': [
                'python',
                '../build/cp.py',
                '<@(_inputs)',
                '<@(_outputs)',
              ],
            },
            {
              # Add all the templates generated at the previous step into
              # a zip archive.
              'action_name': 'pack_templates',
              'variables': {
                'grit_grd_file': '../components/policy/resources/policy_templates.grd',
                'grit_info_cmd': [
                  'python',
                  '<(DEPTH)/tools/grit/grit_info.py',
                  '<@(grit_defines)',
                ],
                'template_files': [
                  '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))',
                ],
                'zip_script': '../components/policy/tools/make_policy_zip.py',
              },
              'inputs': [
                '<(version_path)',
                '<@(template_files)',
                '<(zip_script)',
                '<!@pymod_do_main(grit_info <@(grit_defines) '
                    '--inputs "<(grit_grd_file)" '
                    '-f "<(DEPTH)/tools/gritsettings/resource_ids")',
              ],
              'outputs': [
                '<(PRODUCT_DIR)/policy_templates.zip',
              ],
              'action': [
                'python',
                '<(zip_script)',
                '--output',
                '<@(_outputs)',
                '--basedir', '<(grit_out_dir)/app/policy',
                # The list of files in the destination zip is derived from
                # the list of output nodes in the following grd file.
                # This whole trickery is necessary because we cannot pass
                # the entire list of file names as command line arguments,
                # because they would exceed the length limit on Windows.
                '--grd_input',
                '<(grit_grd_file)',
                '--grd_strip_path_prefix',
                'app/policy',
                '--extra_input',
                'VERSION',
                # Module to be used to process grd_input'.
                '--grit_info',
                '<(DEPTH)/tools/grit/grit_info.py',
                '<@(grit_defines)',
              ],
              'message': 'Packing generated templates into <(_outputs)',
            },
          ],
        }],
      ],
    },
  ],
}