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

Unified Diff: mojo/public/tools/dart_analyze.py

Issue 1311803002: Dart: Removes dartzip (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Readme fixes Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/tools/bindings/mojom.gni ('k') | mojo/public/tools/dart_list_packages_contents.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/dart_analyze.py
diff --git a/mojo/public/tools/dart_analyze.py b/mojo/public/tools/dart_analyze.py
index 23119eea505f729b1249f19e2769524d84439d4b..0b49c239e3c79b1a9511c2c9ddf8c19f8982b729 100755
--- a/mojo/public/tools/dart_analyze.py
+++ b/mojo/public/tools/dart_analyze.py
@@ -6,8 +6,7 @@
# To integrate dartanalyze with our build system, we take an input file, run
# the analyzer on it, and write a stamp file if it passed.
-# This script can either analyze a dartzip package, specified with the
-# --dartzip-file flag, or a set of entrypoints specified with the --entrypoints
+# This script analyzes a set of entrypoints specified with the --entrypoints
# flag. The location of the Dart SDK must be specified with the --dart-sdk
# flag. A stamp file can optionally be written with the location given by the
# --stamp-file flag. Any command line arguments not recognized by this script
@@ -21,7 +20,6 @@ import shutil
import subprocess
import sys
import tempfile
-import zipfile
_IGNORED_PATTERNS = [
# Ignored because they're not indicative of specific errors.
@@ -63,36 +61,6 @@ def analyze_and_filter(cmd, temp_dir=None, dirname=None):
return errors
-def analyze_dartzip(dart_sdk, dartzip_file, stamp_file, args):
- dartzip_basename = os.path.basename(dartzip_file) + ":"
-
- # Unzip |dartzip_file| to a temporary directory.
- try:
- temp_dir = tempfile.mkdtemp()
- zipfile.ZipFile(dartzip_file).extractall(temp_dir)
-
- cmd = [ os.path.join(dart_sdk, 'bin', 'dartanalyzer') ]
-
- # Grab all the toplevel dart files in the archive.
- dart_files = glob.glob(os.path.join(temp_dir, "*.dart"))
-
- if not dart_files:
- return _success(stamp_file)
-
- cmd.extend(dart_files)
- cmd.extend(args)
- cmd.append("--package-root=%s/packages" % temp_dir)
- cmd.append("--fatal-warnings")
-
- errors = analyze_and_filter(cmd, temp_dir, dartzip_basename)
-
- if errors is None:
- return _success(stamp_file)
- return min(255, len(errors))
- finally:
- shutil.rmtree(temp_dir)
-
-
def analyze_entrypoints(dart_sdk, entrypoints, args):
cmd = [ os.path.join(dart_sdk, 'bin', 'dartanalyzer') ]
cmd.extend(entrypoints)
@@ -112,12 +80,6 @@ def main():
metavar='dart_sdk',
help='Path to the Dart SDK',
required=True)
- parser.add_argument('--dartzip-file',
- action='store',
- type=str,
- metavar='dartzip_file',
- help='dartzip file whose contents to analyze',
- default=None)
parser.add_argument('--stamp-file',
action='store',
type=str,
@@ -130,19 +92,11 @@ def main():
default=[])
args, remainder = parser.parse_known_args()
- if args.dartzip_file is None and args.entrypoints == []:
+ if args.entrypoints == []:
parser.print_help()
return 1
- if args.dartzip_file is not None:
- # Do not run dart analyzer on third_party sources.
- if "/third_party/" in args.dartzip_file:
- return _success(args.stamp_file)
- return analyze_dartzip(args.dart_sdk, args.dartzip_file, args.stamp_file,
- remainder)
-
- if args.entrypoints != []:
- return analyze_entrypoints(args.dart_sdk, args.entrypoints, remainder)
+ return analyze_entrypoints(args.dart_sdk, args.entrypoints, remainder)
if __name__ == '__main__':
sys.exit(main())
« no previous file with comments | « mojo/public/tools/bindings/mojom.gni ('k') | mojo/public/tools/dart_list_packages_contents.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698