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

Side by Side Diff: tools/checkdeps/java_checker.py

Issue 239993004: Ignore java files in ThirdParty directories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Checks Java files for illegal imports.""" 5 """Checks Java files for illegal imports."""
6 6
7 import codecs 7 import codecs
8 import os 8 import os
9 import re 9 import re
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if d.startswith('.'): 49 if d.startswith('.'):
50 dirs.remove(d) 50 dirs.remove(d)
51 # Skip the "out" directory, as dealing with generated files is awkward. 51 # Skip the "out" directory, as dealing with generated files is awkward.
52 # We don't want paths like "out/Release/lib.java" in our DEPS files. 52 # We don't want paths like "out/Release/lib.java" in our DEPS files.
53 # TODO(husky): We need some way of determining the "real" path to 53 # TODO(husky): We need some way of determining the "real" path to
54 # a generated file -- i.e., where it would be in source control if 54 # a generated file -- i.e., where it would be in source control if
55 # it weren't generated. 55 # it weren't generated.
56 if d == 'out': 56 if d == 'out':
57 dirs.remove(d) 57 dirs.remove(d)
58 # Skip third-party directories. 58 # Skip third-party directories.
59 if d == 'third_party': 59 if d in ('third_party', 'ThirdParty'):
60 dirs.remove(d) 60 dirs.remove(d)
61 for f in files: 61 for f in files:
62 if f.endswith('.java'): 62 if f.endswith('.java'):
63 self._PrescanFile(os.path.join(root, f)) 63 self._PrescanFile(os.path.join(root, f))
64 64
65 def _PrescanFile(self, filepath): 65 def _PrescanFile(self, filepath):
66 if self._verbose: 66 if self._verbose:
67 print 'Prescanning: ' + filepath 67 print 'Prescanning: ' + filepath
68 with codecs.open(filepath, encoding='utf-8') as f: 68 with codecs.open(filepath, encoding='utf-8') as f:
69 short_class_name, _ = os.path.splitext(os.path.basename(filepath)) 69 short_class_name, _ = os.path.splitext(os.path.basename(filepath))
(...skipping 28 matching lines...) Expand all
98 include_path = include_path.replace(os.path.sep, '/') 98 include_path = include_path.replace(os.path.sep, '/')
99 rule = rules.RuleApplyingTo(include_path, filepath) 99 rule = rules.RuleApplyingTo(include_path, filepath)
100 if rule.allow == Rule.DISALLOW: 100 if rule.allow == Rule.DISALLOW:
101 dependee_status.AddViolation( 101 dependee_status.AddViolation(
102 results.DependencyViolation(include_path, rule, rules)) 102 results.DependencyViolation(include_path, rule, rules))
103 if '{' in line: 103 if '{' in line:
104 # This is code, so we're finished reading imports for this file. 104 # This is code, so we're finished reading imports for this file.
105 break 105 break
106 106
107 return dependee_status 107 return dependee_status
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