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

Side by Side Diff: mojo/public/tools/dart_analyze.py

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ] 62 ]
63 63
64 # Grab all the toplevel dart files in the archive. 64 # Grab all the toplevel dart files in the archive.
65 dart_files = glob.glob(os.path.join(temp_dir, "*.dart")) 65 dart_files = glob.glob(os.path.join(temp_dir, "*.dart"))
66 66
67 if not dart_files: 67 if not dart_files:
68 return _success(stamp_file) 68 return _success(stamp_file)
69 69
70 cmd.extend(dart_files) 70 cmd.extend(dart_files)
71 cmd.extend(args) 71 cmd.extend(args)
72 cmd.append("--package-root=%s" % temp_dir) 72 cmd.append("--package-root=%s/packages" % temp_dir)
73 cmd.append("--fatal-warnings") 73 cmd.append("--fatal-warnings")
74 74
75 errors = 0 75 errors = 0
76 try: 76 try:
77 subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT) 77 subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT)
78 except subprocess.CalledProcessError as e: 78 except subprocess.CalledProcessError as e:
79 errors = set(l for l in e.output.split('\n') 79 errors = set(l for l in e.output.split('\n')
80 if not any(p.match(l) for p in _IGNORED_PATTERNS)) 80 if not any(p.match(l) for p in _IGNORED_PATTERNS))
81 for error in sorted(errors): 81 for error in sorted(errors):
82 print >> sys.stderr, error.replace(temp_dir + "/", dartzip_basename) 82 print >> sys.stderr, error.replace(temp_dir + "/", dartzip_basename)
83 83
84 if not errors: 84 if not errors:
85 return _success(stamp_file) 85 return _success(stamp_file)
86 return min(255, len(errors)) 86 return min(255, len(errors))
87 finally: 87 finally:
88 shutil.rmtree(temp_dir) 88 shutil.rmtree(temp_dir)
89 89
90 if __name__ == '__main__': 90 if __name__ == '__main__':
91 sys.exit(main(sys.argv[1:])) 91 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_dart_generator.py ('k') | mojo/public/tools/dart_list_mojoms.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698