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

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

Issue 1436083002: Revert of GN: Enable proguard for apks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/gyp/apk_obfuscate.py ('k') | build/android/gyp/util/proguard_util.py » ('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
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 def _ParseOptions(args): 15 def _ParseOptions(args):
16 parser = optparse.OptionParser() 16 parser = optparse.OptionParser()
17 build_utils.AddDepfileOption(parser) 17 build_utils.AddDepfileOption(parser)
18 parser.add_option('--proguard-path', 18 parser.add_option('--proguard-path',
19 help='Path to the proguard executable.') 19 help='Path to the proguard executable.')
20 parser.add_option('--input-paths', 20 parser.add_option('--input-paths',
21 help='Paths to the .jar files proguard should run on.') 21 help='Paths to the .jar files proguard should run on.')
22 parser.add_option('--output-path', help='Path to the generated .jar file.') 22 parser.add_option('--output-path', help='Path to the generated .jar file.')
23 parser.add_option('--proguard-configs', 23 parser.add_option('--proguard-configs',
24 help='Paths to proguard configuration files.') 24 help='Paths to proguard configuration files.')
25 parser.add_option('--mapping', help='Path to proguard mapping to apply.') 25 parser.add_option('--mapping', help='Path to proguard mapping to apply.')
26 parser.add_option('--is-test', action='store_true', 26 parser.add_option('--is-test', action='store_true',
27 help='If true, extra proguard options for instrumentation tests will be ' 27 help='If true, extra proguard options for instrumentation tests will be '
28 'added.') 28 'added.')
29 parser.add_option('--tested-apk-info', help='Path to the proguard .info file '
30 'for the tested apk')
31 parser.add_option('--classpath', action='append', 29 parser.add_option('--classpath', action='append',
32 help='Classpath for proguard.') 30 help='Classpath for proguard.')
33 parser.add_option('--stamp', help='Path to touch on success.') 31 parser.add_option('--stamp', help='Path to touch on success.')
34 32
35 options, _ = parser.parse_args(args) 33 options, _ = parser.parse_args(args)
36 34
37 classpath = [] 35 classpath = []
38 for arg in options.classpath: 36 for arg in options.classpath:
39 classpath += build_utils.ParseGypList(arg) 37 classpath += build_utils.ParseGypList(arg)
40 options.classpath = classpath 38 options.classpath = classpath
41 39
42 return options 40 return options
43 41
44 42
45 def main(args): 43 def main(args):
46 args = build_utils.ExpandFileArgs(args) 44 args = build_utils.ExpandFileArgs(args)
47 options = _ParseOptions(args) 45 options = _ParseOptions(args)
48 46
49 proguard = proguard_util.ProguardCmdBuilder(options.proguard_path) 47 proguard = proguard_util.ProguardCmdBuilder(options.proguard_path)
50 proguard.injars(build_utils.ParseGypList(options.input_paths)) 48 proguard.injars(build_utils.ParseGypList(options.input_paths))
51 proguard.configs(build_utils.ParseGypList(options.proguard_configs)) 49 proguard.configs(build_utils.ParseGypList(options.proguard_configs))
52 proguard.outjar(options.output_path) 50 proguard.outjar(options.output_path)
53 51
54 if options.mapping: 52 if options.mapping:
55 proguard.mapping(options.mapping) 53 proguard.mapping(options.mapping)
56 54
57 if options.tested_apk_info: 55 if options.is_test:
58 proguard.tested_apk_info(options.tested_apk_info) 56 proguard.is_test(True)
59 57
60 classpath = list(set(options.classpath)) 58 classpath = list(set(options.classpath))
61 proguard.libraryjars(classpath) 59 proguard.libraryjars(classpath)
62 60
63 input_paths = proguard.GetInputs() 61 input_paths = proguard.GetInputs()
64 62
65 build_utils.CallAndWriteDepfileIfStale( 63 build_utils.CallAndWriteDepfileIfStale(
66 proguard.CheckOutput, 64 proguard.CheckOutput,
67 options, 65 options,
68 input_paths=input_paths, 66 input_paths=input_paths,
69 input_strings=proguard.build(), 67 input_strings=proguard.build(),
70 output_paths=[options.output_path]) 68 output_paths=[options.output_path])
71 69
72 70
73 if __name__ == '__main__': 71 if __name__ == '__main__':
74 sys.exit(main(sys.argv[1:])) 72 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/gyp/apk_obfuscate.py ('k') | build/android/gyp/util/proguard_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698