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

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

Issue 2127973003: Turning on optimizations for chromium code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testapk
Patch Set: Created 4 years, 5 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 optparse 7 import optparse
8 import os 8 import os
9 import sys 9 import sys
10 10
11 from util import build_utils 11 from util import build_utils
12 from util import proguard_util 12 from util import proguard_util
13 13
14 14
15 DANGEROUS_OPTIMIZATIONS = [
agrieve 2016/07/07 15:30:06 nit: prefix with _ to denote as private to the mod
smaier 2016/07/08 14:59:10 Done.
16 # See crbug.com/625992
17 "code/allocation/variable",
18 # See crbug.com/625994
19 "field/propagation/value",
20 "method/propagation/parameter",
21 "method/propagation/returnvalue",
22 ]
23
15 def _ParseOptions(args): 24 def _ParseOptions(args):
16 parser = optparse.OptionParser() 25 parser = optparse.OptionParser()
17 build_utils.AddDepfileOption(parser) 26 build_utils.AddDepfileOption(parser)
18 parser.add_option('--proguard-path', 27 parser.add_option('--proguard-path',
19 help='Path to the proguard executable.') 28 help='Path to the proguard executable.')
20 parser.add_option('--input-paths', 29 parser.add_option('--input-paths',
21 help='Paths to the .jar files proguard should run on.') 30 help='Paths to the .jar files proguard should run on.')
22 parser.add_option('--output-path', help='Path to the generated .jar file.') 31 parser.add_option('--output-path', help='Path to the generated .jar file.')
23 parser.add_option('--proguard-configs', 32 parser.add_option('--proguard-configs',
24 help='Paths to proguard configuration files.') 33 help='Paths to proguard configuration files.')
25 parser.add_option('--mapping', help='Path to proguard mapping to apply.') 34 parser.add_option('--mapping', help='Path to proguard mapping to apply.')
26 parser.add_option('--is-test', action='store_true', 35 parser.add_option('--is-test', action='store_true',
27 help='If true, extra proguard options for instrumentation tests will be ' 36 help='If true, extra proguard options for instrumentation tests will be '
28 'added.') 37 'added.')
29 parser.add_option('--tested-apk-info', help='Path to the proguard .info file ' 38 parser.add_option('--tested-apk-info', help='Path to the proguard .info file '
30 'for the tested apk') 39 'for the tested apk')
31 parser.add_option('--classpath', action='append', 40 parser.add_option('--classpath', action='append',
32 help='Classpath for proguard.') 41 help='Classpath for proguard.')
33 parser.add_option('--stamp', help='Path to touch on success.') 42 parser.add_option('--stamp', help='Path to touch on success.')
43 parser.add_option('--enable-dangerous-optimizations', action='store_true',
44 help='Turn on optimizations that are broken on public '
agrieve 2016/07/07 15:30:06 nit: "Turn on optimizations which are known to hav
smaier 2016/07/08 14:59:10 Done.
45 'proguard.')
34 parser.add_option('--verbose', '-v', action='store_true', 46 parser.add_option('--verbose', '-v', action='store_true',
35 help='Print all proguard output') 47 help='Print all proguard output')
36 48
37 options, _ = parser.parse_args(args) 49 options, _ = parser.parse_args(args)
38 50
39 classpath = [] 51 classpath = []
40 for arg in options.classpath: 52 for arg in options.classpath:
41 classpath += build_utils.ParseGypList(arg) 53 classpath += build_utils.ParseGypList(arg)
42 options.classpath = classpath 54 options.classpath = classpath
43 55
(...skipping 11 matching lines...) Expand all
55 67
56 if options.mapping: 68 if options.mapping:
57 proguard.mapping(options.mapping) 69 proguard.mapping(options.mapping)
58 70
59 if options.tested_apk_info: 71 if options.tested_apk_info:
60 proguard.tested_apk_info(options.tested_apk_info) 72 proguard.tested_apk_info(options.tested_apk_info)
61 73
62 classpath = list(set(options.classpath)) 74 classpath = list(set(options.classpath))
63 proguard.libraryjars(classpath) 75 proguard.libraryjars(classpath)
64 proguard.verbose(options.verbose) 76 proguard.verbose(options.verbose)
77 if not options.enable_dangerous_optimizations:
78 proguard.disable_optimizations(DANGEROUS_OPTIMIZATIONS)
65 79
66 input_paths = proguard.GetInputs() 80 input_paths = proguard.GetInputs()
67 81
68 build_utils.CallAndWriteDepfileIfStale( 82 build_utils.CallAndWriteDepfileIfStale(
69 proguard.CheckOutput, 83 proguard.CheckOutput,
70 options, 84 options,
71 input_paths=input_paths, 85 input_paths=input_paths,
72 input_strings=proguard.build(), 86 input_strings=proguard.build(),
73 output_paths=[options.output_path]) 87 output_paths=[options.output_path])
74 88
75 89
76 if __name__ == '__main__': 90 if __name__ == '__main__':
77 sys.exit(main(sys.argv[1:])) 91 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/util/proguard_util.py » ('j') | build/android/gyp/util/proguard_util.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698