-
Notifications
You must be signed in to change notification settings - Fork 5
/
fox.cmd
341 lines (301 loc) · 12.5 KB
/
fox.cmd
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
@echo off
rem =====================================================================================
rem This build tool provides a number of options to support development. Call this script
rem from the terminal with the command as the first parameter, such as:
rem
rem fox init
rem
rem Currently the following commands are supported
rem
rem init: Call once after cloning the repository to prepare for development
rem
rem NOTE: Requires Windows 10 build 17063 or later
rem =====================================================================================
setlocal
rem These parameters require updates whenever there is a new release. This happens
rem automatically in the release process.
rem DO NOT MODIFY - version {
set versionCefSharp=v97.1.61
set versionFpCefSharp=%versionCefSharp%.3
rem } - DO NOT MODIFY
rem These values are supposed to simplify the code
set urlGithub=https://github.com/cwollenhaupt/fpCefSharp
set urlDownload=%urlGithub%/releases/download
set urlRelease=%urlDownload%/%versionFpCefSharp%/fpCefSharp.%versionFpCefSharp%.zip
set urlFpDotNet=https://github.com/cwollenhaupt/fpDotNet/releases/download/v1.0/fpDotNet.zip
rem These values can be configured
set vfp9=%programfiles(x86)%\Microsoft Visual FoxPro 9\vfp9.exe
if exist fox.user.cmd call fox.user.cmd
if /I "%~1"=="init" goto Init
if /I "%~1"=="release" goto Release
if /I "%~1"=="test" goto Test
echo Supported commands are init, release, test
goto :eof
rem =====================================================================================
rem INIT
rem
rem The repository does not include any redundant files. Especially there is a minimal
rem number of non-mergable binary files (only tools).
rem
rem You run INIT once after cloning the repository to prepare your working folder for
rem development.
rem =====================================================================================
:Init
rem =====================================================================================
rem Check prerequisites
rem =====================================================================================
if not exist "%vfp9%" (
echo.
echo VFP executable "%vfp9%" does not exist
if exist fox.user.cmd (
echo Please add the following line to fox.user.cmd:
echo.
echo SET vfp9=full path to VFP9.exe
) else (
echo Please configure the location of VFP9.EXE in fox.user.cmd
echo SET vfp9=full path to VFP9.exe >>fox.user.cmd
)
goto end
)
rem =====================================================================================
rem Download cefSharp runtime
rem =====================================================================================
rem
rem The runtime is part of the latest fpCefSharp release. Alternatively, we can build
rem this folder with the C# project.
rem
rem --location GitHub sends a 302 Permanently Moved response
rem --ssl-no-revoke curl cannot check certificate revocation
md temp
curl --location ^
--ssl-no-revoke ^
--output temp/release.zip ^
--url %urlRelease%
tar -xf temp/release.zip --directory temp
xcopy temp\cef-bin-%versionCefSharp% ^
Source\CefSharpBrowser\cef-bin-%versionCefSharp%\ /yce
rmdir temp /q /s
rem =====================================================================================
rem Download all other dependencies
rem =====================================================================================
git submodule init
git submodule update
rem =====================================================================================
rem Initial pass to generate FoxPro binaries
rem =====================================================================================
"%vfp9%" Source/CefSharpBrowser/tools/run_gencode.prg
"%vfp9%" Source/Tests/dpi-awareness/tools/run_gencode.prg
rem =====================================================================================
rem Deploy wwDotNetBridge into multiple locations
rem =====================================================================================
call :init-deploy-wwdotnetbridge Source\CefSharpBrowser ..\..
call :init-deploy-wwdotnetbridge Source\Tests\dpi-awareness ..\..\..
rem =====================================================================================
rem Prepare the test environment for the dpi-aware test suite
rem =====================================================================================
rmdir Source\Tests\dpi-awareness\cef-bin-%versionCefSharp%
del Source\Tests\dpi-awareness\Acodey.h
del Source\Tests\dpi-awareness\aco_lde.h
del Source\Tests\dpi-awareness\aco_len.h
del Source\Tests\dpi-awareness\iAcodey.h
del Source\Tests\dpi-awareness\CefSharpBrowser.prg
mklink /d Source\Tests\dpi-awareness\cef-bin-%versionCefSharp% ^
..\..\CefSharpBrowser\cef-bin-%versionCefSharp%
mklink Source\Tests\dpi-awareness\Acodey.h ..\..\CefSharpBrowser\Acodey.h
mklink Source\Tests\dpi-awareness\aco_lde.h ..\..\CefSharpBrowser\aco_lde.h
mklink Source\Tests\dpi-awareness\aco_len.h ..\..\CefSharpBrowser\aco_len.h
mklink Source\Tests\dpi-awareness\iAcodey.h ..\..\CefSharpBrowser\iAcodey.h
mklink Source\Tests\dpi-awareness\CefSharpBrowser.prg ^
..\..\CefSharpBrowser\CefSharpBrowser.prg
goto :eof
rem =====================================================================================
rem Deploy wwDotNetBridge. We use a symbolic link here to always use the same file as
rem we downloaded in the submodule. This requires an NTFS formatted drive (as opposed
rem to a FAT-family type of drive). For network shares you must have the "create symbolic
rem links" permission on the server.
rem =====================================================================================
:init-deploy-wwdotnetbridge
del %~1\ClrHost.dll
del %~1\wwDotNetBridge.dll
del %~1\wwDotNetBridge.prg
mklink %~1\ClrHost.dll ^
%~2\Modules\wwDotNetBridge\Distribution\ClrHost.dll
mklink %~1\wwDotNetBridge.dll ^
%~2\Modules\wwDotNetBridge\Distribution\wwDotNetBridge.dll
mklink %~1\wwDotNetBridge.prg ^
%~2\Modules\wwDotNetBridge\Distribution\wwDotNetBridge.prg
goto :eof
rem =====================================================================================
rem RELEASE
rem
rem Creates a full and a core release for the last built of fpCefSharp. These releases
rem are the ones that are uploaded as a release on GitHub.
rem
rem Release does not include a build process! You must build all required files before
rem creating a release.
rem =====================================================================================
:Release
rem =====================================================================================
rem Prepare Release folder. The Release folder is a transient folder that gets completely
rem wiped out for each build.
rem =====================================================================================
rmdir Release /q /s
rem =====================================================================================
rem Full release
rem =====================================================================================
set release=Release\fpCefSharp.%versionFpCefSharp%
md %release%
call :release-cefsharp %release%
call :release-fpdotnet %release%
call :release-wwdotnetbridge %release%
call :release-fpcefsharp %release%
call :release-demos %release%
call :release-docs %release%
call :release-zip %release%
rem =====================================================================================
rem Core release
rem =====================================================================================
set release=Release\fpCefSharp.%versionFpCefSharp%.core
md %release%
call :release-cefsharp %release%
call :release-fpdotnet %release%
call :release-wwdotnetbridge %release%
call :release-fpcefsharp %release%
call :release-zip %release%
echo Release completed in folder Release
goto :eof
rem =====================================================================================
rem RELEASE - CefSharp
rem
rem Releases CefSharp into the specified release folder
rem =====================================================================================
:release-cefsharp
echo Copying CefSharp
xcopy Source\CefSharpBrowser\cef-bin-%versionCefSharp%\ ^
%~1\cef-bin-%versionCefSharp%\ /yce
for %%f in (%~1\cef-bin-%versionCefSharp%\*.pdb) do (
rem %%~df returns the drive
rem %%~pf returns the path
rem %%~nf returns the file name without extension
call :release-removepdb %%~df%%~pf%%~nf
)
goto :eof
:release-removepdb
echo Deleting %~1.pdb
del %~1.pdb
if exist %~1.xml del %~1.xml
goto :eof
rem =====================================================================================
rem RELEASE - fpDotNet
rem
rem Releases fpDotNet into the specified release folder
rem =====================================================================================
:release-fpdotnet
echo Downloading fpDotNet
md temp
curl --location ^
--ssl-no-revoke ^
--output temp/fpdotnet.zip ^
--url %urlFpDotNet%
md %~1\fpDotNet
tar -xf temp/fpdotnet.zip --directory %~1\fpDotNet
rmdir temp /q /s
goto :eof
rem =====================================================================================
rem RELEASE - wwDotNetBridge
rem
rem Releases wwDotNetBridge into the specified release folder
rem =====================================================================================
:release-wwdotnetbridge
echo Copying wwDotNetBridge
copy Source\CefSharpBrowser\ClrHost.dll %~1
copy Source\CefSharpBrowser\wwDotNetBridge.dll %~1
copy Source\CefSharpBrowser\wwDotNetBridge.prg %~1\
goto :eof
rem =====================================================================================
rem RELEASE - fpCefSharp
rem
rem Releases fpCefSharp into the specified release folder
rem =====================================================================================
:release-fpcefsharp
echo Copying fpCefSharp files
copy Source\CefSharpBrowser\aco_lde.h %~1
copy Source\CefSharpBrowser\aco_len.h %~1
copy Source\CefSharpBrowser\acodey.h %~1\
copy Source\CefSharpBrowser\cefsharpbrowser.prg %~1\
copy Source\CefSharpBrowser\iacodey.h %~1\
goto :eof
rem =====================================================================================
rem RELEASE - Demos
rem
rem Releases Demos into the specified release folder
rem =====================================================================================
:release-demos
echo Coyping demo files
copy Source\CefSharpBrowser\demo_*.prg %~1
copy Source\CefSharpBrowser\showhtml*.scx %~1
copy Source\CefSharpBrowser\showhtml*.sct %~1
goto :eof
rem =====================================================================================
rem RELEASE - Demos
rem
rem Releases Demos into the specified release folder
rem =====================================================================================
:release-docs
echo Coyping documentation
xcopy Source\CefSharpBrowser\Files\ %~1\Files\ /yce
goto :eof
rem =====================================================================================
rem RELEASE - Zip
rem
rem Creates a ZIP file the specified release folder
rem =====================================================================================
:release-zip
echo Building archive %~1.zip
tar -C %~1 -acf %~1.zip *
rmdir %~1 /q /s
goto :eof
rem =====================================================================================
rem Test <test suite>
rem
rem Runs interactive and non-interactive tests
rem =====================================================================================
:Test
if /I "%~2"=="dpi-aware" goto test-dpi-aware
echo Syntax
echo.
echo fox test test_suite
echo.
echo Supported values for test_suite are: dpi-aware
goto :eof
rem =====================================================================================
rem Test dpi-aware
rem
rem Builds and runs various combinations of setting the dpi awareness through API calls
rem and manifests. Runs each EXE that displays a simple browser window. Users need to
rem interactively verify that the result looks OK.
rem =====================================================================================
:test-dpi-aware
setlocal
for %%f in (Source\Tests\dpi-awareness\*_main.prg) DO (
call :test-dpi-aware-build "%%f" "%%~df%%~pf%%~nf"
)
goto :eof
rem =====================================================================================
rem Test dpi-aware
rem
rem Build and run a single test case
rem =====================================================================================
:test-dpi-aware-build
setlocal
"%vfp9%" Source/Tests/dpi-awareness/build.prg "%~1"
set p2=%~2
set exe=%p2:~0,-5%.exe
if exist "%exe%" (
cd Source/Tests/dpi-awareness
%exe%
cd ../../..
) else (
echo Failed to build %exe%
)
goto :eof