~johanvdw/osgeo-fdo/trunk

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
@echo off

rem 
rem Copyright (C) 2004-2006  Autodesk, Inc.
rem 
rem This library is free software; you can redistribute it and/or
rem modify it under the terms of version 2.1 of the GNU Lesser
rem General Public License as published by the Free Software Foundation.
rem 
rem This library is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rem Lesser General Public License for more details.
rem 
rem You should have received a copy of the GNU Lesser General Public
rem License along with this library; if not, write to the Free Software
rem Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
rem 

SET FDOTARZIPFOLDERRTB=OpenSource_FDO
SET FDOTARGETFOLDER=OpenSource
SET FDOBUILDNUMBERRTB=O00X
SET FDOSOURCEZIP=%cd%
SET FDOERRORMESSAGE=

:study_params
if (%1)==() goto start_zip

if "%1"=="-help"    goto help_show
if "%1"=="-h"       goto help_show

if "%1"=="-b"       goto get_build
if "%1"=="-build"   goto get_build

if "%1"=="-o"       goto get_output
if "%1"=="-outpath" goto get_output

if "%1"=="-i"       goto get_input
if "%1"=="-inpath"  goto get_input

goto custom_error

:get_build
SET FDOBUILDNUMBERRTB=%2
goto next_param

:get_input
SET FDOSOURCEZIP=%2
goto next_param

:get_output
if (%2)==() goto custom_error
if not exist "%~2" mkdir "%~2"
pushd "%~2"
SET FDOTARGETFOLDER=%cd%
popd

:next_param
shift
shift
goto study_params

:start_zip
	SET ENV_EMPTY=FDOMYSQL
	if ("%FDOMYSQL%")==("") goto custom_error_ex
	if not exist "%FDOMYSQL%" goto custom_error_ex
	
	SET ENV_EMPTY=SDEHOME
	if ("%SDEHOME%")==("") goto custom_error_ex
	if not exist "%SDEHOME%" goto custom_error_ex
	
	SET ENV_EMPTY=FDOORACLE
	if ("%FDOORACLE%")==("") goto custom_error_ex
	if not exist "%FDOORACLE%" goto custom_error_ex
	
	if not exist "%FDOTARGETFOLDER%" mkdir "%FDOTARGETFOLDER%"
	pushd "%FDOTARGETFOLDER%"
	SET FDOTARGETFOLDER=%cd%
	popd
	if exist "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%" rmdir /S /Q "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%"

	if not ("%FDOBUILDNUMBERRTB%") == ("GXXX") goto start_copy
	if not exist "%FDOSOURCEZIP%\release.txt" echo Release not ready yet. Waiting...
	for /L %%g in (1,1,48) do if not exist "%FDOSOURCEZIP%\release.txt" perl -e "sleep(3);"
	if exist "%FDOSOURCEZIP%\release.txt" goto get_buildno
	echo Error: time out waiting for the release...
	exit /B 1
	
:get_buildno
	for /F %%f in (%FDOSOURCEZIP%\release.txt) do SET FDOBUILDNUMBERRTB=%%f
	
:start_copy
   copy /Y "%FDOSOURCEZIP%\fdo-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdoshp-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdosdf-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdowfs-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdowms-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdoarcsde-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdordbms-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdogdal-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdoogr-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdokingoracle-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   copy /Y "%FDOSOURCEZIP%\fdosqlite-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" "%FDOTARGETFOLDER%"
   
:start_unzip
   echo *start unzip files
   pushd "%FDOTARGETFOLDER%"
   7z x -ry "fdo-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdoshp-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdosdf-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdowfs-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdowms-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdoarcsde-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdordbms-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdogdal-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdoogr-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdokingoracle-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   7z x -ry "fdosqlite-4.2.0_%FDOBUILDNUMBERRTB%.tar.gz" >>nul
   
   7z x -ry "fdo-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdoshp-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdosdf-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdowfs-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdowms-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdoarcsde-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdordbms-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdogdal-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdoogr-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdokingoracle-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   7z x -ry "fdosqlite-4.2.0_%FDOBUILDNUMBERRTB%.tar" >>nul
   
   del /Q /F "*.tar"
   echo unzip files done...
   popd

:start_build
	SET FDOERROR=0
	pushd "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%"
	SET FDO=%cd%\Fdo
	SET FDOUTILITIES=%cd%\Utilities
	SET FDOTHIRDPARTY=%cd%\Thirdparty
	SET XALANROOT=%FDOTHIRDPARTY%\apache\xalan
	SET XERCESCROOT=%FDOTHIRDPARTY%\apache\xerces
	SET NLSDIR=%FDOTHIRDPARTY%\apache\xalan\src\xalanc\NLS
	popd
	
:start_build_debug
	echo *Starting DEBUG build
	pushd "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%"
	if exist thirdparty_debug_build_log.txt del /Q /F thirdparty_debug_build_log.txt
	call build_thirdparty.bat -c=debug ^> thirdparty_debug_build_log.txt
	SET FDOERRORMESSAGE="Thirdparty debug build returned an error, please check thirdparty_debug_build_log.txt for more information"
	if "%FDOERROR%"=="1" goto error
	if exist fdocore_debug_build_log.txt del /Q /F fdocore_debug_build_log.txt
	call build.bat -c=debug -d=build ^> fdocore_debug_build_log.txt
	SET FDOERRORMESSAGE="Fdocore debug build returned an error, please check fdocore_debug_build_log.txt for more information"
	if "%FDOERROR%"=="1" goto error
	popd
	echo End DEBUG build...

