OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """Invokes the AppRTC closure compiler. |
| 7 |
| 8 The AppRTC javascript code must be closure-compiled. This script uses |
| 9 the node toolchain we downloaded earlier. |
| 10 """ |
| 11 |
| 12 import os |
| 13 import shutil |
| 14 import subprocess |
| 15 import sys |
| 16 |
| 17 import utils |
| 18 |
| 19 |
| 20 def main(): |
| 21 node_path = os.path.abspath('node') |
| 22 if not os.path.exists(node_path): |
| 23 return 'Expected node at %s.' % node_path |
| 24 samples_path = os.path.join('src', 'out', 'webrtc-samples') |
| 25 if not os.path.exists(samples_path): |
| 26 return 'Expected webrtc-samples at %s.' % os.path.abspath(samples_path) |
| 27 |
| 28 os.chdir(samples_path) |
| 29 |
| 30 if utils.GetPlatform() is 'win': |
| 31 npm_bin = os.path.join(node_path, 'npm.cmd') |
| 32 node_bin = os.path.join(node_path, 'node.exe') |
| 33 else: |
| 34 npm_bin = os.path.join(node_path, 'bin', 'npm') |
| 35 node_bin = os.path.join(node_path, 'bin', 'node') |
| 36 |
| 37 subprocess.check_call([npm_bin, 'install']) |
| 38 local_grunt_bin = os.path.join('node_modules', 'grunt-cli', 'bin', 'grunt') |
| 39 |
| 40 if not os.path.exists(local_grunt_bin): |
| 41 return ('Missing grunt-cli in the webrtc-samples checkout; did ' |
| 42 'npm install fail?') |
| 43 |
| 44 subprocess.check_call([node_bin, local_grunt_bin, 'closurecompiler:debug']) |
| 45 |
| 46 |
| 47 if __name__ == '__main__': |
| 48 sys.exit(main()) |
OLD | NEW |