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

Side by Side Diff: visual_studio/NativeClientVSAddIn/buildbot_run.py

Issue 11090079: Include svn revsion in AddIn Version (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file 3 # found in the LICENSE file
4 4
5 """Entry point for the AddIn build bot. 5 """Entry point for the AddIn build bot.
6 6
7 Perform build steps and output results using the buildbot 7 Perform build steps and output results using the buildbot
8 annootator syntax 8 annootator syntax
9 """ 9 """
10 10
11 import os 11 import os
12 import sys 12 import sys
13 import re
14 import shutil
13 import subprocess 15 import subprocess
14 import urllib2 16 import urllib2
15 import zipfile 17 import zipfile
16 18
17 GSURL = 'https://commondatastorage.googleapis.com' 19 GSURL = 'https://commondatastorage.googleapis.com'
18 GSPATH = 'nativeclient-mirror/nacl/nacl_sdk/sdk' 20 GSPATH = 'nativeclient-mirror/nacl/nacl_sdk/sdk'
19 SDKROOT = os.path.join('..', '..', 'out', 'sdk') 21 SDKROOT = os.path.join('..', '..', 'out', 'sdk')
20 22
21 23
22 def Log(msg): 24 def Log(msg):
(...skipping 15 matching lines...) Expand all
38 40
39 rtn = subprocess.call(cmd, env=env) 41 rtn = subprocess.call(cmd, env=env)
40 if rtn: 42 if rtn:
41 Log("Command returned non-zero exit code: %s" % rtn) 43 Log("Command returned non-zero exit code: %s" % rtn)
42 Log('@@@STEP_FAILURE@@@') 44 Log('@@@STEP_FAILURE@@@')
43 sys.exit(1) 45 sys.exit(1)
44 46
45 47
46 def StepBuild(): 48 def StepBuild():
47 Log('@@@BUILD_STEP build AddIn@@@') 49 Log('@@@BUILD_STEP build AddIn@@@')
48 RunCommand('build.bat') 50
51 rev = os.environ.get('BUILDBOT_GOT_REVISION')
52 if not rev:
53 Log('No BUILDBOT_GOT_REVISION found in environ')
54 Log('@@@STEP_FAILURE@@@')
55 sys.exit(1)
56
57 if rev[0] == 'r':
58 rev = [1:]
59
60 # make a backup of AssemblyInfo.cs before we modify it
61 filename = os.path.join('NativeClientVSAddIn', 'AssemblyInfo.cs')
62 backup = filename + '.orig'
63 shutil.copyfile(filename, backup)
64
65 try:
66 # Before we do the build, insert the revsion information
67 # info AssemblyInfo.cs. Thie will then be reported as
68 # the addin version in visual studio.
69 with open(filename, 'rb') as f:
70 contents = f.read()
71
72 pattern = r'(\[assembly: AssemblyInformationalVersion\("\d+\.\d+\.).*"\)\]'
binji 2012/10/11 20:23:00 I think this regexp should extract the end part to
73 contents = re.sub(pattern, r'\1%s")]' % rev, contents)
74
75 with open(filename, 'wb') as f:
76 f.write(contents)
77
78 RunCommand('build.bat')
79 finally:
80 # Once build is done restore original file
81 os.remove(filename)
82 os.rename(backup, filename)
83
49 84
50 85
51 def StepInstall(): 86 def StepInstall():
52 Log('@@@BUILD_STEP Install AddIn@@@') 87 Log('@@@BUILD_STEP Install AddIn@@@')
53 RunCommand('developer_deploy.bat') 88 RunCommand('developer_deploy.bat')
54 89
55 90
56 def StepInstallSDK(): 91 def StepInstallSDK():
57 Log('@@@BUILD_STEP Install SDK@@@') 92 Log('@@@BUILD_STEP Install SDK@@@')
58 naclsdk = os.path.join(SDKROOT, 'nacl_sdk', 'naclsdk.bat') 93 naclsdk = os.path.join(SDKROOT, 'nacl_sdk', 'naclsdk.bat')
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 def main(): 182 def main():
148 StepBuild() 183 StepBuild()
149 StepInstall() 184 StepInstall()
150 StepInstallSDK() 185 StepInstallSDK()
151 StepTest() 186 StepTest()
152 StepArchive() 187 StepArchive()
153 188
154 189
155 if __name__ == '__main__': 190 if __name__ == '__main__':
156 main() 191 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698