forked from EamonHetherton/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShowBuildMenu.bat
324 lines (285 loc) · 10.9 KB
/
ShowBuildMenu.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
@echo off
pushd %~dp0
set NANT="%~dp0Tools\nant\bin\NAnt.exe" -t:net-3.5
set BUILDTOOL="%~dp0Tools\BuildTool\bin\Release\BuildTool.exe"
set AVAILABLE_CONFIGURATIONS=%~dp0available-test-configurations
set CURRENT_CONFIGURATION=%~dp0current-test-configuration
set NUNIT="%~dp0Tools\nunit\nunit-x86.exe"
:main-menu
echo ========================= NHIBERNATE BUILD MENU ==========================
echo --- SETUP ---
echo A. Set up for Visual Studio (creates AssemblyInfo.cs files).
echo.
echo --- TESTING ---
echo B. (Step 1) Set up a new test configuration for a particular database.
echo C. (Step 2) Activate a test configuration.
echo D. (Step 3) Run tests using active configuration.
echo.
echo --- BUILD ---
echo E. Build NHibernate (Debug)
echo F. Build NHibernate (Release)
echo G. Build Release Package (Also runs tests and creates documentation)
echo.
echo --- GRAMMAR ---
echo H. Grammar operations (related to Hql.g and HqlSqlWalker.g)
echo.
echo --- TeamCity (CI) build options
echo I. TeamCity build menu
echo.
echo --- Exit ---
echo X. Make the beautiful build menu go away.
echo.
%BUILDTOOL% prompt ABCDEFGHIX
if errorlevel 9 goto end
if errorlevel 8 goto teamcity-menu
if errorlevel 7 goto grammar-menu
if errorlevel 6 goto build-release-package
if errorlevel 5 goto build-release
if errorlevel 4 goto build-debug
if errorlevel 3 goto test-run
if errorlevel 2 goto test-activate
if errorlevel 1 goto test-setup-menu
if errorlevel 0 goto build-visual-studio
:test-setup-menu
echo A. Add a test configuration for SQL Server.
echo B. Add a test configuration for Firebird (x86).
echo C. Add a test configuration for Firebird (x64). [not recommended]
echo D. Add a test configuration for SQLite (x86).
echo E. Add a test configuration for SQLite (x64). [not recommended]
echo F. Add a test configuration for PostgreSQL.
echo G. Add a test configuration for Oracle.
echo.
echo X. Exit to main menu.
echo.
%BUILDTOOL% prompt ABCDEFGX
if errorlevel 7 goto main-menu
if errorlevel 6 goto test-setup-oracle
if errorlevel 5 goto test-setup-postgresql
if errorlevel 4 goto test-setup-sqlitex64
if errorlevel 3 goto test-setup-sqlitex86
if errorlevel 2 goto test-setup-firebirdx64
if errorlevel 1 goto test-setup-firebirdx86
if errorlevel 0 goto test-setup-sqlserver
:test-setup-sqlserver
set CONFIG_NAME=MSSQL
set PLATFORM=AnyCPU
set LIB_FILES=
set LIB_FILES2=
goto test-setup-generic
:test-setup-firebirdx86
set CONFIG_NAME=FireBird
set PLATFORM=x86
set LIB_FILES=lib\teamcity\firebird\*.dll
set LIB_FILES2=lib\teamcity\firebird\x86\*
goto test-setup-generic
:test-setup-firebirdx64
set CONFIG_NAME=FireBird
set PLATFORM=x64
set LIB_FILES=lib\teamcity\firebird\*.dll
set LIB_FILES2=lib\teamcity\firebird\x64\*
goto test-setup-generic
:test-setup-sqlitex86
set CONFIG_NAME=SQLite
set PLATFORM=x86
set LIB_FILES=lib\teamcity\sqlite\x86\*
set LIB_FILES2=
goto test-setup-generic
:test-setup-sqlitex64
set CONFIG_NAME=SQLite
set PLATFORM=x64
set LIB_FILES=lib\teamcity\sqlite\x64\*
set LIB_FILES2=
goto test-setup-generic
:test-setup-postgresql
set CONFIG_NAME=PostgreSQL
set PLATFORM=AnyCPU
set LIB_FILES=lib\teamcity\postgresql\*.dll
set LIB_FILES2=
goto test-setup-generic
:test-setup-oracle
set CONFIG_NAME=Oracle
set PLATFORM=x86
set LIB_FILES=lib\teamcity\oracle\x86\*.dll
set LIB_FILES2=
goto test-setup-generic
:test-setup-generic
set /p CFGNAME=Enter a name for your test configuration or press enter to use default name:
if /I "%CFGNAME%"=="" set CFGNAME=%CONFIG_NAME%-%PLATFORM%
mkdir "%AVAILABLE_CONFIGURATIONS%\%CFGNAME%"
if /I "%LIB_FILES%"=="" goto test-setup-generic-skip-copy
copy %LIB_FILES% "%AVAILABLE_CONFIGURATIONS%\%CFGNAME%"
if /I "%LIB_FILES2%"=="" goto test-setup-generic-skip-copy
copy %LIB_FILES2% "%AVAILABLE_CONFIGURATIONS%\%CFGNAME%"
:test-setup-generic-skip-copy
copy src\NHibernate.Config.Templates\%CONFIG_NAME%.cfg.xml "%AVAILABLE_CONFIGURATIONS%\%CFGNAME%\hibernate.cfg.xml"
echo Done setting up files. Starting notepad to edit connection string in file:
echo %AVAILABLE_CONFIGURATIONS%\%CFGNAME%\hibernate.cfg.xml
start notepad "%AVAILABLE_CONFIGURATIONS%\%CFGNAME%\hibernate.cfg.xml"
echo When you're done, don't forget to activate the configuration through the menu.
goto main-menu
:test-activate
%BUILDTOOL% pick-folder "%AVAILABLE_CONFIGURATIONS%" folder.tmp "Which test configuration should be activated?"
set /p FOLDER=<folder.tmp
del folder.tmp
mkdir "%CURRENT_CONFIGURATION%" 2> nul
del /q "%CURRENT_CONFIGURATION%\*"
copy "%FOLDER%\*" "%CURRENT_CONFIGURATION%"
echo Configuration activated.
goto main-menu
:test-run
start "" %NUNIT% NHibernate.nunit
goto main-menu
rem :build-test
rem %NANT% test
rem goto main-menu
:build-visual-studio
%NANT% visual-studio
goto main-menu
:build-debug
%NANT% clean build
echo.
echo Assuming the build succeeded, your results will be in the build folder.
echo.
goto main-menu
:build-release
%NANT% -D:project.config=release clean release
echo.
echo Assuming the build succeeded, your results will be in the build folder.
echo.
goto main-menu
:build-release-package
%NANT% -D:project.config=release clean package
echo.
echo Assuming the build succeeded, your results will be in the build folder.
echo.
goto main-menu
:grammar-menu
echo.
echo --- GRAMMAR ---
echo A. Regenerate all grammars.
echo Hql.g to HqlLexer.cs
echo Hql.g to HqlParser.cs
echo HqlSqlWalker.g to HqlSqlWalker.cs
echo SqlGenerator.g to SqlGenerator.cs
echo B. Regenerate all grammars, with Hql.g in debug mode.
echo C. Regenerate all grammars, with HqlSqlWalker.g in debug mode.
echo D. Regenerate all grammars, with SqlGenerator.g in debug mode.
echo E. Quick instructions on using debug mode.
echo.
echo X. Exit to main menu.
echo.
%BUILDTOOL% prompt ABCDEX
if errorlevel 5 goto main-menu
if errorlevel 4 goto antlr-debug
if errorlevel 3 goto antlr-sqlgenerator-debug
if errorlevel 2 goto antlr-hqlsqlwalker-debug
if errorlevel 1 goto antlr-hql-debug
if errorlevel 0 goto antlr-all
:antlr-all
echo *** Regenerating from Hql.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHql.bat
echo *** Regenerating from HqlSqlWalker.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHqlSqlWalker.bat
echo *** Regenerating from SqlGenerator.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrSqlGenerator.bat
goto main-menu
:antlr-hql-debug
echo *** Regenerating from Hql.g (Debug Enabled)
call src\NHibernate\Hql\Ast\ANTLR\AntlrHqlDebug.bat
echo *** Regenerating from HqlSqlWalker.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHqlSqlWalker.bat
echo *** Regenerating from SqlGenerator.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrSqlGenerator.bat
goto main-menu
:antlr-hqlsqlwalker-debug
echo *** Regenerating from Hql.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHql.bat
echo *** Regenerating from HqlSqlWalker.g (Debug Enabled)
call src\NHibernate\Hql\Ast\ANTLR\AntlrHqlSqlWalkerDebug.bat
echo *** Regenerating from SqlGenerator.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrSqlGenerator.bat
goto main-menu
:antlr-sqlgenerator-debug
echo *** Regenerating from Hql.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHql.bat
echo *** Regenerating from HqlSqlWalker.g
call src\NHibernate\Hql\Ast\ANTLR\AntlrHqlSqlWalker.bat
echo *** Regenerating from SqlGenerator.g (Debug Enabled)
call src\NHibernate\Hql\Ast\ANTLR\AntlrSqlGeneratorDebug.bat
goto main-menu
:antlr-debug
echo To use the debug grammar:
echo 1. Create a unit test that runs the hql parser on the input you're interested in.
echo The one you want to debug must be the first grammar parsed.
echo 2. Run the unit test. It will appear to stall.
echo 3. Download and run AntlrWorks (java -jar AntlrWorks.jar).
echo 4. Open the grammar you intend to debug in AntlrWorks.
echo 5. Choose "Debug Remote" and accept the default port.
echo 6. You should now be connected and able to step through your grammar.
goto main-menu
:teamcity-menu
echo.
echo --- TeamCity (CI) build options
echo A. NHibernate Trunk (default SQL Server)
echo B. NHibernate Trunk - Firebird (32-bit)
echo C. NHibernate Trunk - Firebird (64-bit)
echo D. NHibernate Trunk - SQLite (32-bit)
echo E. NHibernate Trunk - SQLite (64-bit)
echo F. NHibernate Trunk - PostgreSQL
echo G. NHibernate Trunk - Oracle (32-bit)
echo H. NHibernate Trunk - SQL Server ODBC (32-bit)
echo.
echo X. Exit to main menu.
echo.
%BUILDTOOL% prompt ABCDEFGHX
if errorlevel 8 goto main-menu
if errorlevel 7 goto teamcity-sqlServerOdbc
if errorlevel 6 goto teamcity-oracle32
if errorlevel 5 goto teamcity-postgresql
if errorlevel 4 goto teamcity-sqlite64
if errorlevel 3 goto teamcity-sqlite32
if errorlevel 2 goto teamcity-firebird64
if errorlevel 1 goto teamcity-firebird32
if errorlevel 0 goto teamcity-trunk
:teamcity-trunk
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-firebird32
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=firebird32
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-firebird64
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=firebird64
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-sqlite32
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=sqlite32
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-sqlite64
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=sqlite64
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-postgresql
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=postgresql
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-oracle32
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=oracle32
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:teamcity-sqlServerOdbc
move "%CURRENT_CONFIGURATION%" "%CURRENT_CONFIGURATION%-backup" 2> nul
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=sqlServerOdbc
move "%CURRENT_CONFIGURATION%-backup" "%CURRENT_CONFIGURATION%" 2> nul
goto main-menu
:end
popd