Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / closure_compiler / checker.py
index 5b21583..b3b7597 100755 (executable)
@@ -11,6 +11,8 @@ import re
 import subprocess
 import sys
 import tempfile
+
+import build.inputs
 import processor
 
 
@@ -30,7 +32,6 @@ class Checker(object):
     "--jscomp_error=externsValidation",
     "--jscomp_error=globalThis",
     "--jscomp_error=invalidCasts",
-    "--jscomp_error=misplacedTypeAnnotation",
     "--jscomp_error=missingProperties",
     "--jscomp_error=missingReturn",
     "--jscomp_error=nonStandardJsDocs",
@@ -42,6 +43,9 @@ class Checker(object):
     "--jscomp_error=visibility",
     # TODO(dbeam): happens when the same file is <include>d multiple times.
     "--jscomp_off=duplicate",
+    # TODO(fukino): happens when cr.defineProperty() has a type annotation.
+    # Avoiding parse-time warnings needs 2 pass compiling. crbug.com/421562.
+    "--jscomp_off=misplacedTypeAnnotation",
     "--language_in=ECMASCRIPT5_STRICT",
     "--summary_detail_level=3",
   ]
@@ -127,10 +131,10 @@ class Checker(object):
 
   def _fix_up_error(self, error):
     """Filter out irrelevant errors or fix line numbers.
-    
+
     Args:
         error: A Closure compiler error (2 line string with error and source).
-    
+
     Return:
         The fixed up erorr string (blank if it should be ignored).
     """
@@ -168,7 +172,7 @@ class Checker(object):
             and its output (as a string).
     """
     depends = depends or []
-    externs = externs or []
+    externs = externs or set()
 
     if not self._check_java_path():
       return 1, ""
@@ -209,14 +213,14 @@ class Checker(object):
     self._debug("Summary: %s" % errors.pop())
 
     output = self._format_errors(map(self._fix_up_error, errors))
-    if runner_cmd.returncode:
+    if errors:
       self._error("Error in: %s%s" % (source_file, "\n" + output if output else ""))
     elif output:
       self._debug("Output: %s" % output)
 
     self._clean_up()
 
-    return runner_cmd.returncode, output
+    return bool(errors), output
 
 
 if __name__ == "__main__":
@@ -233,7 +237,11 @@ if __name__ == "__main__":
 
   checker = Checker(verbose=opts.verbose)
   for source in opts.sources:
-    exit, _ = checker.check(source, depends=opts.depends, externs=opts.externs)
+    depends, externs = build.inputs.resolve_recursive_dependencies(
+        source,
+        opts.depends,
+        opts.externs)
+    exit, _ = checker.check(source, depends=depends, externs=externs)
     if exit != 0:
       sys.exit(exit)