Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: webrtc/tools/testing/build_apprtc_collider.py

Issue 2861653005: Moving scripts to download and build apprtc/collider. (Closed)
Patch Set: removing download_node.py (it seems unused) Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 #
4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree.
9
10 """Builds the AppRTC collider using the golang toolchain.
11
12 The golang toolchain is downloaded by download_golang.py. We use that here
13 to build the AppRTC collider server.
14 """
15
16 import os
17 import shutil
18 import subprocess
19 import sys
20 import tempfile
21
22 import utils
23
24
25 def main():
26 apprtc_dir = os.path.join('apprtc', 'src')
27 golang_workspace = os.path.join('src', 'out', 'go-workspace')
28 utils.RemoveDirectory(golang_workspace)
29
30 golang_workspace_src = os.path.join(golang_workspace, 'src')
31
32 collider_dir = os.path.join(apprtc_dir, 'collider')
33 shutil.copytree(collider_dir, golang_workspace_src,
34 ignore=shutil.ignore_patterns('.svn', '.git'))
35
36 golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '')
37 golang_path = os.path.join('go', 'bin', golang_binary)
38
39 golang_env = os.environ.copy()
40 golang_env['GOROOT'] = os.path.abspath('go')
41 golang_env['GOPATH'] = os.path.abspath(golang_workspace)
42 golang_env['PATH'] += os.pathsep + os.path.abspath('mercurial')
43 subprocess.check_call([golang_path, 'get', 'collidermain'],
44 env=golang_env)
45 subprocess.check_call([golang_path, 'build', 'collidermain'],
46 env=golang_env)
47
48 # Delete everything in the workspace except the build artifacts.
49 go_bin_dir = os.path.join(golang_workspace, 'bin')
50 tmp_dir = tempfile.mkdtemp()
51 shutil.move(go_bin_dir, tmp_dir)
52 utils.RemoveDirectory(golang_workspace)
53 os.makedirs(golang_workspace)
54 shutil.move(os.path.join(tmp_dir, 'bin'), go_bin_dir)
55 os.rmdir(tmp_dir)
56
57 if __name__ == '__main__':
58 sys.exit(main())
59
OLDNEW
« no previous file with comments | « no previous file | webrtc/tools/testing/build_mercurial_local.py » ('j') | webrtc/tools/testing/setup_apprtc.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698