forked from ortclib/zzz-obsolete.ortclib-scripts
/
prepareWebRtc.bat
664 lines (527 loc) · 20 KB
/
prepareWebRtc.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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
:: Name: prepareWebRtc.bat
:: Purpose: Prepare webrtc to be buildable
:: Author: Sergej Jovanovic
:: Email: sergej@gnedo.com
:: Revision: September 2016 - initial version
@ECHO off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set powershell_path=%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe
set taskFailed=0
::platforms
SET platform_ARM=0
SET platform_x86=0
SET platform_x64=0
SET platform_win32=0
SET platform_win32_x64=0
::platforms
SET platform_ARM_prepared=0
SET platform_x86_prepared=0
SET platform_x64_prepared=0
SET platform_win32_prepared=0
::log variables
SET globalLogLevel=2
SET error=0
SET info=1
SET warning=2
SET debug=3
SET trace=4
::input arguments
SET supportedInputArguments=;platform;help;logLevel;diagnostic;
SET platform=all
SET help=0
SET logLevel=2
SET diagnostic=0
::predefined messages
SET folderStructureError="WebRTC invalid folder structure."
SET errorMessageInvalidArgument="Invalid input argument. For the list of available arguments and usage examples, please run script with -help option."
SET errorMessageInvalidPlatform="Invalid platform name. For the list of available targets and usage examples, please run script with -help option."
SET errorMessageMissingDebuggerTools="Windows SDK is not fully installed. Debugger Tools are missing. Please install standalone Windows SDK version. You can download installer from this link https://developer.microsoft.com/de-de/windows/downloads/sdk-archive"
::path constants
SET baseWebRTCPath=webrtc\xplatform\webrtc
SET webRtcLibsTemplatePath=webrtc\windows\templates\libs\webrtc
SET webRtcx64TemplatePath=webrtc\windows\templates\libs\webrtc\WebRtc.x64.sln
SET webRtcx86TemplatePath=webrtc\windows\templates\libs\webrtc\WebRtc.x86.sln
rem SET webRTCDestinationPath=webrtc\xplatform\webrtc\webrtcLib.sln
SET webRTCGnArgsTemplatePath=..\..\..\webrtc\windows\templates\gns\args.gn
SET stringToUpdateWithSDKVersion='WindowsTargetPlatformVersion', '10.0.10240.0'
SET pythonFilePathToUpdateSDKVersion=webrtc\xplatform\webrtc\tools\gyp\pylib\gyp\generator\msvs.py
ECHO.
CALL:print %info% "Running WebRTC prepare script ..."
CALL:print %info% "================================="
::ECHO.
:parseInputArguments
IF "%1"=="" (
IF NOT "%nome%"=="" (
SET "%nome%=1"
SET nome=""
) ELSE (
GOTO:main
)
)
SET aux=%1
IF "%aux:~0,1%"=="-" (
IF NOT "%nome%"=="" (
SET "%nome%=1"
)
SET nome=%aux:~1,250%
SET validArgument=0
CALL:checkIfArgumentIsValid !nome! validArgument
IF !validArgument!==0 CALL:error 1 %errorMessageInvalidArgument%
) ELSE (
IF NOT "%nome%"=="" (
SET "%nome%=%1"
) else (
CALL:error 1 %errorMessageInvalidArgument%
)
SET nome=
)
SHIFT
GOTO parseInputArguments
::===========================================================================
:: Start execution of main flow (if parsing input parameters passed without issues)
:main
CALL:identifyPlatform
CALL:prepareWebRTC
GOTO:EOF
::===========================================================================
REM check if entered valid input argument
:checkIfArgumentIsValid
IF "!supportedInputArguments:;%~1;=!" neq "%supportedInputArguments%" (
::it is valid
SET %2=1
) ELSE (
::it is not valid
SET %2=0
)
GOTO:EOF
REM Based on input arguments determine targeted platforms (x64, x86 or ARM)
:identifyPlatform
SET validInput=0
SET messageText=
IF /I "%platform%"=="all" (
SET platform_ARM=0
SET platform_x64=1
SET platform_x86=1
SET platform_win32=1
SET platform_win32_x64=1
SET validInput=1
SET messageText=Preparing WebRTC development environment for arm, x64, x86 and win32 platforms ...
) ELSE (
IF /I "%platform%"=="arm" (
SET platform_ARM=1
SET validInput=1
)
IF /I "%platform%"=="x64" (
SET platform_x64=1
SET validInput=1
)
IF /I "%platform%"=="x86" (
SET platform_x86=1
SET validInput=1
)
IF /I "%platform%"=="win32" (
SET platform_win32=1
SET validInput=1
)
IF /I "%platform%"=="win32_x64" (
SET platform_win32_x64=1
SET validInput=1
)
IF !validInput!==1 (
SET messageText=Preparing WebRTC development environment for %platform% platform ...
)
)
:: If input is not valid terminate script execution
IF !validInput!==1 (
CALL:print %warning% "!messageText!"
) ELSE (
CALL:error 1 %errorMessageInvalidPlatform%
)
GOTO:EOF
:prepareWebRTC
CALL:print %trace% "Executing prepareWebRTC function"
IF NOT EXIST %baseWebRTCPath% CALL:error 1 "%folderStructureError:"=% %baseWebRTCPath% does not exist!"
PUSHD %baseWebRTCPath% > NUL
CALL:print %trace% "Pushed %baseWebRTCPath% path"
CALL:generateChromiumFolders
CALL:makeJunctionLinks
CALL:updateFolders
IF %platform_win32_x64% EQU 1 (
CALL:updateClang
)
CALL:setupDepotTools
CALL:downloadGnBinaries
::POPD
::CALL:updateSDKVersion
::PUSHD %baseWebRTCPath% > NUL
::CALL:gflagsPatchBuild
CALL:generateProjects
POPD
CALL:print %trace% "Popped %baseWebRTCPath% path"
rem CALL:copyTemplates %webRTCTemplatePath% %webRTCDestinationPath%
CALL:done
GOTO:EOF
:generateChromiumFolders
CALL:print %trace% "Executing generateChromiumFolders function"
CALL:makeDirectory chromium\src
CALL:makeDirectory chromium\src\tools
CALL:makeDirectory chromium\src\third_party
CALL:makeDirectory chromium\src\third_party\winsdk_samples
CALL:makeDirectory chromium\src\third_party\libjingle\source\talk\media\testdata\
CALL:makeDirectory third_party
::CALL:makeDirectory third_party\gflags
::CALL:makeDirectory third_party\winsdk_samples
CALL:makeDirectory tools
GOTO:EOF
:makeJunctionLinks
CALL:print %trace% "Executing makeJunctionLinks function"
CALL:makeLink . buildtools ..\buildtools
CALL:makeLink . build ..\chromium\build
CALL:makeLink . chromium\src\third_party\jsoncpp ..\chromium\third_party\jsoncpp
CALL:makeLink . chromium\src\third_party\jsoncpp\source ..\jsoncpp
CALL:makeLink . chromium\src\tools\protoc_wrapper ..\chromium\tools\protoc_wrapper
CALL:makeLink . chromium\src\third_party\protobuf ..\chromium\third_party\protobuf
CALL:makeLink . chromium\src\third_party\yasm ..\chromium\third_party\yasm
CALL:makeLink . chromium\src\third_party\opus ..\chromium\third_party\opus
CALL:makeLink . chromium\src\third_party\boringssl ..\chromium\third_party\boringssl
CALL:makeLink . chromium\src\third_party\usrsctp ..\chromium\third_party\usrsctp
CALL:makeLink . chromium\src\third_party\libvpx ..\chromium\third_party\libvpx
CALL:makeLink . chromium\src\third_party\libvpx\source\libvpx ..\libvpx
CALL:makeLink . chromium\src\testing ..\chromium\testing
CALL:makeLink . testing chromium\src\testing
CALL:makeLink . tools\protoc_wrapper chromium\src\tools\protoc_wrapper
CALL:makeLink . third_party\yasm chromium\src\third_party\yasm
CALL:makeLink . third_party\yasm\binaries ..\yasm\binaries
CALL:makeLink . third_party\yasm\source\patched-yasm ..\yasm\patched-yasm
CALL:makeLink . third_party\opus chromium\src\third_party\opus
CALL:makeLink . third_party\opus\src ..\opus
CALL:makeLink . third_party\boringssl chromium\src\third_party\boringssl
CALL:makeLink . third_party\boringssl\src ..\boringssl
CALL:makeLink . third_party\usrsctp chromium\src\third_party\usrsctp
CALL:makeLink . third_party\usrsctp\usrsctplib ..\usrsctp
CALL:makeLink . third_party\protobuf chromium\src\third_party\protobuf
CALL:makeLink . chromium\src\third_party\expat ..\chromium\third_party\expat
CALL:makeLink . third_party\expat chromium\src\third_party\expat
CALL:makeLink . chromium\src\third_party\googletest ..\chromium\third_party\googletest
CALL:makeLink . third_party\googletest chromium\src\third_party\googletest
CALL:makeLink . third_party\googletest\src ..\googletest
CALL:makeLink . third_party\libsrtp ..\libsrtp
CALL:makeLink . third_party\libvpx .\chromium\src\third_party\libvpx
CALL:makeLink . third_party\libyuv ..\libyuv
CALL:makeLink . third_party\openmax_dl ..\openmax
CALL:makeLink . third_party\libjpeg_turbo ..\libjpeg_turbo
CALL:makeLink . third_party\jsoncpp chromium\src\third_party\jsoncpp
CALL:makeLink . third_party\winuwp_compat ..\..\windows\third_party\winuwp_compat
CALL:makeLink . third_party\winuwp_h264 ..\..\windows\third_party\winuwp_h264
CALL:makeLink . third_party\gflags ..\gflags-build
CALL:makeLink . third_party\gflags\src ..\gflags
CALL:makeLink . third_party\winsdk_samples ..\winsdk_samples_v71
CALL:makeLink . tools\gyp ..\gyp
CALL:makeLink . tools\clang ..\chromium\tools\clang
GOTO:EOF
:updateFolders
::XCopy /S /I /Y ..\gflags-build third_party\gflags > NUL
::IF !errorlevel! NEQ 0 CALL:error 1 "Missing gn files for gflags"
COPY ..\chromium\third_party\BUILD.gn third_party\BUILD.gn
COPY ..\chromium\third_party\DEPS third_party\DEPS
COPY ..\chromium\third_party\OWNERS third_party\OWNERS
COPY ..\chromium\third_party\PRESUBMIT.py third_party\PRESUBMIT.py
GOTO:EOF
:setupDepotTools
PUSHD ..\depot_tools > NUL
set DepotToolsPath=%cd%
POPD > NUL
set CHECKSEMIPATH=%path:~-1%
WHERE gn.bat > NUL 2>&1
IF !ERRORLEVEL! EQU 1 (
IF "%CHECKSEMIPATH%"==";" (
set "PATH=%PATH%%DepotToolsPath%"
) ELSE (
set "PATH=%PATH%;%DepotToolsPath%"
)
)
GOTO:EOF
:downloadGnBinaries
IF NOT EXIST gn.exe CALL python %DepotToolsPath%\download_from_google_storage.py -b chromium-gn -s buildtools\win\gn.exe.sha1
IF !errorlevel! NEQ 0 CALL:error 1 "Failed downloading gn.exe"
IF NOT EXIST clang-format.exe CALL python %DepotToolsPath%\download_from_google_storage.py -b chromium-clang-format -s buildtools\win\clang-format.exe.sha1
IF !errorlevel! NEQ 0 CALL:error 1 "Failed downloading clang-format.exe"
GOTO:EOF
:gflagsPatchBuild
echo PATCHING GFLAGS...
set gflagsWindowsFolder=..\..\windows\third_party\winuwp_compat\gflags
set gflagsIgnore=.gitignore
set gflagsPatchFileName=patch_892576179b45861b53e04a112996a738309cf364.diff
set gflagsPatchFileNameApplied=%gflagsPatchFileName%.applied
IF NOT EXIST third_party\gflags\%gflagsIgnore% COPY %gflagsWindowsFolder%\%gflagsIgnore% third_party\gflags
IF NOT EXIST third_party\gflags\%gflagsPatchFileName% COPY %gflagsWindowsFolder%\%gflagsPatchFileName% third_party\gflags
IF NOT EXIST ..\gflags-build\%gflagsPatchFileNameApplied% (
PUSHD ..\gflags-build > NUL
git apply %gflagsPatchFileName%
IF !ERRORLEVEL! NEQ 0 (
set FailureGitApply=1
)
POPD > NUL
IF !FailureGitApply! EQU 1 (
CALL:error 1 "Could not generate apply patch to webrtc\third_party\gflags using %gflagsWindowsFolder%\%gflagsPatchFileName%"
)
)
IF NOT EXIST third_party\gflags\%gflagsPatchFileNameApplied% COPY %gflagsWindowsFolder%\%gflagsPatchFileName% third_party\gflags\%gflagsPatchFileNameApplied%
GOTO:EOF
:generateProjectsForPlatform
set IsDebugTarget=true
IF "%~3"=="release" (
set IsDebugTarget=false
)
IF "%~3"=="debug" (
set IsDebugTarget=true
)
SET outputPath=out\%~1_%~2_%~3
SET webRTCGnArgsDestinationPath=!outputPath!\args.gn
CALL:makeDirectory !outputPath!
CALL:copyTemplates %webRTCGnArgsTemplatePath% !webRTCGnArgsDestinationPath!
%powershell_path% -ExecutionPolicy ByPass -File ..\..\..\bin\TextReplaceInFile.ps1 !webRTCGnArgsDestinationPath! "-target_os-" "%~1" !webRTCGnArgsDestinationPath!
IF ERRORLEVEL 1 CALL:error 1 "Failed updating gn arguments for platfrom %~1"
%powershell_path% -ExecutionPolicy ByPass -File ..\..\..\bin\TextReplaceInFile.ps1 !webRTCGnArgsDestinationPath! "-target_cpu-" "%2" !webRTCGnArgsDestinationPath!
IF ERRORLEVEL 1 CALL:error 1 "Failed updating gn arguments for CPU %~2"
%powershell_path% -ExecutionPolicy ByPass -File ..\..\..\bin\TextReplaceInFile.ps1 !webRTCGnArgsDestinationPath! "-is_debug-" "%IsDebugTarget%" !webRTCGnArgsDestinationPath!
IF ERRORLEVEL 1 CALL:error 1 "Failed updating gn arguments for debug/release %IsDebugTarget%"
IF %logLevel% GEQ %trace% (
CALL GN gen !outputPath! --ide="vs2017"
) ELSE (
CALL GN gen !outputPath! --ide="vs2017" >NUL
)
IF !errorlevel! NEQ 0 CALL:error 1 "Could not generate WebRTC projects for %1 platform, %2 CPU"
%powershell_path% -ExecutionPolicy ByPass -File ..\..\..\bin\RecurseReplaceInFiles.ps1 !outputPath! *.vcxproj "call ninja.exe" "call %DepotToolsPath%\ninja.exe"
IF EXIST ..\..\..\%webRtcLibsTemplatePath%\WebRtc.%~2.sln CALL:copyTemplates ..\..\..\%webRtcLibsTemplatePath%\WebRtc.%~2.sln !outputPath!\WebRtc.sln
GOTO:EOF
:generateProjects
CALL:print %trace% "Executing generateProjects function"
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
IF %platform_ARM% EQU 1 (
CALL:print %warning% "Generating WebRTC projects for arm platform ..."
SET platform_ARM_prepared=1
CALL:generateProjectsForPlatform winuwp_10 arm debug
CALL:generateProjectsForPlatform winuwp_10 arm release
SET platform_ARM_prepared=2
)
IF %platform_x64% EQU 1 (
CALL:print %warning% "Generating WebRTC projects for x64 platform ..."
SET platform_x64_prepared=1
CALL:generateProjectsForPlatform winuwp_10 x64 debug
CALL:generateProjectsForPlatform winuwp_10 x64 release
SET platform_x64_prepared=2
)
IF %platform_x86% EQU 1 (
CALL:print %warning% "Generating WebRTC projects for x86 platform ..."
SET platform_x86_prepared=1
CALL:generateProjectsForPlatform winuwp_10 x86 debug
CALL:generateProjectsForPlatform winuwp_10 x86 release
SET platform_x86_prepared=2
)
IF %platform_win32% EQU 1 (
CALL:print %warning% "Generating WebRTC projects for win32 platform ..."
SET platform_win32_prepared=1
CALL:generateProjectsForPlatform win x86 debug
CALL:generateProjectsForPlatform win x86 release
SET platform_win32_prepared=2
)
IF %platform_win32_x64% EQU 1 (
CALL:print %warning% "Generating WebRTC projects for win32 x64 platform ..."
SET platform_win32_prepared=1
CALL:generateProjectsForPlatform win x64 debug
CALL:generateProjectsForPlatform win x64 release
SET platform_win32_prepared=2
)
GOTO:EOF
:makeDirectory
IF NOT EXIST %~1\NUL (
MKDIR %~1
CALL:print %trace% "Created folder %~1"
) ELSE (
CALL:print %trace% "%~1 folder already exists"
)
GOTO:EOF
:updateClang
CALL:print %trace% "Running clang update ..."
IF EXIST third_party\llvm-build\Release+Asserts\bin\clang-cl.exe GOTO:clangalreadyexists
:: TODO Need to find workaround solution for pop-up window "Git Credential Manager for Windows". In the meanwhile, just click "Cancel" button in case pop-up window appears.
CALL:print %warning% "In case pop-up window 'Git Credential Manager for Windows' appears after clang download, just click 'Cancel' button."
CALL python tools\clang\scripts\update.py %*
CALL:makeDirectory third_party\llvm
CALL:makeLink . third_party\llvm chromium\src\third_party\llvm
CALL:makeLink . third_party\llvm-build chromium\src\third_party\llvm-build
:clangalreadyexists
CALL:print %trace% "Clang already exists, skipping clang update..."
GOTO:EOF
:makeLink
IF NOT EXIST %~1\NUL CALL:error 1 "%folderStructureError:"=% %~1 does not exist!"
PUSHD %~1
IF EXIST .\%~2\NUL GOTO:alreadyexists
IF NOT EXIST %~3\NUL CALL:error 1 "%folderStructureError:"=% %~3 does not exist!"
CALL:print %trace% In path "%~1" creating symbolic link for "%~2" to "%~3"
IF %logLevel% GEQ %trace% (
MKLINK /J %~2 %~3
) ELSE (
MKLINK /J %~2 %~3 >NUL
)
IF %ERRORLEVEL% NEQ 0 CALL:ERROR 1 "COULD NOT CREATE SYMBOLIC LINK TO %~2 FROM %~3"
:alreadyexists
CALL:print %trace% "Path "%~2" already exists"
POPD
GOTO:EOF
:determineWindowsSDK
SET windowsSDKPath="Program Files (x86)\Windows Kits\10\Lib\"
SET windowsSDKFullPath=C:\!windowsSDKPath!
IF DEFINED USE_WIN_SDK_FULL_PATH SET windowsSDKFullPath=!USE_WIN_SDK_FULL_PATH! && GOTO parseSDKPath
IF DEFINED USE_WIN_SDK SET windowsSDKVersion=!USE_WIN_SDK! && GOTO setVersion
FOR %%p IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
IF EXIST %%p:\!windowsSDKPath! (
SET windowsSDKFullPath=%%p:\!windowsSDKPath!
GOTO determineVersion
)
)
:parseSDKPath
IF EXIST !windowsSDKFullPath! (
FOR %%A IN ("!windowsSDKFullPath!") DO (
SET windowsSDKVersion=%%~nxA
)
) ELSE (
CALL:ERROR 1 "Invalid Windows SDK path"
)
GOTO setVersion
:determineVersion
IF EXIST !windowsSDKFullPath! (
PUSHD !windowsSDKFullPath!
FOR /F "delims=" %%a in ('dir /ad /b /on') do (
IF NOT %%a==10.0.15063.0 SET windowsSDKVersion=%%a
)
POPD
) ELSE (
CALL:ERROR 1 "Invalid Windows SDK path"
)
:setVersion
IF NOT "!windowsSDKVersion!"=="" (
FOR /f "tokens=1-3 delims=[.] " %%i IN ("!windowsSDKVersion!") DO (SET v=%%i.%%j.%%k)
) ELSE (
CALL:ERROR 1 "Supported Windows SDK is not present. Latest supported Win SDK is 10.0.14393.0"
)
IF NOT EXIST !windowsSDKFullPath!..\Debuggers\x64\cdb.exe CALL:ERROR 1 %errorMessageMissingDebuggerTools%
IF NOT EXIST !windowsSDKFullPath!..\Debuggers\x86\cdb.exe CALL:ERROR 1 %errorMessageMissingDebuggerTools%
GOTO:EOF
:makeFileLink
IF NOT EXIST %~1 CALL:error 1 "%folderStructureError:"=% %~1 does not exist!"
echo %cd%
PUSHD %~1
IF EXIST .\%~2 GOTO:alreadyexists
IF NOT EXIST %~3 CALL:error 1 "%folderStructureError:"=% %~3 does not exist!"
IF %logLevel% GEQ %trace% (
MKLINK /J %~2 %~3
) ELSE (
MKLINK /J %~2 %~3 >NUL
)
CALL:print %trace% In path "%~1" creating symbolic link for "%~2" to "%~3"
IF %ERRORLEVEL% NEQ 0 CALL:ERROR 1 "COULD NOT CREATE SYMBOLIC LINK TO %~2 FROM %~3"
:alreadyexists
POPD
GOTO:EOF
:updateSDKVersion
CALL:determineWindowsSDK
IF NOT "!v!"=="" (
CALL:print %warning% "!v! SDK version will be used"
SET SDKVersionString=%stringToUpdateWithSDKVersion:10.0.10240=!v!%
%powershell_path% -ExecutionPolicy ByPass -File bin\TextReplaceInFile.ps1 %pythonFilePathToUpdateSDKVersion% "%stringToUpdateWithSDKVersion%" "!SDKVersionString!" %pythonFilePathToUpdateSDKVersion%
IF ERRORLEVEL 1 CALL:error 0 "Failed to set newer SDK version"
)
GOTO:EOF
:resetSDKVersion
IF NOT "!SDKVersionString!"=="" (
%powershell_path% -ExecutionPolicy ByPass -File bin\TextReplaceInFile.ps1 %pythonFilePathToUpdateSDKVersion% "!SDKVersionString!" "%stringToUpdateWithSDKVersion%" %pythonFilePathToUpdateSDKVersion%
IF ERRORLEVEL 1 CALL:error 0 "Failed to reset newer SDK version"
)
GOTO:EOF
:summary
SET logLevel=%trace%
CALL:print %trace% "======= WebRTC prepare script summary ======="
CALL:print %trace% "======= platform ========= result ======="
IF %platform_ARM_prepared% EQU 2 (
CALL:print %info% " arm prepared"
) ELSE (
IF %platform_ARM_prepared% EQU 1 (
CALL:print %error% " arm failed"
) ELSE (
CALL:print %warning% " arm not run"
)
)
IF %platform_x64_prepared% EQU 2 (
CALL:print %info% " x64 prepared"
) ELSE (
IF %platform_x64_prepared% EQU 1 (
CALL:print %error% " x64 failed"
) ELSE (
CALL:print %warning% " x64 not run"
)
)
IF %platform_x86_prepared% EQU 2 (
CALL:print %info% " x86 prepared"
) ELSE (
IF %platform_x86_prepared% EQU 1 (
CALL:print %error% " x86 failed"
) ELSE (
CALL:print %warning% " x86 not run"
)
)
IF %platform_win32_prepared% EQU 2 (
CALL:print %info% " win32 prepared"
) ELSE (
IF %platform_win32_prepared% EQU 1 (
CALL:print %error% " win32 failed"
) ELSE (
CALL:print %warning% " win32 not run"
)
)
CALL:print %trace% "================================================="
ECHO.
GOTO:EOF
REM Copy all ORTC template required to set developer environment
:copyTemplates
IF NOT EXIST %~1 CALL:error 1 "%folderStructureError:"=% %~1 does not exist!"
COPY %~1 %~2 >NUL
CALL:print %trace% Copied file %~1 to %~2
IF %ERRORLEVEL% NEQ 0 CALL:error 1 "%folderStructureError:"=% Unable to copy WebRTC template solution file"
GOTO:EOF
:print
SET logType=%1
SET logMessage=%~2
if %logLevel% GEQ %logType% (
if %logType%==0 ECHO [91m%logMessage%[0m
if %logType%==1 ECHO [92m%logMessage%[0m
if %logType%==2 ECHO [93m%logMessage%[0m
if %logType%==3 ECHO [95m%logMessage%[0m
if %logType%==4 ECHO %logMessage%
)
GOTO:EOF
:error
SET criticalError=%~1
SET errorMessage=%~2
IF %criticalError%==0 (
ECHO.
CALL:print %warning% "WARNING: %errorMessage%"
ECHO.
) ELSE (
ECHO.
CALL:print %error% "CRITICAL ERROR: %errorMessage%"
ECHO.
CALL:print %error% "FAILURE:Preparing WebRTC development environment has failed. "
POPD
CALL:resetSDKVersion
CALL:summary
::terminate batch execution
CALL bin\batchTerminator.bat
)
GOTO:EOF
:done
ECHO.
CALL:print %info% "Success: WebRTC development environment is prepared."
CALL:resetSDKVersion
CALL:summary