summaryrefslogtreecommitdiffstats
path: root/build/android/jinja_template.gypi
blob: 7fcddd6d67cb777b51cae297a8ebd560054ec7c0 (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
# Copyright 2014 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.

# This file is meant to be included into a target to process one or more
# Jinja templates.
#
# To process a single template file, create a gyp target with the following
# form:
#  {
#    'target_name': 'chrome_public_manifest',
#    'type': 'none',
#    'variables': {
#      'jinja_inputs': ['android/java/AndroidManifest.xml'],
#      'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_manifest/AndroidManifest.xml',
#      'jinja_variables': ['app_name=ChromePublic'],
#    },
#    'includes': [ '../build/android/jinja_template.gypi' ],
#  },
#
# To process multiple template files and package the results into a zip file,
# create a gyp target with the following form:
#  {
#    'target_name': 'chrome_template_resources',
#    'type': 'none',
#    'variables': {
#       'jinja_inputs_base_dir': 'android/java/res_template',
#       'jinja_inputs': [
#         '<(jinja_inputs_base_dir)/xml/searchable.xml',
#         '<(jinja_inputs_base_dir)/xml/syncadapter.xml',
#       ],
#       'jinja_outputs_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
#       'jinja_variables': ['app_name=ChromePublic'],
#     },
#     'includes': [ '../build/android/jinja_template.gypi' ],
#   },
#

{
  'actions': [
    {
      'action_name': '<(_target_name)_jinja_template',
      'message': 'processing jinja template',
      'variables': {
        'jinja_output%': '',
        'jinja_outputs_zip%': '',
        'jinja_inputs_base_dir%': '',
        'jinja_includes%': [],
        'jinja_variables%': [],
        'jinja_args': [],
      },
      'inputs': [
        '<(DEPTH)/build/android/gyp/util/build_utils.py',
        '<(DEPTH)/build/android/gyp/jinja_template.py',
        '<@(jinja_inputs)',
        '<@(jinja_includes)',
      ],
      'conditions': [
        ['jinja_output != ""', {
          'outputs': [ '<(jinja_output)' ],
          'variables': {
            'jinja_args': ['--output', '<(jinja_output)'],
          },
        }],
        ['jinja_outputs_zip != ""', {
          'outputs': [ '<(jinja_outputs_zip)' ],
          'variables': {
            'jinja_args': ['--outputs-zip', '<(jinja_outputs_zip)'],
          },
        }],
        ['jinja_inputs_base_dir != ""', {
          'variables': {
            'jinja_args': ['--inputs-base-dir', '<(jinja_inputs_base_dir)'],
          },
        }],
      ],
      'action': [
        'python', '<(DEPTH)/build/android/gyp/jinja_template.py',
        '--inputs', '<(jinja_inputs)',
        '--variables', '<(jinja_variables)',
        '<@(jinja_args)',
      ],
    },
  ],
}