OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 import optparse |
| 8 import sys |
| 9 |
| 10 from util import build_utils |
| 11 from util import proguard_util |
| 12 |
| 13 def DoProguard(options): |
| 14 proguard = proguard_util.ProguardCmdBuilder(options.proguard_path) |
| 15 proguard.injars(build_utils.ParseGypList(options.input_paths)) |
| 16 proguard.configs(build_utils.ParseGypList(options.proguard_configs)) |
| 17 proguard.outjar(options.output_path) |
| 18 |
| 19 if options.mapping: |
| 20 proguard.mapping(options.mapping) |
| 21 |
| 22 if options.is_test: |
| 23 proguard.is_test(True) |
| 24 |
| 25 classpath = [] |
| 26 for arg in options.classpath: |
| 27 classpath += build_utils.ParseGypList(arg) |
| 28 classpath = list(set(classpath)) |
| 29 proguard.libraryjars(classpath) |
| 30 |
| 31 proguard.CheckOutput() |
| 32 |
| 33 return proguard.GetInputs() |
| 34 |
| 35 |
| 36 def main(args): |
| 37 args = build_utils.ExpandFileArgs(args) |
| 38 parser = optparse.OptionParser() |
| 39 build_utils.AddDepfileOption(parser) |
| 40 parser.add_option('--proguard-path', |
| 41 help='Path to the proguard executable.') |
| 42 parser.add_option('--input-paths', |
| 43 help='Paths to the .jar files proguard should run on.') |
| 44 parser.add_option('--output-path', help='Path to the generated .jar file.') |
| 45 parser.add_option('--proguard-configs', |
| 46 help='Paths to proguard configuration files.') |
| 47 parser.add_option('--mapping', help='Path to proguard mapping to apply.') |
| 48 parser.add_option('--is-test', action='store_true', |
| 49 help='If true, extra proguard options for instrumentation tests will be ' |
| 50 'added.') |
| 51 parser.add_option('--classpath', action='append', |
| 52 help='Classpath for proguard.') |
| 53 parser.add_option('--stamp', help='Path to touch on success.') |
| 54 |
| 55 options, _ = parser.parse_args(args) |
| 56 |
| 57 inputs = DoProguard(options) |
| 58 |
| 59 if options.depfile: |
| 60 build_utils.WriteDepfile( |
| 61 options.depfile, |
| 62 inputs + build_utils.GetPythonDependencies()) |
| 63 |
| 64 if options.stamp: |
| 65 build_utils.Touch(options.stamp) |
| 66 |
| 67 |
| 68 if __name__ == '__main__': |
| 69 sys.exit(main(sys.argv[1:])) |
OLD | NEW |