Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: build_release.py

Issue 10879048: Use minor upgrade mechanism for updates, set installer versionautomatically (Closed)
Patch Set: Created June 11, 2013, 1:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 @echo off 1 #!/usr/bin/env python
2 2
3 if %1.==. goto NoKey 3 import sys, os, re, subprocess
4 4
5 pushd %~dp0 5 if len(sys.argv) < 2:
6 call libadblockplus\createsolution.bat 6 print >>sys.stderr, "Please add a command line parameter with the path of the signing key file"
7 msbuild libadblockplus\build\ia32\libadblockplus.sln /p:Configuration=Release 7 sys.exit(1)
8 msbuild libadblockplus\build\x64\libadblockplus.sln /p:Configuration=Release
9 msbuild AdblockPlus.sln "/p:Configuration=Release Test" /p:Platform=Win32
10 msbuild AdblockPlus.sln "/p:Configuration=Release Test" /p:Platform=x64
11 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\ia32\Release Test\AdblockPlus.dll"
12 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\x64\Release Test\AdblockPlusx64.dll"
13 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\ia32\Release Test\AdblockPlusEngine.ex e"
14 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\x64\Release Test\AdblockPlusEngine.exe "
15 8
16 pushd WixInstaller 9 basedir = os.path.dirname(os.path.abspath(sys.argv[0]))
17 nmake 10 key = sys.argv[1]
18 popd
19 11
20 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\ia32\adblockplusie-en-us-ia32.msi" 12 def sign(*argv):
21 signtool.exe sign /v /d "Adblock Plus" /du "http://adblockplus.org/" /f %1 /tr " http://www.startssl.com/timestamp" "build\x64\adblockplusie-en-us-x64.msi" 13 subprocess.call([
14 "signtool",
15 "sign", "/v",
16 "/d", "Adblock Plus",
17 "/du", "http://adblockplus.org/",
18 "/f", key,
19 "/tr", "http://www.startssl.com/timestamp"
20 ] + list(argv))
22 21
23 popd 22 def read_macro_value(file, macro):
24 goto End 23 handle = open(file, 'rb')
24 for line in handle:
25 match = re.search(r"^\s*#define\s+%s\s+\w?\"(.*?)\"" % macro, line)
26 if match:
27 return match.group(1)
28 raise Exception("Macro %s not found in file %s" % (macro, file))
25 29
26 :NoKey 30 version = read_macro_value(os.path.join(basedir, "src", "shared", "Version.h"), "IEPLUGIN_VERSION");
27 echo Please add a command line parameter with the path of the signing key file 31 buildnum, dummy = subprocess.Popen(['hg', 'id', '-R', basedir, '-n'], stdout=sub process.PIPE).communicate()
Felix Dahlke 2013/06/11 13:53:22 I'd consider buildnum = subprocess.Popen(...).comm
Wladimir Palant 2013/06/11 14:43:18 Seriously? [0] at the end of a long line is very n
28 goto End 32 buildnum = re.sub(r'\D', '', buildnum)
33 while version.count(".") < 1:
34 version += ".0"
35 version += ".%s" % buildnum
29 36
30 :End 37 subprocess.call([os.path.join(basedir, "libadblockplus", "createsolution.bat")])
38
39 for arch in ("ia32", "x64"):
40 platform = "/p:Platform=%s" % {"ia32": "Win32", "x64": "x64"}[arch]
41 subprocess.call([
42 "msbuild",
43 os.path.join(basedir, "libadblockplus", "build", arch, "libadblockplus.sln") ,
44 "/p:Configuration=Release",
45 platform
46 ])
47
48 subprocess.call([
49 "msbuild",
50 os.path.join(basedir, "AdblockPlus.sln"),
51 "/p:Configuration=Release Test",
52 platform])
53
54 plugin = {"ia32": "AdblockPlus.dll", "x64": "AdblockPlusx64.dll"}[arch]
55 sign(os.path.join(basedir, "build", arch, "Release Test", plugin),
56 os.path.join(basedir, "build", arch, "Release Test", "AdblockPlusEngine.ex e"))
57
58 installerParams = os.environ.copy()
59 installerParams["VERSION"] = version
60 subprocess.call(["nmake"], env=installerParams, cwd=os.path.join(basedir, "WixIn staller"))
61 sign(os.path.join(basedir, "build", "ia32", "adblockplusie-%s-en-us-ia32.msi" % version),
62 os.path.join(basedir, "build", "x64", "adblockplusie-%s-en-us-x64.msi" % ver sion))
Eric 2013/06/11 15:41:46 I would redo the batch file as a Makefile rather t
Wladimir Palant 2013/06/12 09:46:34 I would definitely be opposed to that - a Makefile
Eric 2013/06/12 14:33:24 (as I mentioned in email) The incremental calculat
OLDNEW

Powered by Google App Engine
This is Rietveld