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

Side by Side Diff: build/android/gyp/util/proguard_util.py

Issue 1568583005: Add proguard_verbose GN arg (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/android/gyp/proguard.py ('k') | build/config/android/config.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 # 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 26 matching lines...) Expand all
37 assert os.path.exists(proguard_jar) 37 assert os.path.exists(proguard_jar)
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 48
48 def outjar(self, path): 49 def outjar(self, path):
49 assert self._cmd is None 50 assert self._cmd is None
50 assert self._outjar is None 51 assert self._outjar is None
51 self._outjar = path 52 self._outjar = path
52 53
53 def tested_apk_info(self, tested_apk_info_path): 54 def tested_apk_info(self, tested_apk_info_path):
54 assert self._cmd is None 55 assert self._cmd is None
55 assert self._tested_apk_info is None 56 assert self._tested_apk_info is None
56 self._tested_apk_info_path = tested_apk_info_path 57 self._tested_apk_info_path = tested_apk_info_path
(...skipping 18 matching lines...) Expand all
75 assert os.path.exists(p), p 76 assert os.path.exists(p), p
76 self._injars = paths 77 self._injars = paths
77 78
78 def configs(self, paths): 79 def configs(self, paths):
79 assert self._cmd is None 80 assert self._cmd is None
80 assert self._configs is None 81 assert self._configs is None
81 for p in paths: 82 for p in paths:
82 assert os.path.exists(p), p 83 assert os.path.exists(p), p
83 self._configs = paths 84 self._configs = paths
84 85
86 def verbose(self, verbose):
87 assert self._cmd is None
88 self._verbose = verbose
89
85 def build(self): 90 def build(self):
86 if self._cmd: 91 if self._cmd:
87 return self._cmd 92 return self._cmd
88 assert self._injars is not None 93 assert self._injars is not None
89 assert self._outjar is not None 94 assert self._outjar is not None
90 assert self._configs is not None 95 assert self._configs is not None
91 cmd = [ 96 cmd = [
92 'java', '-jar', self._proguard_jar_path, 97 'java', '-jar', self._proguard_jar_path,
93 '-forceprocessing', 98 '-forceprocessing',
94 ] 99 ]
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 cmd += ['-include', config_file] 132 cmd += ['-include', config_file]
128 133
129 # The output jar must be specified after inputs. 134 # The output jar must be specified after inputs.
130 cmd += [ 135 cmd += [
131 '-outjars', self._outjar, 136 '-outjars', self._outjar,
132 '-dump', self._outjar + '.dump', 137 '-dump', self._outjar + '.dump',
133 '-printseeds', self._outjar + '.seeds', 138 '-printseeds', self._outjar + '.seeds',
134 '-printusage', self._outjar + '.usage', 139 '-printusage', self._outjar + '.usage',
135 '-printmapping', self._outjar + '.mapping', 140 '-printmapping', self._outjar + '.mapping',
136 ] 141 ]
142
143 if self._verbose:
144 cmd.append('-verbose')
145
137 self._cmd = cmd 146 self._cmd = cmd
138 return self._cmd 147 return self._cmd
139 148
140 def GetInputs(self): 149 def GetInputs(self):
141 self.build() 150 self.build()
142 inputs = [self._proguard_jar_path] + self._configs + self._injars 151 inputs = [self._proguard_jar_path] + self._configs + self._injars
143 if self._mapping: 152 if self._mapping:
144 inputs.append(self._mapping) 153 inputs.append(self._mapping)
145 if self._libraries: 154 if self._libraries:
146 inputs += self._libraries 155 inputs += self._libraries
147 if self._tested_apk_info_path: 156 if self._tested_apk_info_path:
148 inputs += [self._tested_apk_info_path] 157 inputs += [self._tested_apk_info_path]
149 return inputs 158 return inputs
150 159
151 160
152 def CheckOutput(self, verbose=False): 161 def CheckOutput(self):
153 self.build() 162 self.build()
154 # Proguard will skip writing these files if they would be empty. Create 163 # Proguard will skip writing these files if they would be empty. Create
155 # empty versions of them all now so that they are updated as the build 164 # empty versions of them all now so that they are updated as the build
156 # expects. 165 # expects.
157 open(self._outjar + '.dump', 'w').close() 166 open(self._outjar + '.dump', 'w').close()
158 open(self._outjar + '.seeds', 'w').close() 167 open(self._outjar + '.seeds', 'w').close()
159 open(self._outjar + '.usage', 'w').close() 168 open(self._outjar + '.usage', 'w').close()
160 open(self._outjar + '.mapping', 'w').close() 169 open(self._outjar + '.mapping', 'w').close()
161 # Warning: and Error: are sent to stderr, but messages and Note: are sent 170 # Warning: and Error: are sent to stderr, but messages and Note: are sent
162 # to stdout. 171 # to stdout.
163 stdout_filter = None 172 stdout_filter = None
164 stderr_filter = None 173 stderr_filter = None
165 if not verbose: 174 if not self._verbose:
166 stdout_filter = _ProguardOutputFilter() 175 stdout_filter = _ProguardOutputFilter()
167 stderr_filter = _ProguardOutputFilter() 176 stderr_filter = _ProguardOutputFilter()
168 build_utils.CheckOutput(self._cmd, print_stdout=True, 177 build_utils.CheckOutput(self._cmd, print_stdout=True,
169 print_stderr=True, 178 print_stderr=True,
170 stdout_filter=stdout_filter, 179 stdout_filter=stdout_filter,
171 stderr_filter=stderr_filter) 180 stderr_filter=stderr_filter)
172 181
173 this_info = { 182 this_info = {
174 'inputs': self._injars, 183 'inputs': self._injars,
175 'configs': self._configs, 184 'configs': self._configs,
176 'mapping': self._outjar + '.mapping', 185 'mapping': self._outjar + '.mapping',
177 } 186 }
178 187
179 build_utils.WriteJson(this_info, self._outjar + '.info') 188 build_utils.WriteJson(this_info, self._outjar + '.info')
180 189
OLDNEW
« no previous file with comments | « build/android/gyp/proguard.py ('k') | build/config/android/config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698