Home | History | Annotate | Download | only in build
      1 # Copyright 2014 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 # This file is meant to be included into a target to provide a rule
      6 # to generate localized strings.xml from a grd file.
      7 #
      8 # To use this, create a gyp target with the following form:
      9 # {
     10 #   'target_name': 'my-package_strings_grd',
     11 #   'type': 'none',
     12 #   'variables': {
     13 #     'grd_file': 'path/to/grd/file',
     14 #   },
     15 #   'includes': ['path/to/this/gypi/file'],
     16 # }
     17 #
     18 # Required variables:
     19 #  grd_file - The path to the grd file to use.
     20 {
     21   'variables': {
     22     'res_grit_dir': '<(INTERMEDIATE_DIR)/<(_target_name)/res_grit',
     23     'grit_grd_file': '<(grd_file)',
     24     'resource_zip_path': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
     25     'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
     26     'grit_out_dir': '<(res_grit_dir)',
     27     # resource_ids is unneeded since we don't generate .h headers.
     28     'grit_resource_ids': '',
     29     'grit_outputs': [
     30       '<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) '
     31           '--outputs \'<(grit_out_dir)\' '
     32           '<(grit_grd_file) -f "<(grit_resource_ids)")',
     33           ]
     34   },
     35   'all_dependent_settings': {
     36     'variables': {
     37       'additional_input_paths': ['<(resource_zip_path)'],
     38       'dependencies_res_zip_paths': ['<(resource_zip_path)'],
     39     },
     40   },
     41   'actions': [
     42     {
     43       'action_name': 'generate_localized_strings_xml',
     44       'includes': ['../build/grit_action.gypi'],
     45     },
     46     {
     47       'action_name': 'create_resources_zip',
     48       'inputs': [
     49           '<(DEPTH)/build/android/gyp/zip.py',
     50           '<@(grit_outputs)',
     51       ],
     52       'outputs': [
     53           '<(resource_zip_path)',
     54       ],
     55       'action': [
     56           'python', '<(DEPTH)/build/android/gyp/zip.py',
     57           '--input-dir', '<(res_grit_dir)',
     58           '--output', '<(resource_zip_path)',
     59       ],
     60     }
     61   ],
     62 }
     63