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

Side by Side Diff: build/android/gyp/dex.py

Issue 1211653002: [Android] Make dex exclude paths relative to output dir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed paths to be relative to output dir. Created 5 years, 6 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/dex_action.gypi ('k') | build/config/android/internal_rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import optparse 7 import optparse
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 dex_cmd += paths 22 dex_cmd += paths
23 23
24 record_path = '%s.md5.stamp' % options.dex_path 24 record_path = '%s.md5.stamp' % options.dex_path
25 md5_check.CallAndRecordIfStale( 25 md5_check.CallAndRecordIfStale(
26 lambda: build_utils.CheckOutput(dex_cmd, print_stderr=False), 26 lambda: build_utils.CheckOutput(dex_cmd, print_stderr=False),
27 record_path=record_path, 27 record_path=record_path,
28 input_paths=paths, 28 input_paths=paths,
29 input_strings=dex_cmd, 29 input_strings=dex_cmd,
30 force=not os.path.exists(options.dex_path)) 30 force=not os.path.exists(options.dex_path))
31 build_utils.WriteJson(paths, options.dex_path + '.inputs') 31 build_utils.WriteJson(
32 [os.path.relpath(p, options.output_directory) for p in paths],
33 options.dex_path + '.inputs')
32 34
33 35
34 def main(): 36 def main():
35 args = build_utils.ExpandFileArgs(sys.argv[1:]) 37 args = build_utils.ExpandFileArgs(sys.argv[1:])
36 38
37 parser = optparse.OptionParser() 39 parser = optparse.OptionParser()
38 build_utils.AddDepfileOption(parser) 40 build_utils.AddDepfileOption(parser)
39 41
40 parser.add_option('--android-sdk-tools', 42 parser.add_option('--android-sdk-tools',
41 help='Android sdk build tools directory.') 43 help='Android sdk build tools directory.')
44 parser.add_option('--output-directory',
45 help='Path to the output build directory.')
cjhopman 2015/06/26 22:52:58 I would maybe have this default to the current dir
42 parser.add_option('--dex-path', help='Dex output path.') 46 parser.add_option('--dex-path', help='Dex output path.')
43 parser.add_option('--configuration-name', 47 parser.add_option('--configuration-name',
44 help='The build CONFIGURATION_NAME.') 48 help='The build CONFIGURATION_NAME.')
45 parser.add_option('--proguard-enabled', 49 parser.add_option('--proguard-enabled',
46 help='"true" if proguard is enabled.') 50 help='"true" if proguard is enabled.')
47 parser.add_option('--proguard-enabled-input-path', 51 parser.add_option('--proguard-enabled-input-path',
48 help=('Path to dex in Release mode when proguard ' 52 help=('Path to dex in Release mode when proguard '
49 'is enabled.')) 53 'is enabled.'))
50 parser.add_option('--no-locals', 54 parser.add_option('--no-locals',
51 help='Exclude locals list from the dex file.') 55 help='Exclude locals list from the dex file.')
52 parser.add_option('--inputs', help='A list of additional input paths.') 56 parser.add_option('--inputs', help='A list of additional input paths.')
53 parser.add_option('--excluded-paths', 57 parser.add_option('--excluded-paths',
54 help='A list of paths to exclude from the dex file.') 58 help='A list of paths to exclude from the dex file.')
55 59
56 options, paths = parser.parse_args(args) 60 options, paths = parser.parse_args(args)
57 61
58 required_options = ('android_sdk_tools',) 62 required_options = ('android_sdk_tools',)
59 build_utils.CheckOptions(options, parser, required=required_options) 63 build_utils.CheckOptions(options, parser, required=required_options)
60 64
61 if (options.proguard_enabled == 'true' 65 if (options.proguard_enabled == 'true'
62 and options.configuration_name == 'Release'): 66 and options.configuration_name == 'Release'):
63 paths = [options.proguard_enabled_input_path] 67 paths = [options.proguard_enabled_input_path]
64 68
65 if options.inputs: 69 if options.inputs:
66 paths += build_utils.ParseGypList(options.inputs) 70 paths += build_utils.ParseGypList(options.inputs)
67 71
68 if options.excluded_paths: 72 if options.excluded_paths:
73 # Excluded paths are relative to the output directory.
69 exclude_paths = build_utils.ParseGypList(options.excluded_paths) 74 exclude_paths = build_utils.ParseGypList(options.excluded_paths)
70 paths = [p for p in paths if not p in exclude_paths] 75 paths = [p for p in paths if not
76 os.path.relpath(p, options.output_directory) in exclude_paths]
71 77
72 DoDex(options, paths) 78 DoDex(options, paths)
73 79
74 if options.depfile: 80 if options.depfile:
75 build_utils.WriteDepfile( 81 build_utils.WriteDepfile(
76 options.depfile, 82 options.depfile,
77 paths + build_utils.GetPythonDependencies()) 83 paths + build_utils.GetPythonDependencies())
78 84
79 85
80 86
81 if __name__ == '__main__': 87 if __name__ == '__main__':
82 sys.exit(main()) 88 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/dex_action.gypi ('k') | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698