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

Unified Diff: third_party/closure_compiler/tools/compile_coverage.py

Issue 547853002: closure: consider <include>d files when tracking compilation progress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process wants/needs as well Created 6 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: third_party/closure_compiler/tools/compile_coverage.py
diff --git a/third_party/closure_compiler/tools/compile_coverage.py b/third_party/closure_compiler/tools/compile_coverage.py
index ad73d233aeadd3cc395bdd63a9ea779b5e562c50..44e4572bfc128461392985bfc6a86570c58878bf 100755
--- a/third_party/closure_compiler/tools/compile_coverage.py
+++ b/third_party/closure_compiler/tools/compile_coverage.py
@@ -12,6 +12,11 @@ _SRC_ROOT = os.path.join(_HERE, '..', '..', '..')
_FROM_SRC = lambda p: os.path.abspath(os.path.join(_SRC_ROOT, p))
+from sys import path as sys_path
+sys_path.insert(0, os.path.join(_HERE, '..'))
+import processor
+
+
# High priority code to compile.
_NEED_TO_COMPILE = map(_FROM_SRC, [
'chrome/browser/resources',
@@ -43,11 +48,16 @@ _RELEVANT_JS = lambda f: f.endswith('.js') and not f.startswith(_IGNORE_DIRS)
def main():
line_cache = {}
- def js_files_in_dir(js_dir):
+ def js_files_and_deps_in_dir(js_dir):
found_files = set()
+
for root, dirs, files in os.walk(js_dir):
abs_files = [os.path.abspath(os.path.join(root, f)) for f in files]
- found_files.update(filter(_RELEVANT_JS, abs_files))
+ relevant_files = filter(_RELEVANT_JS, abs_files)
+ found_files.update(relevant_files)
+ for f in relevant_files:
+ found_files.update(processor.Processor(f).included_files)
+
return found_files
def num_lines(f):
@@ -72,6 +82,7 @@ def main():
gyp_dir = os.path.dirname(gyp_file)
target_file = os.path.join(gyp_dir, target['target_name'] + '.js')
compiled.add(os.path.abspath(target_file))
+ compiled.update(processor.Processor(target_file).included_files)
if 'variables' in target and 'depends' in target['variables']:
depends = target['variables']['depends']
@@ -86,7 +97,7 @@ def main():
files = set()
for n in _NEED_TO_COMPILE:
- files.update(js_files_in_dir(n))
+ files.update(js_files_and_deps_in_dir(n))
need_lines = sum(map(num_lines, files))
print 'need: %d files, %d lines' % (len(files), need_lines)
@@ -95,7 +106,7 @@ def main():
print '%.2f%% done with the code we need to compile' % need_done
for w in _WANT_TO_COMPILE:
- files.update(js_files_in_dir(w))
+ files.update(js_files_and_deps_in_dir(w))
want_lines = sum(map(num_lines, files))
print 'want: %d files, %d lines' % (len(files), want_lines)
« 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