Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / native_client / buildbot / buildbot_toolchain_build.py
1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client 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 """Main entry point for toolchain_build buildbots.
7
8 Passes its arguments to toolchain_build.py.
9 """
10
11 import os
12 import subprocess
13 import sys
14
15 import packages
16
17 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
18 NACL_DIR = os.path.dirname(SCRIPT_DIR)
19 BUILD_DIR = os.path.join(NACL_DIR, 'build')
20 TOOLCHAIN_BUILD_DIR = os.path.join(NACL_DIR, 'toolchain_build')
21 TOOLCHAIN_BUILD_OUT_DIR = os.path.join(TOOLCHAIN_BUILD_DIR, 'out')
22
23 TEMP_PACKAGES_FILE = os.path.join(TOOLCHAIN_BUILD_OUT_DIR, 'packages.txt')
24
25 build_name = sys.argv[1]
26 bot_type = sys.argv[2]
27
28 build_script = os.path.join(NACL_DIR, 'toolchain_build', build_name + '.py')
29 if not os.path.isfile(build_script):
30   print 'Error - Unknown build script: %s' % build_script
31   sys.exit(1)
32
33 if sys.platform == 'win32':
34   print '@@@BUILD_STEP install mingw@@@'
35   sys.stdout.flush()
36   subprocess.check_call([os.path.join(NACL_DIR, 'buildbot', 'mingw_env.bat')])
37
38 print '@@@BUILD_STEP run_pynacl_tests.py@@@'
39 sys.stdout.flush()
40 subprocess.check_call([
41     sys.executable, os.path.join(NACL_DIR, 'pynacl', 'run_pynacl_tests.py')])
42
43 # Toolchain build emits its own annotator stages.
44 sys.stdout.flush()
45 subprocess.check_call([sys.executable,
46                        build_script,
47                        '--packages-file', TEMP_PACKAGES_FILE]
48                        + sys.argv[2:])
49
50 if bot_type == '--buildbot' or bot_type == '--trybot':
51   packages.UploadPackages(TEMP_PACKAGES_FILE, bot_type == '--trybot')