| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # To integrate dartanalyze with out build system, we take an input file, run | 6 # To integrate dartanalyze with out build system, we take an input file, run |
| 7 # the analyzer on it, and write a stamp file if it passed. | 7 # the analyzer on it, and write a stamp file if it passed. |
| 8 # | 8 # |
| 9 # The first argument to this script is a reference to this build's gen | 9 # The first argument to this script is a reference to this build's gen |
| 10 # directory, which we treat as the package root. The second is the stamp file | 10 # directory, which we treat as the package root. The second is the stamp file |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 _IGNORED_PATTERNS = [ | 22 _IGNORED_PATTERNS = [ |
| 23 # Ignored because they're not indicative of specific errors. | 23 # Ignored because they're not indicative of specific errors. |
| 24 re.compile(r'^$'), | 24 re.compile(r'^$'), |
| 25 re.compile(r'^Analyzing \['), | 25 re.compile(r'^Analyzing \['), |
| 26 re.compile(r'^No issues found'), | 26 re.compile(r'^No issues found'), |
| 27 re.compile(r'^[0-9]+ errors? and [0-9]+ warnings? found.'), | 27 re.compile(r'^[0-9]+ errors? and [0-9]+ warnings? found.'), |
| 28 re.compile(r'^([0-9]+|No) (error|warning|issue)s? found.'), | 28 re.compile(r'^([0-9]+|No) (error|warning|issue)s? found.'), |
| 29 | 29 |
| 30 # TODO: It seems like this should be re-enabled evenutally. | 30 # TODO: It seems like this should be re-enabled evenutally. |
| 31 re.compile(r'.*is a part and can not|^Only libraries can be analyzed'), | 31 re.compile(r'.*is a part and can not|^Only libraries can be analyzed'), |
| 32 # TODO: Remove this once dev SDK includes Uri.directory constructor. |
| 33 re.compile(r'.*The class \'Uri\' does not have a constructor \'directory\''), |
| 32 ] | 34 ] |
| 33 | 35 |
| 34 def _success(stamp_file): | 36 def _success(stamp_file): |
| 35 # We passed cleanly, so touch the stamp file so that we don't run again. | 37 # We passed cleanly, so touch the stamp file so that we don't run again. |
| 36 with open(stamp_file, 'a'): | 38 with open(stamp_file, 'a'): |
| 37 os.utime(stamp_file, None) | 39 os.utime(stamp_file, None) |
| 38 return 0 | 40 return 0 |
| 39 | 41 |
| 40 def main(args): | 42 def main(args): |
| 41 dartzip_file = args.pop(0) | 43 dartzip_file = args.pop(0) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 print >> sys.stderr, error.replace(temp_dir + "/", dartzip_basename) | 79 print >> sys.stderr, error.replace(temp_dir + "/", dartzip_basename) |
| 78 | 80 |
| 79 if not errors: | 81 if not errors: |
| 80 return _success(stamp_file) | 82 return _success(stamp_file) |
| 81 return min(255, len(errors)) | 83 return min(255, len(errors)) |
| 82 finally: | 84 finally: |
| 83 shutil.rmtree(temp_dir) | 85 shutil.rmtree(temp_dir) |
| 84 | 86 |
| 85 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 86 sys.exit(main(sys.argv[1:])) | 88 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |