Home | History | Annotate | Download | only in policy
      1 # Copyright (c) 2011 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   'conditions': [
      7     ['OS=="win" or OS=="mac" or OS=="linux"', {
      8       'targets': [
      9         {
     10           # policy_templates has different inputs and outputs, so it can't use
     11           # the rules of chrome_strings
     12           'target_name': 'policy_templates',
     13           'type': 'none',
     14           'variables': {
     15             'grit_grd_file': 'policy_templates.grd',
     16             'grit_info_cmd': ['python', '<(DEPTH)/tools/grit/grit_info.py',
     17                               '<@(grit_defines)'],
     18           },
     19           'includes': [ '../../../build/grit_target.gypi' ],
     20           'actions': [
     21             {
     22               'action_name': 'policy_templates',
     23               'includes': [ '../../../build/grit_action.gypi' ],
     24             },
     25           ],
     26           'conditions': [
     27             ['OS=="win"', {
     28               'variables': {
     29                 'version_path': '<(grit_out_dir)/app/policy/VERSION',
     30                 'template_files': [
     31                   '<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(grit_grd_file))'
     32                 ],
     33               },
     34               'actions': [
     35                 {
     36                   'action_name': 'add_version',
     37                   'inputs': ['../../VERSION'],
     38                   'outputs': ['<(version_path)'],
     39                   'action': ['cp', '<@(_inputs)', '<@(_outputs)'],
     40                   'msvs_cygwin_shell': 1,
     41                 },
     42                 {
     43                   # Add all the templates generated at the previous step into
     44                   # a zip archive.
     45                   'action_name': 'pack_templates',
     46                   'variables': {
     47                     'zip_script':
     48                         'tools/build/win/make_policy_zip.py'
     49                   },
     50                   'inputs': [
     51                     '<(version_path)',
     52                     '<@(template_files)',
     53                     '<(zip_script)'
     54                   ],
     55                   'outputs': [
     56                     '<(PRODUCT_DIR)/policy_templates.zip'
     57                   ],
     58                   'action': [
     59                     'python',
     60                     '<(zip_script)',
     61                     '--output',
     62                     '<@(_outputs)',
     63                     '--basedir', '<(grit_out_dir)/app/policy',
     64                     # The list of files in the destination zip is derived from
     65                     # the list of output nodes in the following grd file.
     66                     # This whole trickery is necessary because we cannot pass
     67                     # the entire list of file names as command line arguments,
     68                     # because they would exceed the length limit on Windows.
     69                     '--grd_input',
     70                     '<(grit_grd_file)',
     71                     '--grd_strip_path_prefix',
     72                     'app/policy',
     73                     '--extra_input',
     74                     'VERSION',
     75                     # Module to be used to process grd_input'.
     76                     '--grit_info',
     77                     '<(DEPTH)/tools/grit/grit_info.py',
     78                     '<@(grit_defines)',
     79                   ],
     80                   'message': 'Packing generated templates into <(_outputs)',
     81                   'msvs_cygwin_shell': 1,
     82                 }
     83               ]
     84             }],
     85           ],  # conditions
     86         },
     87       ],  # 'targets'
     88     }],  # OS=="win" or OS=="mac" or OS=="linux"
     89     ['OS=="mac"', {
     90       'targets': [
     91         {
     92           # This is the bundle of the manifest file of Chrome.
     93           # It contains the manifest file and its string tables.
     94           'target_name': 'chrome_manifest_bundle',
     95           'type': 'loadable_module',
     96           'mac_bundle': 1,
     97           'product_extension': 'manifest',
     98           'product_name': '<(mac_bundle_id)',
     99           'variables': {
    100             # This avoids stripping debugging symbols from the target, which
    101             # would fail because there is no binary code here.
    102             'mac_strip': 0,
    103           },
    104           'dependencies': [
    105              # Provides app-Manifest.plist and its string tables:
    106             'policy_templates',
    107           ],
    108           'actions': [
    109             {
    110               'action_name': 'Copy MCX manifest file to manifest bundle',
    111               'inputs': [
    112                 '<(grit_out_dir)/app/policy/mac/app-Manifest.plist',
    113               ],
    114               'outputs': [
    115                 '<(INTERMEDIATE_DIR)/app_manifest/<(mac_bundle_id).manifest',
    116               ],
    117               'action': [
    118                 # Use plutil -convert xml1 to put the plist into Apple's
    119                 # canonical format. As a side effect, this ensures that the
    120                 # plist is well-formed.
    121                 'plutil',
    122                 '-convert',
    123                 'xml1',
    124                 '<@(_inputs)',
    125                 '-o',
    126                 '<@(_outputs)',
    127               ],
    128               'message':
    129                 'Copying the MCX policy manifest file to the manifest bundle',
    130               'process_outputs_as_mac_bundle_resources': 1,
    131             },
    132             {
    133               'action_name':
    134                 'Copy Localizable.strings files to manifest bundle',
    135               'variables': {
    136                 'input_path': '<(grit_out_dir)/app/policy/mac/strings',
    137                 # Directory to collect the Localizable.strings files before
    138                 # they are copied to the bundle.
    139                 'output_path': '<(INTERMEDIATE_DIR)/app_manifest',
    140                 # The reason we are not enumerating all the locales is that
    141                 # the translations would eat up 3.5MB disk space in the
    142                 # application bundle:
    143                 'available_locales': 'en',
    144               },
    145               'inputs': [
    146                 # TODO: remove this helper when we have loops in GYP
    147                 '>!@(<(apply_locales_cmd) -d \'<(input_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
    148               ],
    149               'outputs': [
    150                 # TODO: remove this helper when we have loops in GYP
    151                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/Localizable.strings\' <(available_locales))',
    152               ],
    153               'action': [
    154                 'cp', '-R',
    155                 '<(input_path)/',
    156                 '<(output_path)',
    157               ],
    158               'message':
    159                 'Copy the Localizable.strings files to the manifest bundle',
    160               'process_outputs_as_mac_bundle_resources': 1,
    161               'msvs_cygwin_shell': 1,
    162             },
    163           ],
    164         },
    165       ]
    166     }]
    167   ],  # 'conditions'
    168 }
    169