source: tol/windows/build_tools/_uptol_new.bat @ ae2bb0c

1941-docker-image-to-testdevel
Last change on this file since ae2bb0c was e92e09a, checked in by Jorge Pérez <josp.jorge@…>, 18 years ago
  • new directory xxx/win-VC9 with configuration files to compile with VC 9.0
  • uptol_new.bat to simplify environment check: just Visual Studio console is needed.
  • *_d.dll debugger versions are skipped in .nsi

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@298 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 13.0 KB
Line 
1@Rem Author: Jorge <josp.jorge@gmail.com>
2
3rem @Echo oN
4Rem Compila tol y toltcl, el postbuild se encarga de copiar los binarios
5Rem Copia stdlib hacia ActiveTOL
6Rem Copia tolbase\toltklib\byswidget, tolbase\lib\ hacia ActiveTOL
7
8rem SetLocal enableextensions enabledelayedexpansion
9Rem Validacion de argumentos
10
11Rem procesamiento de opciones de linea de comandos
12Set _rebuild=0
13Set _jup=0
14Set _pnsis=0
15Set _dotests=0
16Set _dodist=0
17
18Set _plog=!CD!\log2clog.exe
19Set _fbody=!CD!\test_status\BODY.txt
20
21If Not Exist test_status\nul (
22  Md test_status
23)
24
25Rem !!!!!!!!!!!!!!!!!!!!!!!
26
27Set tolphost=192.168.10.16
28
29Set _url_bin_=http://%tolphost%/pub/bin/win
30
31Set tdt_subject="UPTOL works fine"
32Set tdt_body=%_fbody%
33Set tdt_attach=""
34
35     
36:READ_OPTS
37If "%1"=="" Goto END_OPTS
38If "%1"=="/?" Goto SHOW_HELP
39If "%1"=="/smartbuild" (
40  Set _rebuild=0
41  Goto NEXT_OPTS
42)
43If "%1"=="/rebuild" (
44  Set _rebuild=1
45  Goto NEXT_OPTS
46)
47If "%1"=="/jup" (
48  Set _jup=1
49  Goto NEXT_OPTS
50)
51If "%1"=="/pnsis" (
52  Set _pnsis=1
53  Goto NEXT_OPTS
54)
55If "%1"=="/tests" (
56  Set _dotests=1
57  Goto NEXT_OPTS
58)
59If "%1"=="/no_tests" (
60  Set _dotests=0
61  Goto NEXT_OPTS
62)
63If "%1"=="/dist" (
64  Set _dodist=1
65  Goto NEXT_OPTS
66)
67Set _msg_error=Opcion invalida %1
68Goto ERROR
69:NEXT_OPTS
70Shift
71Goto READ_OPTS
72:END_OPTS
73
74Rem Goto TMP
75Rem Goto DODIST
76
77
78If "%_rebuild%"=="1" (
79  Set _rbopt=/rebuild
80)
81
82Set ATOLDIR=!CD!\..\ActiveTol\bin
83
84Goto BEGIN
85
86Rem Ayuda de uso
87:SHOW_HELP
88@more README
89Goto END
90
91Rem Codigo de error
92:ERROR
93If Not Defined _msg_error (
94  Echo Error invocado sin mensage
95) else (
96  Echo %_msg_error%
97  Set tdt_subject="UPTOL works badly"
98  Echo %_msg_error% >> %_fbody%
99)
100Pause
101Goto END
102
103Rem Codigo de retorno generico
104:RET
105If Defined _ret (
106  Goto %_ret%
107) Else (
108  Set _msg_error=Error interno! Punto de retorno no definido.
109  Goto ERROR
110)
111
112Rem Actualiza scripts en ActiveTOL, recibe como argumento
113Rem   - _dir_src,  directorio origen
114Rem   - _dir_dest,  directorio destino
115:UP_SCRIPTS
116If Exist %_dir_dest%\nul (
117  Echo Borrando scripts antiguos de %_dir_dest%
118  Rmdir /S /Q %_dir_dest%
119)
120Echo Copiando scripts nuevos de %_dir_src% a %_dir_dest%
121xcopy %_dir_src% %_dir_dest% /S /F /Y /I /EXCLUDE:exclude.lst
122If errorlevel 1  (
123  Set _msg_error=Error copiando %_dir_src% hacia %_dir_dest%
124  Goto ERROR
125)
126Goto RET
127
128Rem Codigo generico de compilacion
129:COMPILE
130
131Rem Verifico que ejecutemos desde la consola de Visual Studio
132If Not Defined VCINSTALLDIR (
133  Set _msg_error=Solo se puede compilar desde una consola Visual Studio C++
134  Goto ERROR
135)
136
137If Not Defined _windir (
138  If Not Defined VS80COMNTOOLS (
139    If Not Defined VS90COMNTOOLS (
140      Set _msg_error=VS80COMNTOOLS o VS90COMNTOOLS no definida. Ejecute este bat desde una consola de Visual Studio C++.
141      Rem Goto _VSDONE
142    ) Else (
143      Set VSCOMNTOOLS=!VS90COMNTOOLS!
144      Set _windir=win-VC9
145    )
146  ) Else (
147    Set VSCOMNTOOLS=!VS80COMNTOOLS!
148    Set _windir=win-VC8
149  )
150)
151
152If Not Defined _mod (
153  Set _msg_error=Error interno! variable _mod no definida en COMPILE
154  Goto ERROR
155)
156If Not Exist ..\..\%_mod%\nul (
157  Set _msg_error=Error interno! el directorio %_mod% debia existir cuando se ha solicitado su compilacion.
158  Goto ERROR
159)
160If Not Defined _sln (
161  Set _msg_error=Error interno variable _sln no definida en COMPILE
162  Goto ERROR
163)
164
165If Not Exist ..\..\%_mod%\%_windir%\%_sln% (
166  Set _msg_error=No se puede compilar, el archivo %_mod%\win-VC9\%_sln% no existe
167  Goto ERROR
168)
169
170Rem Verifico postbuild.bat: aseguro que existe. postbuild copia la compilacion a ActiveTOL
171If Not Exist ..\..\%_mod%\%_windir%\postbuild.bat (
172  xcopy /F /Y postbuild.bat ..\..\%_mod%\%_windir%
173)
174vcbuild %_rbopt% /useenv ..\..\%_mod%\%_windir%\%_sln% "Release|Win32"
175If errorlevel 1 (
176  Set _msg_error=Fallo en vcbuild con la solucion %_sln%
177  Goto ERROR
178)
179Goto RET
180
181:CHECK_VARS
182For %%v in %_vars% do (
183  If Not defined %%v (
184    Echo La variable %%v debe estar definida para compilar %_mod%
185    If Not Defined _msg_extra Goto END
186    If "%_msg_extra%"=="" Goto END
187    Echo %_msg_extra%
188    Pause
189    Goto END
190  )
191)
192Goto RET
193
194:BEGIN
195
196Rem Compilacion de TOL
197Set _mod=tol
198Set _sln=gnutol.sln
199Set _ret=RET_TOLCC
200Goto COMPILE
201:RET_TOLCC
202
203Rem Compilacion de TOLTCL
204Rem Verifico que las variable de entorno de TOLTCL esten definidas
205Set _vars=(TCL_INCLUDE TCL_LIB)
206Set _msg_extra=TCL_INCLUDE debe apuntar a los include de Tcl. TCL_LIB debe apuntar a las librerias de Tcl.
207Set _ret=RET_VARTT
208Goto CHECK_VARS
209:RET_VARTT
210Set _mod=toltcl
211Set _sln=toltcl.sln
212Set _ret=RET_TTCC
213Goto COMPILE
214:RET_TTCC
215
216Rem Compilacion de VBTOL
217If "%_jup%"=="1" Goto RET_VBCC
218Set _mod=vbtol
219Set _sln=vbtol.sln
220Set _ret=RET_VBCC
221Goto COMPILE
222:RET_VBCC
223
224Rem Compilacion de TOLSH
225If "%_jup%"=="1" Goto RET_TSHCC
226PushD ..\..\tolsh
227call build
228xcopy /F /Y tolsh.exe !ATOLDIR!
229PopD
230:RET_TSHCC
231
232If "%_jup%"=="1" Goto END
233
234Rem Copio scripts TOL y TCL hacia ActiveTOL
235If Not Exist ..\ActiveTOL\nul (
236  Echo Directorio ActiveTOL no existente. No se copiaran scripts.
237  Pause
238  Goto END
239)
240
241Rem Copia de stdlib
242Set _dir_src=..\..\tol\stdlib
243Set _dir_dest=..\ActiveTOL\bin\stdlib
244Set _ret=RET_CPTL
245Goto UP_SCRIPTS
246:RET_CPTL
247Rem copiamos pkgIndex.tcl de toltcl
248xcopy ..\..\toltcl\pkgIndex.tcl ..\ActiveTOL\lib\toltcl\ /F /Y /I
249If errorlevel 1 (
250  Set _msg_error=Error copiando toltcl\pkgIndex.tcl hacia ActiveTOL
251  Goto ERROR
252)
253Rem Copia de scripts tcl, byswidget, toltk y rmtps_client
254Rem byswidget
255Set _dir_src=..\..\tolbase\lib\byswidget
256Set _dir_dest=..\ActiveTOL\lib\byswidget
257Set  _ret=RET_CPBYS
258Goto UP_SCRIPTS
259:RET_CPBYS
260Rem toltk
261Set _dir_src=..\..\tolbase\lib\toltk
262Set _dir_dest=..\ActiveTOL\lib\toltk
263Set  _ret=RET_CPTTK
264Goto UP_SCRIPTS
265:RET_CPTTK
266Rem rmtps_client
267Set _dir_src=..\..\tolbase\lib\rmtps_client
268Set _dir_dest=..\ActiveTOL\lib\rmtps_client
269Set  _ret=RET_CPRMT
270Goto UP_SCRIPTS
271:RET_CPRMT
272
273Rem Recupero ficheros perdidos por cualquier causa
274If Not Exist ..\ActiveTOL\bin\tol.exe (
275  Echo Recuperando ejecutable perdido ..\ActiveTOL\bin\tol.exe
276  copy ..\..\tol\win-VC9\release\tol.exe ..\ActiveTOL\bin\tol.exe
277)
278If Not Exist ..\ActiveTOL\bin\tol.dll (
279  Echo Recuperando librería perdida ..\ActiveTOL\bin\tol.dll
280  copy ..\..\tol\win-VC9\release\tol.dll ..\ActiveTOL\bin\tol.dll
281)
282If Not Exist ..\ActiveTOL\bin\tolodbc*.dll (
283  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolodbc*.dll
284  copy ..\..\tol\win-VC9\libtolodbc\Release\*.dll ..\ActiveTOL\bin
285) 
286If Not Exist ..\ActiveTOL\bin\tolmysql*.dll (
287  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolmysql*.dll
288  copy ..\..\tol\win-VC9\libtolmysql\Release\*.dll ..\ActiveTOL\bin
289) 
290If Not Exist ..\ActiveTOL\bin\tolpgsql*.dll (
291  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolpgsql*.dll
292  copy ..\..\tol\win-VC9\libtolpgsql\Release\*.dll ..\ActiveTOL\bin
293) 
294If Not Exist ..\ActiveTOL\lib\toltcl\toltcl.dll (
295  Echo Recuperando librería perdida ..\ActiveTOL\lib\toltcl\toltcl.dll
296  copy ..\..\toltcl\win-vc9\Release\toltcl.dll ..\ActiveTOL\lib\toltcl\toltcl.dll
297)
298If Not Exist ..\ActiveTOL\bin\vbtol.dll (
299  Echo Recuperando librería perdida ..\ActiveTOL\bin\vbtol.dll
300  copy ..\..\vbtol\win-vc9\Release\vbtol.dll ..\ActiveTOL\bin\vbtol.dll
301)
302
303Rem Ejecuto los tests si me lo han pedido
304:DO_TESTS
305If "%_dodist%"=="1" (
306  If "%_dotests%"=="0" (
307    Echo "Forzando los test de tol debido a que se ha solicitado /dist"
308    Set _dotests=1
309  )
310)
311
312If "%_dotests%"=="1" (
313  If Exist ..\ActiveTOL\bin\tol.exe (
314    If Not Exist test_status (
315      Md test_status
316    ) Else (
317      Del /Q test_status\*.*
318    )
319    Set _tst_cd=!CD!\test_status
320    PushD ..\ActiveTOL\bin
321    Echo Ejecutando Tol standard tests ...
322    tol.exe -v -c"Text DupTestIndicatorPath=\"%CD%\\test_status\"" "..\\..\\tol_tests\\tol\\_tolTester.tol">!_tst_cd!\init.log
323    PopD
324    If Exist test_status\FAIL.txt (
325      Set test_status=FAIL
326      Set tdt_subject="ERROR ejecutando TOL_TESTS"
327      Set tdt_body="La ejecucion de TOL_TESTS genero el archivo de estado FAIL.txt. No se ha actualizado Tolbase en %_url_bin_%."
328      Set tdt_attach=test_status\FAIL.txt
329    ) Else If Exist test_status\WARNING.txt (
330      Set test_status=WARNING
331      Set tdt_subject="Version %_branchid% actualizada, WARNING ejecutando TOL_TESTS"
332      Set tdt_body=test_status\BODY.txt
333      Set tdt_attach=test_status\WARNING.txt
334    ) Else If Exist test_status\OK.txt (
335      Set test_status=OK
336      Set tdt_subject="Version %_branchid% actualizada, OK ejecutando TOL_TESTS"
337      Set tdt_body=test_status\BODY.txt
338      Set tdt_attach=test_status\OK.txt
339    ) Else (
340      Set test_status=FAIL
341      Set tdt_subject="ERROR ejecutando TOL_TEST"
342      Echo TOL_TEST no genero archivo de estado, verifique manualmente /tests>>%_fbody%
343      Echo.>>%_fbody%
344      Echo COMPUTERNAME  = %COMPUTERNAME%>>%_fbody%
345      Echo USERNAME      = %USERNAME%>>%_fbody%
346      Echo BRANCHID      = ""RAMA SVN"
347      Echo.>>%_fbody%
348      Echo Se ha adjuntado el log de inicializacion de TOL.>>%_fbody%
349      Set tdt_body=test_status\BODY.txt
350      Set tdt_attach=test_status\init.log
351    )
352  ) Else (
353    Set _msg_error=No se encuentra ..ºActiveTOL\bin\tol.exe necesario para ejecutar los tests de TOL
354    Goto ERROR
355  )
356)
357If "%test_status%"=="FAIL" (
358  Echo TOL_TESTS finalizo con errores, chequee %CD%\test_status
359  Goto SENDMAIL
360)
361
362
363Rem empaco la distribucion de tolbase si me lo han pedido
364If "%_dodist%"=="1" (
365  If Not Exist ..\NSIS\Tolbase*.exe (
366    Echo ..\NSIS\Tolbase*.exe no existe
367    If Not "%_pnsis%"=="1" (
368      Echo Habilitando /pnsis para poder hacer /dist
369      Set _pnsis=1
370    )
371  )
372)
373Set _cwd=%CD%
374If "%_pnsis%"=="1" (
375
376  Echo Generando el archivo de creación del instalador de tolbase ...
377  ..\ActiveTOL\bin\tol -v ..\NSIS\Tolbase.nsi.generate.tol
378  If Not Exist ..\NSIS\Tolbase.nsi (
379    Set _msg_error=El empaquetado de tolbase ..ºNSIS\Tolbase.nsi no existe.
380    Goto ERROR
381  )
382  If Exist ..\NSIS\Tolbase*.exe (
383    Del /Q ..\NSIS\Tolbase*.exe
384  )
385  Echo Creando instalador de tolbase ...
386  makensis /V2 /X"SetCompressor /FINAL /SOLID lzma" ..\NSIS\Tolbase.nsi
387  If Exist ..\NSIS\Tolbase*.exe (
388    Echo El instalador de Tolbase ha sido creado en "%_cwd%\..\NSIS"
389  ) Else (
390    Set _msg_error=No se ha encontrado el resultado de ejecutar makensis
391    Goto ERROR
392  )
393)
394
395:DODIST
396Rem envio el empaquetado hacia www.tol-project.org si se ha pedido
397Echo status es %test_status%
398If "%_dodist%"=="1" (
399  If Exist ..\NSIS\Tolbase*.exe (
400    For %%f In (..\NSIS\Tolbase*.exe) Do (
401      Echo encontrado %%~nxf
402      Set _fbin=%%~nxf
403    )
404    echo Creando el tag automatico correspondiente al empaquetado
405    cd NSIS
406    ..\ActiveTOL\bin\tol -v create_tag_build.tol
407    call create_tag_build.bat
408    Echo copiando last_development_tol_release_win.txt hacia www.tol-project.org
409    ..\ActiveTOL\bin\tol -v -c"Text WriteFile(\"last_development_tol_release_win.txt\",Version);"
410    pscp last_development_tol_release_win.txt tdt@cvs.tol-project.org:/home/bayes/pub/bin/win/.
411    Echo copiando Tolbase hacia http://www.tol-project.org
412    pscp Tolbase*.exe tdt@cvs.tol-project.org:/home/bayes/pub/bin/win/.
413    If "%_branchid%"=="trunk" (
414      Echo copiando tolbase-%_versionNumber%-setup.exe como tolbase-cvstrunk-setup.exe en www.tol-project.org
415      plink tdt@cvs.tol-project.org "cp /home/bayes/pub/bin/win/tolbase-%_versionNumber%-setup.exe /home/bayes/pub/bin/win/tolbase-cvstrunk-setup.exe"
416    )
417    Echo Moviendo el empaquetado a la carpeta de almacenamiento historico
418    ..\ActiveTOL\bin\tol -v store_history.tol
419    cd..
420    Echo Nueva version %_branchid% disponible en %_url_bin_%/!_fbin!>test_status\BODY.txt
421    Echo.>>%_fbody%
422    Echo El resultado de tol_tests esta disponible en el archivo adjunto.>>%_fbody%
423    Echo.>>%_fbody%
424  ) Else (
425    Echo No se puede enviar Tolbase hacia www.tol-project.exe pues no existe en NSIS
426    Set _msg_error=Utilice /pnsis para construirlo
427    Goto ERROR
428  ) 
429) Else (
430  Goto END
431)
432
433GOTO END
434
435:MAILTDT
436If Not Defined _lastup (
437  Echo.>>%_fbody%
438  Echo Variable interna _lastup con la fecha de la ultima actualizacion no esta definida.>>%_fbody%
439  Echo No se podra generar el reporte de cambios.>>%_fbody%
440  Echo Verifique .cvsopts.bat>>%_fbody%
441  Goto SENDMAIL
442)
443Echo Los cambios desde la fecha %_lastup% son los siguientes:>>%_fbody%
444Rem Log de TOL
445Set _mod=tol
446Set _ret=RET_TOLLOG
447Goto CVS_GENLOG
448:RET_TOLLOG
449Rem Log de TOLTCL
450Set _mod=toltcl
451Set _ret=RET_TTLOG
452Goto CVS_GENLOG
453:RET_TTLOG
454Rem Log de VBTOL
455Set _mod=vbtol
456Set _ret=RET_VBLOG
457Goto CVS_GENLOG
458:RET_VBLOG
459Rem Log de TOLBASE
460Set _mod=tolbase
461Set _ret=RET_TBLOG
462Goto CVS_GENLOG
463:RET_TBLOG
464Rem Log de TOL_TESTS
465Set _mod=tol_tests
466Set _ret=RET_TTSTLOG
467Goto CVS_GENLOG
468:RET_TTSTLOG
469Rem Actualizo la fecha de ultima actualizacion exitosa
470Echo Set _lastup=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%>>.cvsopts.bat
471
472:SENDMAIL
473mailtdt %tdt_subject% %tdt_body% %tdt_attach%
474:END
475Rem Limpia variables d entorno
476EndLocal
Note: See TracBrowser for help on using the repository browser.