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

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

Issue 1370313002: Filter out stale Dart script entrypoints (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/dart_pkg_static_analysis.py
diff --git a/mojo/public/tools/dart_pkg_static_analysis.py b/mojo/public/tools/dart_pkg_static_analysis.py
index bded3a1a5adf39116bfe22356c9a56beec3b2541..37c400ace9f52fc844d950a72ed28c2f971cb065 100755
--- a/mojo/public/tools/dart_pkg_static_analysis.py
+++ b/mojo/public/tools/dart_pkg_static_analysis.py
@@ -47,6 +47,16 @@ def analyze_package(dart_sdk, package_root, package):
print('Analyzing dart-pkg %s ' % package_name)
return analyze_entrypoints(dart_sdk, package_root, package_entrypoints)
+# Filter entrypoints for files that exist.
+def filter_entrypoints(package_name, entrypoints):
+ result = []
+ for entrypoint in entrypoints:
+ if os.path.isfile(entrypoint):
+ result.append(entrypoint)
+ else:
+ print('WARNING: Could not find %s from %s ' % (entrypoint, package_name))
+ return result
+
def main():
parser = argparse.ArgumentParser(description='Generate a dart-pkg')
parser.add_argument('--dart-sdk',
@@ -82,8 +92,10 @@ def main():
if not args.package_name or (filename == args.package_name + '.entries'):
with open(os.path.join(args.dart_pkg_dir, filename)) as f:
entrypoints = f.read().splitlines()
+ package_name = os.path.splitext(filename)[0]
+ entrypoints = filter_entrypoints(package_name, entrypoints)
if entrypoints != []:
- jobs.append([os.path.splitext(filename)[0], entrypoints])
+ jobs.append([package_name, entrypoints])
# Create a process pool.
pool = multiprocessing.Pool(multiprocessing.cpu_count())
« 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