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 process one or more 6 # Jinja templates. 7 # 8 # To process a single template file, create a gyp target with the following 9 # form: 10 # { 11 # 'target_name': 'chrome_public_manifest', 12 # 'type': 'none', 13 # 'variables': { 14 # 'jinja_inputs': ['android/java/AndroidManifest.xml'], 15 # 'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_manifest/AndroidManifest.xml', 16 # 'jinja_variables': ['app_name=ChromePublic'], 17 # }, 18 # 'includes': [ '../build/android/jinja_template.gypi' ], 19 # }, 20 # 21 # To process multiple template files and package the results into a zip file, 22 # create a gyp target with the following form: 23 # { 24 # 'target_name': 'chrome_template_resources', 25 # 'type': 'none', 26 # 'variables': { 27 # 'jinja_inputs_base_dir': 'android/java/res_template', 28 # 'jinja_inputs': [ 29 # '<(jinja_inputs_base_dir)/xml/searchable.xml', 30 # '<(jinja_inputs_base_dir)/xml/syncadapter.xml', 31 # ], 32 # 'jinja_outputs_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip', 33 # 'jinja_variables': ['app_name=ChromePublic'], 34 # }, 35 # 'includes': [ '../build/android/jinja_template.gypi' ], 36 # }, 37 # 38 39 { 40 'actions': [ 41 { 42 'action_name': '<(_target_name)_jinja_template', 43 'message': 'processing jinja template', 44 'variables': { 45 'jinja_output%': '', 46 'jinja_outputs_zip%': '', 47 'jinja_inputs_base_dir%': '', 48 'jinja_includes%': [], 49 'jinja_variables%': [], 50 'jinja_args': [], 51 }, 52 'inputs': [ 53 '<(DEPTH)/build/android/gyp/util/build_utils.py', 54 '<(DEPTH)/build/android/gyp/jinja_template.py', 55 '<@(jinja_inputs)', 56 '<@(jinja_includes)', 57 ], 58 'conditions': [ 59 ['jinja_output != ""', { 60 'outputs': [ '<(jinja_output)' ], 61 'variables': { 62 'jinja_args': ['--output', '<(jinja_output)'], 63 }, 64 }], 65 ['jinja_outputs_zip != ""', { 66 'outputs': [ '<(jinja_outputs_zip)' ], 67 'variables': { 68 'jinja_args': ['--outputs-zip', '<(jinja_outputs_zip)'], 69 }, 70 }], 71 ['jinja_inputs_base_dir != ""', { 72 'variables': { 73 'jinja_args': ['--inputs-base-dir', '<(jinja_inputs_base_dir)'], 74 }, 75 }], 76 ], 77 'action': [ 78 'python', '<(DEPTH)/build/android/gyp/jinja_template.py', 79 '--inputs', '<(jinja_inputs)', 80 '--variables', '<(jinja_variables)', 81 '<@(jinja_args)', 82 ], 83 }, 84 ], 85 } 86