OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Builds the AppRTC collider using the golang toolchain. | 6 """Builds the AppRTC collider using the golang toolchain. |
7 | 7 |
8 The golang toolchain is downloaded by download_golang.py. We use that here | 8 The golang toolchain is downloaded by download_golang.py. We use that here |
9 to build the AppRTC collider server. | 9 to build the AppRTC collider server. |
10 """ | 10 """ |
11 | 11 |
12 import os | 12 import os |
13 import shutil | 13 import shutil |
14 import subprocess | 14 import subprocess |
15 import sys | 15 import sys |
16 | 16 |
17 import utils | 17 import utils |
18 | 18 |
19 | 19 |
20 def main(): | 20 def main(): |
21 web_samples_dir = os.path.join('webrtc-samples', 'samples', 'web') | 21 apprtc_dir = os.path.join('apprtc', 'src') |
22 golang_workspace = os.path.join('src', 'out', 'go-workspace') | 22 golang_workspace = os.path.join('src', 'out', 'go-workspace') |
23 shutil.rmtree(golang_workspace, ignore_errors=True) | 23 shutil.rmtree(golang_workspace, ignore_errors=True) |
24 golang_workspace_src = os.path.join(golang_workspace, 'src') | 24 golang_workspace_src = os.path.join(golang_workspace, 'src') |
25 | 25 |
26 collider_dir = os.path.join(web_samples_dir, 'content', 'apprtc', 'collider') | 26 collider_dir = os.path.join(apprtc_dir, 'collider') |
27 shutil.copytree(collider_dir, golang_workspace_src, | 27 shutil.copytree(collider_dir, golang_workspace_src, |
28 ignore=shutil.ignore_patterns('.svn', '.git')) | 28 ignore=shutil.ignore_patterns('.svn', '.git')) |
29 | 29 |
30 golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '') | 30 golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '') |
31 golang_path = os.path.join('go', 'bin', golang_binary) | 31 golang_path = os.path.join('go', 'bin', golang_binary) |
32 | 32 |
33 golang_env = os.environ.copy() | 33 golang_env = os.environ.copy() |
34 golang_env['GOROOT'] = os.path.abspath('go') | 34 golang_env['GOROOT'] = os.path.abspath('go') |
35 golang_env['GOPATH'] = os.path.abspath(golang_workspace) | 35 golang_env['GOPATH'] = os.path.abspath(golang_workspace) |
36 golang_env['PATH'] += os.pathsep + os.path.abspath('mercurial') | 36 golang_env['PATH'] += os.pathsep + os.path.abspath('mercurial') |
37 subprocess.check_call([golang_path, 'get', 'collidermain'], | 37 subprocess.check_call([golang_path, 'get', 'collidermain'], |
38 env=golang_env) | 38 env=golang_env) |
39 subprocess.check_call([golang_path, 'build', 'collidermain'], | 39 subprocess.check_call([golang_path, 'build', 'collidermain'], |
40 env=golang_env) | 40 env=golang_env) |
41 | 41 |
42 if __name__ == '__main__': | 42 if __name__ == '__main__': |
43 sys.exit(main()) | 43 sys.exit(main()) |
OLD | NEW |