source: tol/windows/build_tools/_uptol.bat @ 8313955

1941-docker-image-to-testdevel
Last change on this file since 8313955 was 8313955, checked in by Jorge Pérez <josp.jorge@…>, 15 years ago

refs #1353, uptol should be able to work with VS80 & VS90, verified with VS80. The ticket will be closed when checked with VS90.

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

  • Property mode set to 100644
File size: 13.4 KB
Line 
1@Rem Author: Jorge <josp.jorge@gmail.com>
2
3rem @Echo Off
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
17Set _plog=!CD!\log2clog.exe
18Set _fbody=!CD!\test_status\BODY.txt
19
20If Not Exist test_status\nul (
21  Md test_status
22)
23
24Rem !!!!!!!!!!!!!!!!!!!!!!!
25
26Set _url_bin_=https://www.tol-project.org/win32
27
28Set tdt_subject="UPTOL works fine"
29Set tdt_body=%_fbody%
30Set tdt_attach=""
31
32     
33:READ_OPTS
34If "%1"=="" Goto END_OPTS
35If "%1"=="/?" Goto SHOW_HELP
36If "%1"=="/no_update" (
37  Goto NEXT_OPTS
38)
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
130Rem Verifico que ejecutemos desde el SDK
131If Not Defined MSSdk (
132  Set _msg_error=Solo se puede compilar desde una consola Microsoft Platform SDK
133  Goto ERROR
134)
135If Not Defined _mod (
136  Set _msg_error=Error interno! variable _mod no definida en COMPILE
137  Goto ERROR
138)
139If Not Exist ..\..\%_mod%\nul (
140  Set _msg_error=Error interno! el directorio %_mod% debia existir cuando se ha solicitado su compilacion.
141  Goto ERROR
142)
143If Not Defined _sln (
144  Set _msg_error=Error interno variable _sln no definida en COMPILE
145  Goto ERROR
146)
147If Not Exist ..\..\%_mod%\%winSrc%\%_sln% (
148  Set _msg_error=No se puede compilar, el archivo %_mod%\%winSrc%\%_sln% no existe
149  Goto ERROR
150)
151If "%_vsvars32%"=="" (
152  If Defined VSCOMNTOOLS (
153    call "%VSCOMNTOOLS%vsvars32"
154    If errorlevel 1 (
155      Set _msg_error=No se pudo ejecutar vsvars32
156      Goto ERROR
157    )
158    Set _vsvars32=1
159  ) else (
160    Echo VSCOMNTOOLS no esta definida intentanto vsvars32 desde el PATH
161    call vsvars32
162    If errorlevel 1 (
163      Set _msg_error=No se pudo ejecutar vsvars32
164      Goto ERROR
165    )
166  )
167) else  (
168  Echo vsvars32 ya ha sido invocado
169)
170Rem Verifico postbuild.bat: aseguro que existe. postbuild copia la compilacion a ActiveTOL
171If Not Exist ..\..\%_mod%\%winSrc%\postbuild.bat (
172  xcopy /F /Y postbuild.bat %_mod%\%winSrc%
173)
174vcbuild %_rbopt% /useenv ..\..\%_mod%\%winSrc%\%_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
249xcopy ..\..\toltcl\library\toltcl.tcl ..\ActiveTOL\lib\toltcl\ /F /Y /I
250If errorlevel 1 (
251  Set _msg_error=Error copiando toltcl\pkgIndex.tcl hacia ActiveTOL
252  Goto ERROR
253)
254
255Rem Copia de scripts tcl: autoscroll, byswidget, markupparser, markupviewer,
256Rem mimetex, mkWidgets1.3 ndbmanager, notebookdb, renderpane, rmtps_client,
257Rem toltk, trycatch, wtree
258
259For %%x in (autoscroll byswidget markupparser markupviewer mimetex mkWidgets1.3 nbdbmanager notebookdb renderpane toltk trycatch wtree) do (
260  Set _dir_src=..\..\tolbase\lib\%%x
261  Set _dir_dest=..\ActiveTOL\lib\%%x
262
263  If Exist !_dir_dest!\nul (
264    Echo Borrando scripts antiguos de !_dir_dest!
265    Rmdir /S /Q !_dir_dest%!
266  )
267  Echo Copiando scripts nuevos de !_dir_src! a !_dir_dest!
268  xcopy !_dir_src! !_dir_dest! /S /F /Y /I /EXCLUDE:exclude.lst
269  If errorlevel 1  (
270    Set _msg_error=Error copiando !_dir_src! hacia !_dir_dest!
271    Goto ERROR
272  )
273)
274
275Rem Recupero ficheros perdidos por cualquier causa
276If Not Exist ..\ActiveTOL\bin\tol.exe (
277  Echo Recuperando ejecutable perdido ..\ActiveTOL\bin\tol.exe
278  copy ..\..\tol\%winSrc%\release\tol.exe ..\ActiveTOL\bin\tol.exe
279)
280If Not Exist ..\ActiveTOL\bin\tol.dll (
281  Echo Recuperando librería perdida ..\ActiveTOL\bin\tol.dll
282  copy ..\..\tol\%winSrc%\release\tol.dll ..\ActiveTOL\bin\tol.dll
283)
284If Not Exist ..\ActiveTOL\bin\tolodbc*.dll (
285  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolodbc*.dll
286  copy ..\..\tol\%winSrc%\libtolodbc\Release\*.dll ..\ActiveTOL\bin
287) 
288If Not Exist ..\ActiveTOL\bin\tolmysql*.dll (
289  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolmysql*.dll
290  copy ..\..\tol\%winSrc%\libtolmysql\Release\*.dll ..\ActiveTOL\bin
291) 
292If Not Exist ..\ActiveTOL\bin\tolpgsql*.dll (
293  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolpgsql*.dll
294  copy ..\..\tol\%winSrc%\libtolpgsql\Release\*.dll ..\ActiveTOL\bin
295) 
296If Not Exist ..\ActiveTOL\lib\toltcl\toltcl.dll (
297  Echo Recuperando librería perdida ..\ActiveTOL\lib\toltcl\toltcl.dll
298  copy ..\..\toltcl\%winSrc%\Release\toltcl.dll ..\ActiveTOL\lib\toltcl\toltcl.dll
299)
300If Not Exist ..\ActiveTOL\bin\vbtol.dll (
301  Echo Recuperando librería perdida ..\ActiveTOL\bin\vbtol.dll
302  copy ..\..\vbtol\%winSrc%\Release\vbtol.dll ..\ActiveTOL\bin\vbtol.dll
303)
304
305Rem Ejecuto los tests si me lo han pedido
306:DO_TESTS
307If "%_dodist%"=="1" (
308  If "%_dotests%"=="0" (
309    Echo "Forzando los test de tol debido a que se ha solicitado /dist"
310    Set _dotests=1
311  )
312)
313
314If "%_dotests%"=="1" (
315  If Exist ..\ActiveTOL\bin\tol.exe (
316    If Not Exist test_status (
317      Md test_status
318    ) Else (
319      Del /Q test_status\*.*
320    )
321    Set _tst_cd=!CD!\test_status
322    PushD ..\ActiveTOL\bin
323    Echo Ejecutando Tol standard tests ...
324        echo %CD%\\test_status\
325       
326    tol.exe -v -c"Text DupTestIndicatorPath=\"%CD%\\test_status\"" "..\\..\\..\\tol_tests\\tol\\_tolTester.tol">!_tst_cd!\init.log
327    PopD
328    If Exist test_status\FAIL.txt (
329      Set test_status=FAIL
330      Set tdt_subject="ERROR ejecutando TOL_TESTS"
331      Set tdt_body="La ejecucion de TOL_TESTS genero el archivo de estado FAIL.txt. No se ha actualizado Tolbase en %_url_bin_%."
332      Set tdt_attach=test_status\FAIL.txt
333    ) Else If Exist test_status\WARNING.txt (
334      Set test_status=WARNING
335      Set tdt_subject="Version %_branchid% actualizada, WARNING ejecutando TOL_TESTS"
336      Set tdt_body=test_status\BODY.txt
337      Set tdt_attach=test_status\WARNING.txt
338    ) Else If Exist test_status\OK.txt (
339      Set test_status=OK
340      Set tdt_subject="Version %_branchid% actualizada, OK ejecutando TOL_TESTS"
341      Set tdt_body=test_status\BODY.txt
342      Set tdt_attach=test_status\OK.txt
343    ) Else (
344      Set test_status=FAIL
345      Set tdt_subject="ERROR ejecutando TOL_TEST"
346      Echo TOL_TEST no genero archivo de estado, verifique manualmente /tests>>%_fbody%
347      Echo.>>%_fbody%
348      Echo COMPUTERNAME  = %COMPUTERNAME%>>%_fbody%
349      Echo USERNAME      = %USERNAME%>>%_fbody%
350      Echo BRANCHID      = ""RAMA SVN"
351      Echo.>>%_fbody%
352      Echo Se ha adjuntado el log de inicializacion de TOL.>>%_fbody%
353      Set tdt_body=test_status\BODY.txt
354      Set tdt_attach=test_status\init.log
355    )
356  ) Else (
357    Set _msg_error=No se encuentra ..ºActiveTOL\bin\tol.exe necesario para ejecutar los tests de TOL
358    Goto ERROR
359  )
360)
361If "%test_status%"=="FAIL" (
362  Echo TOL_TESTS finalizo con errores, chequee %CD%\test_status
363  Goto SENDMAIL
364)
365
366
367Rem empaco la distribucion de tolbase si me lo han pedido
368If "%_dodist%"=="1" (
369  If Not Exist ..\NSIS\Tolbase*.exe (
370    Echo ..\NSIS\Tolbase*.exe no existe
371    If Not "%_pnsis%"=="1" (
372      Echo Habilitando /pnsis para poder hacer /dist
373      Set _pnsis=1
374    )
375  )
376)
377Set _cwd=%CD%
378If "%_pnsis%"=="1" (
379
380  Echo Generando el archivo de creación del instalador de tolbase ...
381  ..\ActiveTOL\bin\tol -v ..\NSIS\Tolbase.nsi.generate.tol
382  If Not Exist ..\NSIS\Tolbase.nsi (
383    Set _msg_error=El empaquetado de tolbase ..ºNSIS\Tolbase.nsi no existe.
384    Goto ERROR
385  )
386  If Exist ..\NSIS\Tolbase*.exe (
387    Del /Q ..\NSIS\Tolbase*.exe
388  )
389  Echo Creando instalador de tolbase ...
390  makensis /V2 /X"SetCompressor /FINAL /SOLID lzma" ..\NSIS\Tolbase.nsi
391  If Exist ..\NSIS\Tolbase*.exe (
392    Echo El instalador de Tolbase ha sido creado en "%_cwd%\..\NSIS"
393  ) Else (
394    Set _msg_error=No se ha encontrado el resultado de ejecutar makensis
395    Goto ERROR
396  )
397)
398
399:DODIST
400Rem envio el empaquetado hacia www.tol-project.org si se ha pedido
401Echo status es %test_status%
402If "%_dodist%"=="1" (
403  If Exist ..\NSIS\Tolbase*.exe (
404    For %%f In (..\NSIS\Tolbase*.exe) Do (
405      Echo encontrado %%~nxf
406      Set _fbin=%%~nxf
407    )
408    REM echo Creando el tag automatico correspondiente al empaquetado
409    cd ..\NSIS
410    REM ..\ActiveTOL\bin\tol -v create_tag_build.tol
411    REM call create_tag_build.bat
412    REM Echo copiando last_official_tol_release_win.txt hacia www.tol-project.org
413    REM ..\ActiveTOL\bin\tol -v -c"Text WriteFile(\"last_official_tol_release_win.txt\",Version);"
414    REM pscp last_official_tol_release_win.txt toldevel@tolp.localbayes.es:.
415    Echo copiando Tolbase hacia www.tol-project.org
416    pscp Tolbase*.exe toldevel@tolp.localbayes.es:/var/www/packages/win32/.
417    If "%_branchid%"=="REMtrunkREM" (
418      Echo copiando tolbase-%_versionNumber%-setup.exe como tolbase-cvstrunk-setup.exe en www.tol-project.org
419      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"
420    )
421    REM Echo Moviendo el empaquetado a la carpeta de almacenamiento historico
422    REM ..\ActiveTOL\bin\tol -v store_history.tol
423    cd..
424        GOTO END
425    REM Echo Nueva version %_branchid% disponible en %_url_bin_%/!_fbin!>test_status\BODY.txt
426    Echo.>>%_fbody%
427    Echo El resultado de tol_tests esta disponible en el archivo adjunto.>>%_fbody%
428    Echo.>>%_fbody%
429  ) Else (
430    Echo No se puede enviar Tolbase hacia www.tol-project.exe pues no existe en NSIS
431    Set _msg_error=Utilice /pnsis para construirlo
432    Goto ERROR
433  ) 
434) Else (
435  Goto END
436)
437
438GOTO END
439
440:MAILTDT
441If Not Defined _lastup (
442  Echo.>>%_fbody%
443  Echo Variable interna _lastup con la fecha de la ultima actualizacion no esta definida.>>%_fbody%
444  Echo No se podra generar el reporte de cambios.>>%_fbody%
445  Echo Verifique .cvsopts.bat>>%_fbody%
446  Goto SENDMAIL
447)
448Echo Los cambios desde la fecha %_lastup% son los siguientes:>>%_fbody%
449Rem Log de TOL
450Set _mod=tol
451Set _ret=RET_TOLLOG
452Goto CVS_GENLOG
453:RET_TOLLOG
454Rem Log de TOLTCL
455Set _mod=toltcl
456Set _ret=RET_TTLOG
457Goto CVS_GENLOG
458:RET_TTLOG
459Rem Log de VBTOL
460Set _mod=vbtol
461Set _ret=RET_VBLOG
462Goto CVS_GENLOG
463:RET_VBLOG
464Rem Log de TOLBASE
465Set _mod=tolbase
466Set _ret=RET_TBLOG
467Goto CVS_GENLOG
468:RET_TBLOG
469Rem Log de TOL_TESTS
470Set _mod=tol_tests
471Set _ret=RET_TTSTLOG
472Goto CVS_GENLOG
473:RET_TTSTLOG
474Rem Actualizo la fecha de ultima actualizacion exitosa
475Echo Set _lastup=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%>>.cvsopts.bat
476
477:SENDMAIL
478mailtdt %tdt_subject% %tdt_body% %tdt_attach%
479:END
480Rem Limpia variables d entorno
481EndLocal
Note: See TracBrowser for help on using the repository browser.