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

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

Issue 153743008: Revert of Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging with changes to pylib/linker/test_case.py. Created 6 years, 10 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/jar.py ('k') | build/android/gyp/javac.py » ('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 """Creates a TOC file from a Java jar. 7 """Creates a TOC file from a Java jar.
8 8
9 The TOC file contains the non-package API of the jar. This includes all 9 The TOC file contains the non-package API of the jar. This includes all
10 public/protected classes/functions/members and the values of static final 10 public/protected classes/functions/members and the values of static final
11 variables. Some other information (major/minor javac version) is also included. 11 variables. Some other information (major/minor javac version) is also included.
12 12
13 This TOC file then can be used to determine if a dependent library should be 13 This TOC file then can be used to determine if a dependent library should be
14 rebuilt when this jar changes. I.e. any change to the jar that would require a 14 rebuilt when this jar changes. I.e. any change to the jar that would require a
15 rebuild, will have a corresponding change in the TOC file. 15 rebuild, will have a corresponding change in the TOC file.
16 """ 16 """
17 17
18 import optparse 18 import optparse
19 import os
19 import re 20 import re
20 import sys 21 import sys
21 import zipfile 22 import zipfile
22 23
23 # pylint: disable=F0401
24 from util import build_utils 24 from util import build_utils
25 from util import md5_check 25 from util import md5_check
26 # pylint: enable=F0401
27 26
28 27
29 def GetClassesInZipFile(zip_file): 28 def GetClassesInZipFile(zip_file):
30 classes = [] 29 classes = []
31 files = zip_file.namelist() 30 files = zip_file.namelist()
32 for f in files: 31 for f in files:
33 if f.endswith('.class'): 32 if f.endswith('.class'):
34 # f is of the form org/chromium/base/Class$Inner.class 33 # f is of the form org/chromium/base/Class$Inner.class
35 classes.append(f.replace('/', '.')[:-6]) 34 classes.append(f.replace('/', '.')[:-6])
36 return classes 35 return classes
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 toc_path = options.toc_path 82 toc_path = options.toc_path
84 record_path = '%s.md5.stamp' % toc_path 83 record_path = '%s.md5.stamp' % toc_path
85 md5_check.CallAndRecordIfStale( 84 md5_check.CallAndRecordIfStale(
86 lambda: UpdateToc(jar_path, toc_path), 85 lambda: UpdateToc(jar_path, toc_path),
87 record_path=record_path, 86 record_path=record_path,
88 input_paths=[jar_path], 87 input_paths=[jar_path],
89 ) 88 )
90 build_utils.Touch(toc_path) 89 build_utils.Touch(toc_path)
91 90
92 91
93 def main(): 92 def main(argv):
94 parser = optparse.OptionParser() 93 parser = optparse.OptionParser()
95 parser.add_option('--jar-path', help='Input .jar path.') 94 parser.add_option('--jar-path', help='Input .jar path.')
96 parser.add_option('--toc-path', help='Output .jar.TOC path.') 95 parser.add_option('--toc-path', help='Output .jar.TOC path.')
97 parser.add_option('--stamp', help='Path to touch on success.') 96 parser.add_option('--stamp', help='Path to touch on success.')
98 97
99 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 98 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
100 parser.add_option('--ignore', help='Ignored.') 99 parser.add_option('--ignore', help='Ignored.')
101 100
102 options, _ = parser.parse_args() 101 options, _ = parser.parse_args()
103 102
104 DoJarToc(options) 103 DoJarToc(options)
105 104
106 if options.stamp: 105 if options.stamp:
107 build_utils.Touch(options.stamp) 106 build_utils.Touch(options.stamp)
108 107
109 108
110 if __name__ == '__main__': 109 if __name__ == '__main__':
111 sys.exit(main()) 110 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/gyp/jar.py ('k') | build/android/gyp/javac.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698