Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: build/android/gyp_devil_jinja_processor.py

Issue 1885503002: Revert of [Devil] Replace generated Devil config with jinja template. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/devil_chromium.py ('k') | build/android/setup.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Special script for processing the devil config jinja file.
7
8 This script is needed because the PRODUCT_DIR is not known at gyp time. Many of
9 the jinja variables for the devil template are directories relative to the
10 PRODUCT_DIR. These paths cannot be computed at gyp time and need a separate
11 script.
12 """
13
14 # TODO(mikecase): Delete this script once GYP is removed.
15
16 import argparse
17 import os
18 import subprocess
19 import sys
20
21 JINJA_TEMPLATE_SCRIPT = os.path.join(os.path.dirname(__file__),
22 'gyp', 'jinja_template.py')
23
24 def DevilJinjaProcessor(args):
25
26 gen_dir = os.path.join(args.product_dir, 'gen')
27
28 rebased_android_sdk_root = os.path.relpath(args.android_sdk_root, gen_dir)
29 rebased_product_dir = os.path.relpath(args.product_dir, gen_dir)
30
31 variables = ['android_app_abi=%s' % args.android_abi,
32 'android_sdk_root=%s' % rebased_android_sdk_root,
33 'build_tools_version=%s' % args.build_tools_version,
34 'output_dir=%s' % rebased_product_dir]
35
36 output_file = os.path.join(gen_dir, 'devil_chromium.json')
37
38 cmd = [JINJA_TEMPLATE_SCRIPT,
39 '--inputs', args.input_file_path,
40 '--output', output_file,
41 '--variables', ' '.join(variables)]
42
43 subprocess.call(cmd)
44
45 def main():
46 parser = argparse.ArgumentParser()
47
48 parser.add_argument('--android-abi', required=True,
49 help='Android app abi, e.g. armeabi-v7a.')
50 parser.add_argument('--android-sdk-root', required=True,
51 help='Path to the android sdk root.')
52 parser.add_argument('--build-tools-version', required=True,
53 help='Android build tools version.')
54 parser.add_argument('--input-file-path', required=True,
55 help='Path to input template file.')
56 parser.add_argument('--output-file-name', required=True,
57 help='Name of generated file. Will be put in gen/ '
58 'under product directory.')
59 parser.add_argument('--product-dir', required=True,
60 help='Path to product directory.')
61
62 args = parser.parse_args()
63 DevilJinjaProcessor(args)
64
65 if __name__ == '__main__':
66 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/devil_chromium.py ('k') | build/android/setup.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698