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

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

Issue 2079673002: Fix a regex in javac.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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 optparse 7 import optparse
8 import os 8 import os
9 import shutil 9 import shutil
10 import re 10 import re
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 # 2. A single .java file results in multiple .class files when it contains 76 # 2. A single .java file results in multiple .class files when it contains
77 # nested classes. 77 # nested classes.
78 # Here's an example: 78 # Here's an example:
79 # source path: ../../base/android/java/src/org/chromium/Foo.java 79 # source path: ../../base/android/java/src/org/chromium/Foo.java
80 # jar paths: org/chromium/Foo.class, org/chromium/Foo$Inner.class 80 # jar paths: org/chromium/Foo.class, org/chromium/Foo$Inner.class
81 # To extract only .class files not related to the given .java files, we strip 81 # To extract only .class files not related to the given .java files, we strip
82 # off ".class" and "$*.class" and use a substring match against java_files. 82 # off ".class" and "$*.class" and use a substring match against java_files.
83 def extract_predicate(path): 83 def extract_predicate(path):
84 if not path.endswith('.class'): 84 if not path.endswith('.class'):
85 return False 85 return False
86 path_without_suffix = re.sub(r'(?:\$|\.)[^/]+class$', '', path) 86 path_without_suffix = re.sub(r'(?:\$|\.)[^/]*class$', '', path)
87 partial_java_path = path_without_suffix + '.java' 87 partial_java_path = path_without_suffix + '.java'
88 return not any(p.endswith(partial_java_path) for p in java_files) 88 return not any(p.endswith(partial_java_path) for p in java_files)
89 89
90 build_utils.ExtractAll(jar_path, path=dest_dir, predicate=extract_predicate) 90 build_utils.ExtractAll(jar_path, path=dest_dir, predicate=extract_predicate)
91 for path in build_utils.FindInDirectory(dest_dir, '*.class'): 91 for path in build_utils.FindInDirectory(dest_dir, '*.class'):
92 shutil.copystat(jar_path, path) 92 shutil.copystat(jar_path, path)
93 93
94 94
95 def _ConvertToJMakeArgs(javac_cmd, pdb_path): 95 def _ConvertToJMakeArgs(javac_cmd, pdb_path):
96 new_args = ['bin/jmake', '-pdb', pdb_path] 96 new_args = ['bin/jmake', '-pdb', pdb_path]
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 options, 408 options,
409 input_paths=input_paths, 409 input_paths=input_paths,
410 input_strings=javac_cmd, 410 input_strings=javac_cmd,
411 output_paths=output_paths, 411 output_paths=output_paths,
412 force=force, 412 force=force,
413 pass_changes=True) 413 pass_changes=True)
414 414
415 415
416 if __name__ == '__main__': 416 if __name__ == '__main__':
417 sys.exit(main(sys.argv[1:])) 417 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698