| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 """Generates the obfuscated jar and test jar for an apk. | 7 """Generates the obfuscated jar and test jar for an apk. |
| 8 | 8 |
| 9 If proguard is not enabled or 'Release' is not in the configuration name, | 9 If proguard is not enabled or 'Release' is not in the configuration name, |
| 10 obfuscation will be a no-op. | 10 obfuscation will be a no-op. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 # configs should only contain the process_resources.py generated config. | 118 # configs should only contain the process_resources.py generated config. |
| 119 assert len(configs) == 1, ( | 119 assert len(configs) == 1, ( |
| 120 'test apks should not have custom proguard configs: ' + str(configs)) | 120 'test apks should not have custom proguard configs: ' + str(configs)) |
| 121 tested_jar_info = build_utils.ReadJson( | 121 tested_jar_info = build_utils.ReadJson( |
| 122 options.tested_apk_obfuscated_jar_path + '.info') | 122 options.tested_apk_obfuscated_jar_path + '.info') |
| 123 exclude_paths = tested_jar_info['inputs'] | 123 exclude_paths = tested_jar_info['inputs'] |
| 124 configs = tested_jar_info['configs'] | 124 configs = tested_jar_info['configs'] |
| 125 proguard_cmd += [ | 125 proguard_cmd += [ |
| 126 '-dontobfuscate', | 126 '-dontobfuscate', |
| 127 '-dontoptimize', | 127 '-dontoptimize', |
| 128 '-dontshrink', |
| 128 '-dontskipnonpubliclibraryclassmembers', | 129 '-dontskipnonpubliclibraryclassmembers', |
| 129 '-libraryjars', options.tested_apk_obfuscated_jar_path, | 130 '-libraryjars', options.tested_apk_obfuscated_jar_path, |
| 130 '-applymapping', options.tested_apk_obfuscated_jar_path + '.mapping', | 131 '-applymapping', options.tested_apk_obfuscated_jar_path + '.mapping', |
| 131 ] | 132 ] |
| 132 | 133 |
| 133 proguard_injars = [p for p in input_jars if p not in exclude_paths] | 134 proguard_injars = [p for p in input_jars if p not in exclude_paths] |
| 134 proguard_cmd += ['-injars', ':'.join(proguard_injars)] | 135 proguard_cmd += ['-injars', ':'.join(proguard_injars)] |
| 135 | 136 |
| 136 for config_file in configs: | 137 for config_file in configs: |
| 137 proguard_cmd += ['-include', config_file] | 138 proguard_cmd += ['-include', config_file] |
| (...skipping 21 matching lines...) Expand all Loading... |
| 159 for f in output_files: | 160 for f in output_files: |
| 160 if os.path.exists(f): | 161 if os.path.exists(f): |
| 161 os.remove(f) | 162 os.remove(f) |
| 162 build_utils.Touch(f) | 163 build_utils.Touch(f) |
| 163 | 164 |
| 164 if options.stamp: | 165 if options.stamp: |
| 165 build_utils.Touch(options.stamp) | 166 build_utils.Touch(options.stamp) |
| 166 | 167 |
| 167 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 168 sys.exit(main(sys.argv[1:])) | 169 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |