forked from connamara/quickfixn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage_release.bat
116 lines (96 loc) · 4.62 KB
/
package_release.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@echo off
REM || echo -e "\n*** Run this in DOS, not bash!\n" && exit
rem Setup variables
set TAG_VERSION=%1
if "%TAG_VERSION%" == "" goto usage
set QF_DIR=quickfixn-%TAG_VERSION%
SET ACCESS_KEY=%2
if "%ACCESS_KEY%" == "" goto usage
set SECRET_KEY=%3
if "%SECRET_KEY%" == "" goto usage
echo ==QuickFIX/N Package release script==
echo tag version: %TAG_VERSION%
echo
rem Update the assembly version
ruby scripts\update_assembly_version.rb %TAG_VERSION% QuickFIXn\QuickFix.csproj Messages\FIX40\QuickFix.FIX40.csproj Messages\FIX41\QuickFix.FIX41.csproj Messages\FIX42\QuickFix.FIX42.csproj Messages\FIX43\QuickFix.FIX43.csproj Messages\FIX44\QuickFix.FIX44.csproj Messages\FIX50\QuickFix.FIX50.csproj Messages\FIX50SP1\QuickFix.FIX50SP1.csproj Messages\FIX50SP2\QuickFix.FIX50SP2.csproj
if %errorlevel% neq 0 echo "update_assembly_version.rb failed" && exit /b %errorlevel%
echo * QuickFix .csproj files updated for new version number.
rem commit the version file, so it will be part of the tag
call git add QuickFIXn\QuickFix.csproj
call git add Messages\FIX40\QuickFix.FIX40.csproj
call git add Messages\FIX41\QuickFix.FIX41.csproj
call git add Messages\FIX42\QuickFix.FIX42.csproj
call git add Messages\FIX43\QuickFix.FIX43.csproj
call git add Messages\FIX44\QuickFix.FIX44.csproj
call git add Messages\FIX50\QuickFix.FIX50.csproj
call git add Messages\FIX50SP1\QuickFix.FIX50SP1.csproj
call git add Messages\FIX50SP2\QuickFix.FIX50SP2.csproj
call git commit -m "version number for version %TAG_VERSION%"
echo * Version number committed.
rem create the tag
call git tag -a %TAG_VERSION% -m "Release version %TAG_VERSION%"
echo * Created tag.
rem Get requested version
call git checkout %TAG_VERSION%
if %errorlevel% neq 0 echo "There was an error checking out QuickFIX/n %TAG_VERSION%" && exit /b %errorlevel%
echo * Checked out tag.
rem Generate code from dd
ruby generator/generate.rb
if %errorlevel% neq 0 echo "There was an error generating code from the data dictionaries" && exit /b %errorlevel%
echo * Generated code.
rem Build QuickFIX/n
call build.bat
if %errorlevel% neq 0 echo "There was an error building QuickFIX/n" && exit /b %errorlevel%
echo * Built QuickFIX/n.
rem Copy files to temp directory
IF EXIST tmp rmdir /s /q tmp
mkdir tmp
mkdir tmp\%QF_DIR%
mkdir tmp\%QF_DIR%\bin
mkdir tmp\%QF_DIR%\bin\netstandard2.0
mkdir tmp\%QF_DIR%\spec
mkdir tmp\%QF_DIR%\spec\fix
mkdir tmp\%QF_DIR%\config
copy QuickFIXn\bin\Release\netstandard2.0\QuickFix.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.dll
copy Messages\FIX40\bin\Release\netstandard2.0\QuickFix.FIX40.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX40.dll
copy Messages\FIX41\bin\Release\netstandard2.0\QuickFix.FIX41.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX41.dll
copy Messages\FIX42\bin\Release\netstandard2.0\QuickFix.FIX42.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX42.dll
copy Messages\FIX43\bin\Release\netstandard2.0\QuickFix.FIX43.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX43.dll
copy Messages\FIX44\bin\Release\netstandard2.0\QuickFix.FIX44.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX44.dll
copy Messages\FIX50\bin\Release\netstandard2.0\QuickFix.FIX50.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX50.dll
copy Messages\FIX50SP1\bin\Release\netstandard2.0\QuickFix.FIX50SP1.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX50SP1.dll
copy Messages\FIX50SP2\bin\Release\netstandard2.0\QuickFix.FIX50SP2.dll tmp\%QF_DIR%\bin\netstandard2.0\QuickFix.FIX50SP2.dll
xcopy spec\fix tmp\%QF_DIR%\spec\fix /e /y
copy config\sample_acceptor.cfg tmp\%QF_DIR%\config\
copy config\sample_initiator.cfg tmp\%QF_DIR%\config\
copy RELEASE_README.md tmp\%QF_DIR%\README.md
copy LICENSE tmp\%QF_DIR%\
copy RELEASE_NOTES.md tmp\%QF_DIR%\
echo * Copied files to tmp directory.
rem Create ZIP
set ZIP_NAME=%QF_DIR%.zip
IF EXIST %ZIP_NAME% del /q %ZIP_NAME%
ruby scripts\create_zip.rb tmp/%QF_DIR% %ZIP_NAME%
if %errorlevel% neq 0 echo "There was an error creating QuickFIX/n ZIP: %ZIP_NAME%" && exit /b %errorlevel%
echo * Created zip.
rem Upload ZIP
ruby scripts\s3_upload.rb %ZIP_NAME% %ACCESS_KEY% %SECRET_KEY%
if %errorlevel% neq 0 echo "There was an error uploading %ZIP_NAME% into the s3" && exit /b %errorlevel%
echo * Uploaded zip.
rem Remove temp directory
rmdir /s/q tmp
echo * Removed tmp directory.
rem Switch back to master
call git checkout master
echo * Changed back to master.
echo
echo Successfully created QuickFIX/n %TAG_VERSION%.
echo You can download the zip here: http://quickfixn.s3.amazonaws.com/%ZIP_NAME%
echo You must commit the new tag and deploy the website
set RESULT=0
goto quit
:usage
echo Usage: package_release.bat [VERSION] [S3_ACCESS_KEY] [S3_SECRET_KEY]
set RESULT=1
:quit
exit /B %RESULT%