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