OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Invokes the AppRTC closure compiler. | 6 """Invokes grunt build on AppRTC. |
7 | 7 |
8 The AppRTC javascript code must be closure-compiled. This script uses | 8 The AppRTC javascript code must be closure-compiled. This script uses |
9 the node toolchain we downloaded earlier. | 9 the node toolchain we downloaded earlier. |
10 """ | 10 """ |
11 | 11 |
12 import fileinput | 12 import fileinput |
13 import os | 13 import os |
14 import shutil | 14 import shutil |
15 import sys | 15 import sys |
16 | 16 |
(...skipping 10 matching lines...) Expand all Loading... |
27 | 27 |
28 for line in fileinput.input(package_json, inplace=True): | 28 for line in fileinput.input(package_json, inplace=True): |
29 if not 'phantomjs' in line: | 29 if not 'phantomjs' in line: |
30 sys.stdout.write(line) | 30 sys.stdout.write(line) |
31 | 31 |
32 | 32 |
33 def main(): | 33 def main(): |
34 node_path = os.path.abspath('node') | 34 node_path = os.path.abspath('node') |
35 if not os.path.exists(node_path): | 35 if not os.path.exists(node_path): |
36 return 'Expected node at %s.' % node_path | 36 return 'Expected node at %s.' % node_path |
37 samples_path = os.path.join('src', 'out', 'webrtc-samples') | 37 apprtc_path = os.path.join('src', 'out', 'apprtc') |
38 if not os.path.exists(samples_path): | 38 if not os.path.exists(apprtc_path): |
39 return 'Expected webrtc-samples at %s.' % os.path.abspath(samples_path) | 39 return 'Expected apprtc at %s.' % os.path.abspath(apprtc_path) |
40 | 40 |
41 _WorkaroundPhantomJsOnWin(samples_path) | 41 _WorkaroundPhantomJsOnWin(apprtc_path) |
42 os.chdir(samples_path) | 42 os.chdir(apprtc_path) |
43 | 43 |
44 if utils.GetPlatform() is 'win': | 44 if utils.GetPlatform() is 'win': |
45 npm_bin = os.path.join(node_path, 'npm.cmd') | 45 npm_bin = os.path.join(node_path, 'npm.cmd') |
46 node_bin = os.path.join(node_path, 'node.exe') | 46 node_bin = os.path.join(node_path, 'node.exe') |
47 else: | 47 else: |
48 npm_bin = os.path.join(node_path, 'bin', 'npm') | 48 npm_bin = os.path.join(node_path, 'bin', 'npm') |
49 node_bin = os.path.join(node_path, 'bin', 'node') | 49 node_bin = os.path.join(node_path, 'bin', 'node') |
50 | 50 |
51 utils.RunSubprocessWithRetry([npm_bin, 'install']) | 51 utils.RunSubprocessWithRetry([npm_bin, 'install']) |
52 local_grunt_bin = os.path.join('node_modules', 'grunt-cli', 'bin', 'grunt') | 52 local_grunt_bin = os.path.join('node_modules', 'grunt-cli', 'bin', 'grunt') |
53 | 53 |
54 if not os.path.exists(local_grunt_bin): | 54 if not os.path.exists(local_grunt_bin): |
55 return ('Missing grunt-cli in the webrtc-samples checkout; did ' | 55 return ('Missing grunt-cli in the apprtc checkout; did ' |
56 'npm install fail?') | 56 'npm install fail?') |
57 | 57 |
58 utils.RunSubprocessWithRetry([node_bin, local_grunt_bin, | 58 utils.RunSubprocessWithRetry([node_bin, local_grunt_bin, 'build']) |
59 'closurecompiler:debug']) | |
60 | 59 |
61 | 60 |
62 if __name__ == '__main__': | 61 if __name__ == '__main__': |
63 sys.exit(main()) | 62 sys.exit(main()) |
OLD | NEW |