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

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

Issue 20210002: [Android] Sets up a coverage system for java using EMMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes dex/obfuscate actions slightly Created 7 years, 4 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
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 fnmatch
8 import optparse 7 import optparse
9 import os 8 import os
10 import sys 9 import sys
11 10
12 from util import build_utils 11 from util import build_utils
13 from util import md5_check 12 from util import md5_check
14 13
15 14
16 def DoDex(options, paths): 15 def DoDex(options, paths):
17 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') 16 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx')
18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths 17 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path]
18 if options.no_locals:
19 dex_cmd.append('--no-locals')
20 dex_cmd += paths
19 21
20 record_path = '%s.md5.stamp' % options.dex_path 22 record_path = '%s.md5.stamp' % options.dex_path
21 md5_check.CallAndRecordIfStale( 23 md5_check.CallAndRecordIfStale(
22 lambda: build_utils.CheckCallDie(dex_cmd, suppress_output=True), 24 lambda: build_utils.CheckCallDie(dex_cmd, suppress_output=True),
23 record_path=record_path, 25 record_path=record_path,
24 input_paths=paths, 26 input_paths=paths,
25 input_strings=dex_cmd) 27 input_strings=dex_cmd)
26 28
27 build_utils.Touch(options.dex_path) 29 build_utils.Touch(options.dex_path)
28 30
29 31
30 def main(argv): 32 def main(argv):
31 parser = optparse.OptionParser() 33 parser = optparse.OptionParser()
32 parser.add_option('--android-sdk-root', help='Android sdk root directory.') 34 parser.add_option('--android-sdk-root', help='Android sdk root directory.')
33 parser.add_option('--dex-path', help='Dex output path.') 35 parser.add_option('--dex-path', help='Dex output path.')
34 parser.add_option('--configuration-name', 36 parser.add_option('--configuration-name',
35 help='The build CONFIGURATION_NAME.') 37 help='The build CONFIGURATION_NAME.')
36 parser.add_option('--proguard-enabled', 38 parser.add_option('--proguard-enabled',
37 help='"true" if proguard is enabled.') 39 help='"true" if proguard is enabled.')
38 parser.add_option('--proguard-enabled-input-path', 40 parser.add_option('--proguard-enabled-input-path',
39 help='Path to dex in Release mode when proguard is enabled.') 41 help=('Path to dex in Release mode when proguard '
42 'is enabled.'))
43 parser.add_option('--no-locals',
44 help='Exclude locals list from the dex file.')
40 parser.add_option('--stamp', help='Path to touch on success.') 45 parser.add_option('--stamp', help='Path to touch on success.')
41 46
42 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 47 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
43 parser.add_option('--ignore', help='Ignored.') 48 parser.add_option('--ignore', help='Ignored.')
44 49
45 options, paths = parser.parse_args() 50 options, paths = parser.parse_args()
46 51
47 if (options.proguard_enabled == "true" 52 if (options.proguard_enabled == 'true'
48 and options.configuration_name == "Release"): 53 and options.configuration_name == 'Release'):
49 paths = [options.proguard_enabled_input_path] 54 paths = [options.proguard_enabled_input_path]
50 55
51 DoDex(options, paths) 56 DoDex(options, paths)
52 57
53 if options.stamp: 58 if options.stamp:
54 build_utils.Touch(options.stamp) 59 build_utils.Touch(options.stamp)
55 60
56 61
57 if __name__ == '__main__': 62 if __name__ == '__main__':
58 sys.exit(main(sys.argv)) 63 sys.exit(main(sys.argv))
59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698