:start_build_release
	echo *Starting RELEASE build
	pushd "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%"
	if exist thirdparty_release_build_log.txt del /Q /F thirdparty_release_build_log.txt
	call build_thirdparty.bat -c=release ^> thirdparty_release_build_log.txt
	SET FDOERRORMESSAGE="Thirdparty release build returned an error, please check thirdparty_release_build_log.txt for more information"
	if "%FDOERROR%"=="1" goto error
	if exist fdocore_release_build_log.txt del /Q /F fdocore_release_build_log.txt
	call build.bat -c=release -d=build ^> fdocore_release_build_log.txt
	SET FDOERRORMESSAGE="Fdocore release build returned an error, please check fdocore_release_build_log.txt for more information"
	if "%FDOERROR%"=="1" goto error
	popd
	echo End RELEASE build...

:start_tests
:fdo_test
	pushd "%FDOTARGETFOLDER%\%FDOTARZIPFOLDERRTB%"
	echo *starting fdo tests
	if exist Fdo_unit_test_log.txt del /Q /F Fdo_unit_test_log.txt
	pushd Fdo\Unmanaged\Bin\Win32\Debug
	UnitTest.exe -NoWAIT >..\..\..\..\..\Fdo_unit_test_log.txt
	if errorlevel 1 echo Fdo unit test returned an error, please check Fdo_unit_test_log.txt for more information
	popd
:shp_test
	echo *starting shp tests
	if exist Shp_unit_test_log.txt del /Q /F Shp_unit_test_log.txt
	pushd Providers\SHP\src\UnitTest
	..\..\Bin\win32\debug\UnitTest.exe -NoWAIT >..\..\..\..\Shp_unit_test_log.txt
	if errorlevel 1 echo Shp unit test returned an error, please check Shp_unit_test_log.txt for more information
	popd
:sdf_test
	echo *starting sdf tests
	if exist SDF_unit_test_log.txt del /Q /F SDF_unit_test_log.txt
	pushd Providers\SDF\Bin\Win32
	Debug\UnitTest.exe -NoWAIT >..\..\..\..\SDF_unit_test_log.txt
	if errorlevel 1 echo Sdf unit test returned an error, please check SDF_unit_test_log.txt for more information
	popd
:wms_test
	echo *starting wms tests
	if exist WMS_unit_test_log.txt del /Q /F WMS_unit_test_log.txt
	pushd Providers\WMS\Bin\Win32\Debug
	UnitTest.exe -NoWAIT >..\..\..\..\..\WMS_unit_test_log.txt
	if errorlevel 1 echo Wms unit test returned an error, please check Wms_unit_test_log.txt for more information
	popd
:arcsde_test
	echo *starting arcsde tests
	if exist ArcSDE_unit_test_log.txt del /Q /F ArcSDE_unit_test_log.txt
	pushd Providers\ArcSDE\Bin\Win32\Debug
	UnitTest.exe server=adfdo.dnsalias.com port_multi=5151/tcp port_single=5151/tcp sdepwd=system dataset=FC4 rdbms=ORACLE -NoWAIT >..\..\..\..\..\ArcSDE_unit_test_log.txt
	if errorlevel 1 echo ArcSDE unit test returned an error, please check ArcSDE_unit_test_log.txt for more information
	popd
:gdal_test
	echo *starting gdal tests
	if exist GDAL_unit_test_log.txt del /Q /F GDAL_unit_test_log.txt
	pushd Providers\ArcSDE\Src\UnitTest
	..\..\Bin\Win32\Debug\UnitTest.exe -NoWAIT >..\..\..\..\GDAL_unit_test_log.txt
	if errorlevel 1 echo GDAL unit test returned an error, please check GDAL_unit_test_log.txt for more information
	popd

	popd
	
:end
echo Build test ended
exit /B 0

:custom_error_ex
echo *
echo Setup Error:
echo Environment variable %ENV_EMPTY% is undefined or contains an invalid path
echo Please setup this environment variable and try again
exit /B 1

:error
echo %FDOERRORMESSAGE%.
exit /B 1

:custom_error
echo The command is not recognized.
echo Please use the format:
:help_show
echo **************************************************************************
echo NOTE: To use the runtestbuild script, download and install the 7z  
echo       command-line and Windows shell utility for manipulating ZIP 
echo       archives. 7-Zip is free software distributed under the GNU LGPL. 
echo       7z can be obtained from http://www.7-zip.org/
echo *
echo runtestbuild.bat [-h] [-i=InFolder] [-o=OutFolder] [-b=BuildNumber]
echo *
echo Help:           -h[elp]
echo InFolder:       -i[npath]=input zip source folder
echo OutFolder:      -o[utpath]=destination build test folder, default (C:\OpenSource)
echo BuildNumber:    -b[uild]=User-Defined build number appended to the end of the tar.gz files
echo **************************************************************************

exit /B 0