summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/braille_ime/check_braille_ime.py
blob: a25cd199e0d8fcc3d0970dddebab12e76289bced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python

# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

'''Uses the closure compiler to check the braille ime.'''

import os
import sys


_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))

sys.path.insert(0, os.path.join(_SCRIPT_DIR, '..', 'chromevox', 'tools'))
from jscompilerwrapper import RunCompiler


_CHROME_SOURCE_DIR = os.path.normpath(
    os.path.join(_SCRIPT_DIR, *[os.path.pardir] * 5))


def CheckBrailleIme():
  print 'Compiling braille IME.'
  js_files = [
      os.path.join(_SCRIPT_DIR, 'braille_ime.js'),
      os.path.join(_SCRIPT_DIR, 'main.js')]
  externs = [
      os.path.join(
          _CHROME_SOURCE_DIR,
          'third_party/closure_compiler/externs/chrome_extensions.js'),
      os.path.join(_SCRIPT_DIR, 'externs.js')]
  return RunCompiler(js_files, externs)


def main():
  success, output = CheckBrailleIme()
  if len(output) > 0:
    print output
  return int(not success)


if __name__ == '__main__':
  sys.exit(main())