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

Side by Side Diff: build/android/gyp/jar.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/get_device_configuration.py ('k') | build/android/gyp/jar_toc.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 import fnmatch 7 import fnmatch
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
11 11
12 # pylint: disable=F0401
13 from util import build_utils 12 from util import build_utils
14 from util import md5_check 13 from util import md5_check
15 # pylint: enable=F0401
16 14
17 15
18 def DoJar(options): 16 def DoJar(options):
19 class_files = build_utils.FindInDirectory(options.classes_dir, '*.class') 17 class_files = build_utils.FindInDirectory(options.classes_dir, '*.class')
20 for exclude in build_utils.ParseGypList(options.excluded_classes): 18 for exclude in build_utils.ParseGypList(options.excluded_classes):
21 class_files = filter( 19 class_files = filter(
22 lambda f: not fnmatch.fnmatch(f, exclude), class_files) 20 lambda f: not fnmatch.fnmatch(f, exclude), class_files)
23 21
24 jar_path = os.path.abspath(options.jar_path) 22 jar_path = os.path.abspath(options.jar_path)
25 23
26 # The paths of the files in the jar will be the same as they are passed in to 24 # The paths of the files in the jar will be the same as they are passed in to
27 # the command. Because of this, the command should be run in 25 # the command. Because of this, the command should be run in
28 # options.classes_dir so the .class file paths in the jar are correct. 26 # options.classes_dir so the .class file paths in the jar are correct.
29 jar_cwd = options.classes_dir 27 jar_cwd = options.classes_dir
30 class_files_rel = [os.path.relpath(f, jar_cwd) for f in class_files] 28 class_files_rel = [os.path.relpath(f, jar_cwd) for f in class_files]
31 jar_cmd = ['jar', 'cf0', jar_path] + class_files_rel 29 jar_cmd = ['jar', 'cf0', jar_path] + class_files_rel
32 30
33 record_path = '%s.md5.stamp' % options.jar_path 31 record_path = '%s.md5.stamp' % options.jar_path
34 md5_check.CallAndRecordIfStale( 32 md5_check.CallAndRecordIfStale(
35 lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd), 33 lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd),
36 record_path=record_path, 34 record_path=record_path,
37 input_paths=class_files, 35 input_paths=class_files,
38 input_strings=jar_cmd) 36 input_strings=jar_cmd)
39 37
40 build_utils.Touch(options.jar_path) 38 build_utils.Touch(options.jar_path)
41 39
42 40
43 def main(): 41 def main(argv):
44 parser = optparse.OptionParser() 42 parser = optparse.OptionParser()
45 parser.add_option('--classes-dir', help='Directory containing .class files.') 43 parser.add_option('--classes-dir', help='Directory containing .class files.')
46 parser.add_option('--jar-path', help='Jar output path.') 44 parser.add_option('--jar-path', help='Jar output path.')
47 parser.add_option('--excluded-classes', 45 parser.add_option('--excluded-classes',
48 help='List of .class file patterns to exclude from the jar.') 46 help='List of .class file patterns to exclude from the jar.')
49 parser.add_option('--stamp', help='Path to touch on success.') 47 parser.add_option('--stamp', help='Path to touch on success.')
50 48
51 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 49 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
52 parser.add_option('--ignore', help='Ignored.') 50 parser.add_option('--ignore', help='Ignored.')
53 51
54 options, _ = parser.parse_args() 52 options, _ = parser.parse_args()
55 53
56 DoJar(options) 54 DoJar(options)
57 55
58 if options.stamp: 56 if options.stamp:
59 build_utils.Touch(options.stamp) 57 build_utils.Touch(options.stamp)
60 58
61 59
62 if __name__ == '__main__': 60 if __name__ == '__main__':
63 sys.exit(main()) 61 sys.exit(main(sys.argv))
64 62
OLDNEW
« no previous file with comments | « build/android/gyp/get_device_configuration.py ('k') | build/android/gyp/jar_toc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698