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

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

Issue 484813002: Add support for prebuilt jars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-lint
Patch Set: Created 6 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
« no previous file with comments | « BUILD.gn ('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
11 from util import build_utils 11 from util import build_utils
12 12
13 def DoProguard(options): 13 def DoProguard(options):
14 injars = options.input_path 14 injars = options.input_path
15 outjars = options.output_path 15 outjars = options.output_path
16 classpath = build_utils.ParseGypList(options.classpath) 16 classpath = []
17 for arg in options.classpath:
18 classpath += build_utils.ParseGypList(arg)
17 classpath = list(set(classpath)) 19 classpath = list(set(classpath))
18 libraryjars = ':'.join(classpath) 20 libraryjars = ':'.join(classpath)
19 # proguard does its own dependency checking, which can be avoided by deleting 21 # proguard does its own dependency checking, which can be avoided by deleting
20 # the output. 22 # the output.
21 if os.path.exists(options.output_path): 23 if os.path.exists(options.output_path):
22 os.remove(options.output_path) 24 os.remove(options.output_path)
23 proguard_cmd = ['java', '-jar', 25 proguard_cmd = ['java', '-jar',
24 options.proguard_path, 26 options.proguard_path,
25 '-injars', injars, 27 '-injars', injars,
26 '-outjars', outjars, 28 '-outjars', outjars,
27 '-libraryjars', libraryjars, 29 '-libraryjars', libraryjars,
28 '@' + options.proguard_config] 30 '@' + options.proguard_config]
29 build_utils.CheckOutput(proguard_cmd, print_stdout=True) 31 build_utils.CheckOutput(proguard_cmd, print_stdout=True)
30 32
31 33
32 def main(): 34 def main(args):
35 args = build_utils.ExpandFileArgs(args)
33 parser = optparse.OptionParser() 36 parser = optparse.OptionParser()
37 build_utils.AddDepfileOption(parser)
34 parser.add_option('--proguard-path', 38 parser.add_option('--proguard-path',
35 help='Path to the proguard executable.') 39 help='Path to the proguard executable.')
36 parser.add_option('--input-path', 40 parser.add_option('--input-path',
37 help='Path to the .jar file proguard should run on.') 41 help='Path to the .jar file proguard should run on.')
38 parser.add_option('--output-path', help='Path to the generated .jar file.') 42 parser.add_option('--output-path', help='Path to the generated .jar file.')
39 parser.add_option('--proguard-config', 43 parser.add_option('--proguard-config',
40 help='Path to the proguard configuration file.') 44 help='Path to the proguard configuration file.')
41 parser.add_option('--classpath', help="Classpath for proguard.") 45 parser.add_option('--classpath', action='append',
46 help="Classpath for proguard.")
42 parser.add_option('--stamp', help='Path to touch on success.') 47 parser.add_option('--stamp', help='Path to touch on success.')
43 48
44 options, _ = parser.parse_args() 49 options, _ = parser.parse_args(args)
45 50
46 DoProguard(options) 51 DoProguard(options)
47 52
53 if options.depfile:
54 build_utils.WriteDepfile(
55 options.depfile,
56 build_utils.GetPythonDependencies())
57
48 if options.stamp: 58 if options.stamp:
49 build_utils.Touch(options.stamp) 59 build_utils.Touch(options.stamp)
50 60
51 61
52 if __name__ == '__main__': 62 if __name__ == '__main__':
53 sys.exit(main()) 63 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698