| Index: visual_studio/NativeClientVSAddIn/buildbot_run.py
|
| diff --git a/visual_studio/NativeClientVSAddIn/buildbot_run.py b/visual_studio/NativeClientVSAddIn/buildbot_run.py
|
| index d6b20201c05be61e5773ef05017af19e6e3fc043..db65b42d64255a65f5ca6bf5783a675c5e5bb61f 100644
|
| --- a/visual_studio/NativeClientVSAddIn/buildbot_run.py
|
| +++ b/visual_studio/NativeClientVSAddIn/buildbot_run.py
|
| @@ -11,19 +11,33 @@ annootator syntax
|
| import os
|
| import sys
|
| import subprocess
|
| +import urllib2
|
| +import zipfile
|
| +from os.path import join
|
|
|
| GSURL = 'https://commondatastorage.googleapis.com'
|
| GSPATH = 'nativeclient-mirror/nacl/nacl_sdk/sdk'
|
| +SDKROOT = join('..', '..', 'out', 'sdk')
|
| +
|
|
|
| def Log(msg):
|
| sys.stdout.write(msg + '\n')
|
| sys.stdout.flush()
|
|
|
|
|
| -def RunCommand(cmd):
|
| +def RunCommand(cmd, env=None):
|
| Log("Running: %s" % cmd)
|
| Log("CWD: %s" % os.getcwd())
|
| - rtn = subprocess.call(cmd, shell=True)
|
| + if type(cmd) == str:
|
| + cmd = cmd.split()
|
| +
|
| + if sys.platform == 'cygwin':
|
| + # allow bat files in the current working directory to
|
| + # be executed on cygwin as they are on win32
|
| + if not os.path.dirname(cmd[0]) and os.path.exists(cmd[0]):
|
| + cmd = './' + cmd
|
| +
|
| + rtn = subprocess.call(cmd, shell=True, env=env)
|
| if rtn:
|
| Log('@@@STEP_FAILURE@@@')
|
| sys.exit(1)
|
| @@ -31,21 +45,46 @@ def RunCommand(cmd):
|
|
|
| def StepBuild():
|
| Log('@@@BUILD_STEP build AddIn@@@')
|
| - if sys.platform == 'cygwin':
|
| - RunCommand(['./build.bat'])
|
| - else:
|
| - RunCommand(['build.bat'])
|
| + RunCommand('build.bat')
|
| +
|
| +
|
| +def StepInstall():
|
| + Log('@@@BUILD_STEP Install AddIn@@@')
|
| + RunCommand('developer_deploy.bat')
|
| +
|
| +
|
| +def StepInstallSDK():
|
| + Log('@@@BUILD_STEP Install SDK@@@')
|
| + naclsdk = join(SDKROOT, 'nacl_sdk', 'naclsdk.bat')
|
| + if not os.path.exists(naclsdk):
|
| + if not os.path.exists(SDKROOT):
|
| + os.makedirs(SDKROOT)
|
| + filename = join(SDKROOT, 'nacl_sdk.zip')
|
| + url = GSURL + "/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip"
|
| + contents = urllib2.urlopen(url).read()
|
| + with open(filename, 'wb') as zfileout:
|
| + zfileout.write(contents)
|
| + zfile = zipfile.ZipFile(filename)
|
| + zfile.extractall(SDKROOT)
|
| +
|
| + RunCommand([naclsdk, 'update', '--force', 'pepper_23'])
|
| + RunCommand([naclsdk, 'update', '--force', 'pepper_canary'])
|
|
|
|
|
| def StepTest():
|
| Log('@@@BUILD_STEP Testing AddIn@@@')
|
| # Don't actually test yet
|
| - #RunCommand(['test.bat'])
|
| + env = dict(os.environ)
|
| + sdkroot = os.path.abspath(join(SDKROOT, 'nacl_sdk'))
|
| + env['NACL_SDK_ROOT'] = join(sdkroot, 'pepper_23')
|
| + RunCommand('test.bat', env)
|
| + env['NACL_SDK_ROOT'] = join(sdkroot, 'pepper_canary')
|
| + RunCommand('test.bat', env)
|
|
|
|
|
| def _FindInPath(filename):
|
| for path in os.environ['PATH'].split(os.pathsep):
|
| - result = os.path.join(path, filename)
|
| + result = join(path, filename)
|
| if os.path.exists(result):
|
| return result
|
|
|
| @@ -60,7 +99,7 @@ def _GetGsutil():
|
| # gsutil from the slave scripts folder
|
| import slave
|
| slave_dir = os.path.dirname(slave.__file__)
|
| - gsutil = os.path.join(slave_dir, 'gsutil')
|
| + gsutil = join(slave_dir, 'gsutil')
|
| if os.name == 'nt':
|
| gsutil += '.bat'
|
| gsutil = [gsutil]
|
| @@ -82,7 +121,7 @@ def StepArchive():
|
| Log('@@@BUILD_STEP Archiving %s@@@' % rev)
|
| basename = 'vs_addin.tgz'
|
| remote_name = '%s/%s/%s' % (GSPATH, rev, basename)
|
| - local_filename = os.path.join('..', '..', 'out',
|
| + local_filename = join('..', '..', 'out',
|
| 'vs_addin', basename)
|
| cmd = _GetGsutil()
|
| cmd += ['cp', '-a', 'public-read', local_filename,
|
| @@ -94,6 +133,8 @@ def StepArchive():
|
|
|
| def main():
|
| StepBuild()
|
| + StepInstall()
|
| + StepInstallSDK()
|
| StepTest()
|
| StepArchive()
|
|
|
|
|