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

Side by Side Diff: build/android/gyp/util/proguard_util.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 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 import re 6 import re
7 from util import build_utils 7 from util import build_utils
8 8
9 9
10 class _ProguardOutputFilter(object): 10 class _ProguardOutputFilter(object):
(...skipping 27 matching lines...) Expand all
38 self._proguard_jar_path = proguard_jar 38 self._proguard_jar_path = proguard_jar
39 self._tested_apk_info_path = None 39 self._tested_apk_info_path = None
40 self._tested_apk_info = None 40 self._tested_apk_info = None
41 self._mapping = None 41 self._mapping = None
42 self._libraries = None 42 self._libraries = None
43 self._injars = None 43 self._injars = None
44 self._configs = None 44 self._configs = None
45 self._outjar = None 45 self._outjar = None
46 self._cmd = None 46 self._cmd = None
47 self._verbose = False 47 self._verbose = False
48 self._disabled_optimizations = []
48 49
49 def outjar(self, path): 50 def outjar(self, path):
50 assert self._cmd is None 51 assert self._cmd is None
51 assert self._outjar is None 52 assert self._outjar is None
52 self._outjar = path 53 self._outjar = path
53 54
54 def tested_apk_info(self, tested_apk_info_path): 55 def tested_apk_info(self, tested_apk_info_path):
55 assert self._cmd is None 56 assert self._cmd is None
56 assert self._tested_apk_info is None 57 assert self._tested_apk_info is None
57 self._tested_apk_info_path = tested_apk_info_path 58 self._tested_apk_info_path = tested_apk_info_path
(...skipping 22 matching lines...) Expand all
80 assert self._cmd is None 81 assert self._cmd is None
81 assert self._configs is None 82 assert self._configs is None
82 for p in paths: 83 for p in paths:
83 assert os.path.exists(p), p 84 assert os.path.exists(p), p
84 self._configs = paths 85 self._configs = paths
85 86
86 def verbose(self, verbose): 87 def verbose(self, verbose):
87 assert self._cmd is None 88 assert self._cmd is None
88 self._verbose = verbose 89 self._verbose = verbose
89 90
91 def disable_optimizations(self, optimizations):
92 assert self._cmd is None
93 self._disabled_optimizations += optimizations
94
90 def build(self): 95 def build(self):
91 if self._cmd: 96 if self._cmd:
92 return self._cmd 97 return self._cmd
93 assert self._injars is not None 98 assert self._injars is not None
94 assert self._outjar is not None 99 assert self._outjar is not None
95 assert self._configs is not None 100 assert self._configs is not None
96 cmd = [ 101 cmd = [
97 'java', '-jar', self._proguard_jar_path, 102 'java', '-jar', self._proguard_jar_path,
98 '-forceprocessing', 103 '-forceprocessing',
99 ] 104 ]
(...skipping 16 matching lines...) Expand all
116 if self._mapping: 121 if self._mapping:
117 cmd += [ 122 cmd += [
118 '-applymapping', self._mapping, 123 '-applymapping', self._mapping,
119 ] 124 ]
120 125
121 if self._libraries: 126 if self._libraries:
122 cmd += [ 127 cmd += [
123 '-libraryjars', ':'.join(self._libraries), 128 '-libraryjars', ':'.join(self._libraries),
124 ] 129 ]
125 130
131 for optimization in self._disabled_optimizations:
132 cmd += [
133 '-optimizations', '!' + optimization,
agrieve 2016/07/07 15:30:06 nit: put this all oneline: cmd += [ '-optimizatio
134 ]
135
126 cmd += [ 136 cmd += [
127 '-injars', ':'.join(self._injars) 137 '-injars', ':'.join(self._injars)
128 ] 138 ]
129 139
130 for config_file in self._configs: 140 for config_file in self._configs:
131 cmd += ['-include', config_file] 141 cmd += ['-include', config_file]
132 142
133 # The output jar must be specified after inputs. 143 # The output jar must be specified after inputs.
134 cmd += [ 144 cmd += [
135 '-outjars', self._outjar, 145 '-outjars', self._outjar,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 stderr_filter=stderr_filter) 189 stderr_filter=stderr_filter)
180 190
181 this_info = { 191 this_info = {
182 'inputs': self._injars, 192 'inputs': self._injars,
183 'configs': self._configs, 193 'configs': self._configs,
184 'mapping': self._outjar + '.mapping', 194 'mapping': self._outjar + '.mapping',
185 } 195 }
186 196
187 build_utils.WriteJson(this_info, self._outjar + '.info') 197 build_utils.WriteJson(this_info, self._outjar + '.info')
188 198
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698