1# Copyright 2013 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{
6  'targets': [
7    {
8      'target_name': 'pack_policy_templates',
9      'type': 'none',
10      'conditions': [
11        ['OS=="win" or OS=="mac" or OS=="linux"', {
12          'dependencies': [
13            '../components/components.gyp:policy_templates',
14          ],
15        }],
16        ['OS=="win"', {
17          'variables': {
18            'version_path': '<(grit_out_dir)/app/policy/VERSION',
19          },
20          'actions': [
21            {
22              'action_name': 'add_version',
23              'inputs': [
24                'VERSION',
25              ],
26              'outputs': [
27                '<(version_path)',
28              ],
29              'action': [
30                'python',
31                '../build/cp.py',
32                '<@(_inputs)',
33                '<@(_outputs)',
34              ],
35            },
36            {
37              # Add all the templates generated at the previous step into
38              # a zip archive.
39              'action_name': 'pack_templates',
40              'variables': {
41                'grit_grd_file': '../components/policy/resources/policy_templates.grd',
42                'grit_info_cmd': [
43                  'python',
44                  '<(DEPTH)/tools/grit/grit_info.py',
45                  '<@(grit_defines)',
46                ],
47                'template_files': [
48                  '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))',
49                ],
50                'zip_script': '../components/policy/tools/make_policy_zip.py',
51              },
52              'inputs': [
53                '<(version_path)',
54                '<@(template_files)',
55                '<(zip_script)',
56              ],
57              'outputs': [
58                '<(PRODUCT_DIR)/policy_templates.zip',
59              ],
60              'action': [
61                'python',
62                '<(zip_script)',
63                '--output',
64                '<@(_outputs)',
65                '--basedir', '<(grit_out_dir)/app/policy',
66                # The list of files in the destination zip is derived from
67                # the list of output nodes in the following grd file.
68                # This whole trickery is necessary because we cannot pass
69                # the entire list of file names as command line arguments,
70                # because they would exceed the length limit on Windows.
71                '--grd_input',
72                '<(grit_grd_file)',
73                '--grd_strip_path_prefix',
74                'app/policy',
75                '--extra_input',
76                'VERSION',
77                # Module to be used to process grd_input'.
78                '--grit_info',
79                '<(DEPTH)/tools/grit/grit_info.py',
80                '<@(grit_defines)',
81              ],
82              'message': 'Packing generated templates into <(_outputs)',
83            },
84          ],
85        }],
86      ],
87    },
88  ],
89}
90