-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.bat
682 lines (560 loc) · 26.1 KB
/
build.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
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
@ECHO OFF
REM Use Setlocal in case this program is started from a working command prompt.
REM This safely preserves the parent process's environment and working folder.
setlocal
REM Immediately retrieve the program's entire path
SET "ProgramDirPath=%~dp0"
REM Start the program
GOTO :Main
REM # ================================================================================================
REM # Documentation
REM # Spine of the program; this makes sure that the execution works as intended.
REM # ================================================================================================
:Main
REM Update the terminal window title
TITLE WolfenDoom EZBake Oven: Now with Nazi Cupcakes!
REM Check if Git executable is available on the host
CALL :GitFeature_DependencyCheck
CALL :MainMenu
GOTO :TerminateProcess
REM # ================================================================================================
REM # Documentation
REM # Displays the main menu - which the user selects how the build is compiled into an archive file.
REM # Default Compression = Type: ZIP ; Method: Deflate ; Compression: 5
REM # Best Compression = Type: ZIP ; Method: LZMA ; Compression: 9
REM # No Compression = Type: ZIP ; Method: Deflate ; Compression: 0
REM # ================================================================================================
:MainMenu
REM Thrash the terminal buffer
CLS
REM Display the title on the buffer
CALL :BufferHeader
ECHO Main Menu
ECHO ------------
ECHO.
ECHO Choose how to compile this project:
ECHO ---------------------
ECHO [1] Default Build
ECHO [2] Best Compression
ECHO [3] No Compression
ECHO ---------------------
ECHO.
ECHO Other available options:
ECHO ---------------------
REM ----
REM Special Features
REM Only draw these options if its possible
IF %featuresGit% EQU True (ECHO [U] Update Repository)
REM ----
ECHO [?] Help
ECHO [X] Exit
ECHO ---------------------
ECHO.
REM Capture the user input
CALL :PromptUserInput
REM Inspect the input
GOTO :MainMenu_STDIN
REM # ================================================================================================
REM # Documentation
REM # Inspect the user's input and execute their desired action
REM # ================================================================================================
:MainMenu_STDIN
IF "%STDIN%" EQU "1" (
CALL :CompactProject ZIP DEFLATE 5 NORMAL
GOTO :MainMenu
)
IF "%STDIN%" EQU "2" (
CALL :CompactProject ZIP LZMA 9 NORMAL
GOTO :MainMenu
)
IF "%STDIN%" EQU "3" (
CALL :CompactProject ZIP COPY 0 NORMAL
GOTO :MainMenu
)
IF /I "%STDIN%" EQU "X" (
GOTO :EOF
)
IF /I "%STDIN%" EQU "Help" (
CALL :Help
GOTO :MainMenu
)
IF "%STDIN%" EQU "?" (
CALL :Help
GOTO :MainMenu
)
IF /I "%STDIN%" EQU "U" (
REM Avoid the end-user from selecting a choice that may not be
REM available to them.
REM Try to detect if Git features is NOT available
IF %featuresGit% NEQ True CALL :MainMenu_STDIN_BadInput
REM Try to detect if Git features IS available
IF %featuresGit% EQU True CALL :GitFeature_UpdateBranch
GOTO :MainMenu
) ELSE (
CALL :MainMenu_STDIN_BadInput
GOTO :MainMenu
)
REM # ================================================================================================
REM # Documentation
REM # This function displays a message to the user that the STDIN was illegal and not supported
REM # ================================================================================================
:MainMenu_STDIN_BadInput
ECHO.
ECHO ERROR: INVALID OPTION
ECHO The provided input from the user is not either valid or supported. Please select from the choices provided.
ECHO.
PAUSE
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # This function captures the standard input from the user.
REM # ================================================================================================
:PromptUserInput
SET /P STDIN=^>^>^>^>
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Displays the title of the program.
REM # ================================================================================================
:BufferHeader
ECHO WolfenDoom Compiler
ECHO =====================
ECHO ---------------------
ECHO =====================
ECHO.&ECHO.&ECHO.
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # This function simply displays the help screen; why this program exists and how it works.
REM # ================================================================================================
:Help
REM Thrash the terminal buffer
CLS
REM Display the title on the buffer
CALL :BufferHeader
ECHO Help
ECHO ------------
ECHO.
ECHO This program is a PK3 compiler for the WolfenDoom project. When prompted with compile options such as: Default Build, Best Compression, and No Compression, these provides different forms of compression methods that this program allows. However, compression can also depreciate performance.
ECHO ^* Default Build
ECHO Builds the project with the default compression; what to expect for public builds.
ECHO ^* Best Compression
ECHO Provides the best possible compression, thus tighter filesize but can have an effect with performance when playing the game.
ECHO ^* No Compression
ECHO Builds the project with absolutely no compression; maximizes performance with lack of compression.
ECHO.
ECHO If unsure what to choose, select the default build or option [ 1 ] from the Main Menu.
ECHO For further help is needed, please visit the official ZDoom forum thread:
ECHO http://forum.zdoom.org/viewtopic.php?p=813367#p813367
ECHO.
PAUSE
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # This function well walk through the protocol before and during the compiling process.
REM # Parameters
REM # ArchiveType [String] = %1
REM # Contains the archive file type. For example: zip [PK3] or 7zip [PK7]
REM # ArchiveMethod [String] = %2
REM # Contains the method type of the archive file. For example: DEFLATE, DEFLATE64, PPMD, or LZMA.
REM # CompressionLevel [int] = %3
REM # Upholds the compression level of the archive file. Range is from 0-9
REM # PriorityLevel [String] = %4
REM # Manages how much processing time the task has within the process-ribbon managed by the OS.
REM # ================================================================================================
:CompactProject
CALL :ProcessingInterface 0 "Compiling project"
CALL :CompactProject_CheckResources || EXIT /B 1
CALL :CompactProject_Execute_ProjectName
CALL :CompactProject_Execute %1 %2 %3 %4 || EXIT /B 1
CALL :CompactProject_WindowsExplorer || EXIT /B 1
CALL :ProcessingInterface 1
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Before we compile the project, first make sure that the resources exist - and that there will not be any issues.
REM # NOTE: This function does a clean scan each time this is executed.
REM # ================================================================================================
:CompactProject_CheckResources
REM Check to make sure that the 'Tools' directory exists or is accessible
CALL :CompactProject_CheckResources_ToolsDirExists || (EXIT /B 1)
REM Check to see if the files exists within the project's filesystem.
CALL :CompactProject_CheckResources_FilesExists || (EXIT /B 1)
REM Check the file permission of necessary files
CALL :CompactProject_CheckResources_FilePermissions || (EXIT /B 1)
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Check to see if the required files exists within the filesystem structure of the project.
REM # If one or more files were not found, then abort the entire process and display an error
REM # on the buffer.
REM # Return
REM # EvaluationStatus [bool]
REM # 0 = Everything is okay; everything was located successfully
REM # 1 = Files do not exist within the project's filesystem or not accessible
REM # ================================================================================================
:CompactProject_CheckResources_FilesExists
SET ErrorBool=False
SET "ErrorString="
REM Try to check if the resources could be found; if not - prepare an error message.
IF NOT EXIST "%ProgramDirPath%tools\7za\7za.exe" (
SET ErrorBool=True
SET "ErrorString=%ErrorString%Could Not Find 7Zip!&ECHO."
)
IF NOT EXIST "%ProgramDirPath%tools\7za\7zExcludeListDir.txt" (
SET ErrorBool=True
SET "ErrorString=%ErrorString%Could Not Find Exclude Directory List!&ECHO."
)
IF NOT EXIST "%ProgramDirPath%tools\7za\7zExcludeList.txt" (
SET ErrorBool=True
SET "ErrorString=%ErrorString%Could Not Find Exclude List!&ECHO."
)
IF %ErrorBool% EQU True (
CALL :CompactProject_CheckResources_ErrMSG 1 "%ErrorString%"
EXIT /B 1
)
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Check to make sure that the directories are accessible; we do this by viewing the inside of
REM # the directories which requires the user to have not only the necessary privileges but must
REM # also have the directory available and ready.
REM # Return
REM # EvaluationStatus [bool]
REM # 0 = Everything is okay
REM # 1 = Directory is not accessible
REM # ================================================================================================
:CompactProject_CheckResources_ToolsDirExists
REM Does the directory exists?
IF NOT EXIST "%ProgramDirPath%tools" (
CALL :CompactProject_CheckResources_ErrMSG 0 "Unable to locate the [ {PROJECT_ROOT}\Tools ] directory."
EXIT /B 1
)
REM Is there permission issues?
CALL :CompactProject_CheckResources_CheckPermissions_ToolsDir
IF %ERRORLEVEL% NEQ 0 (
CALL :CompactProject_CheckResources_ErrMSG 0 "Insufficient permissions or no data found in the [ {PROJECT_ROOT}\Tools ] directory."
EXIT /B 1
)
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Check to see if the required files are accessible by checking if the user can access\read\execute
REM # the files.
REM # Notes
REM # Error Code of '5' = Permission conflictions; user must resolve this on their own or contact
REM # their network or IT administrator for assistance.
REM # Return
REM # EvaluationStatus [bool]
REM # 0 = Everything is okay; everything was located successfully
REM # 1 = Files do not exist within the project's filesystem or not accessible
REM # ================================================================================================
:CompactProject_CheckResources_FilePermissions
CALL :CompactProject_CheckResources_7ZipExecutableInternal
IF %ERRORLEVEL% NEQ 0 (
CALL :CompactProject_CheckResources_ErrMSG 2 "Unable to execute [ {PROJECT_ROOT}\Tools\7za\7za.exe ] due to insufficient privileges! [Error Code: %ERRORLEVEL%]"
EXIT /B 1
)
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Test the internal 7Zip program and check for possible errors. This can be helpful to detect
REM # for permission issues or other ambiguous complications.
REM # Return
REM # ExitCode [Int]
REM # Returns the exit code reported by the system or 7Zip.
REM # ================================================================================================
:CompactProject_CheckResources_7ZipExecutableInternal
"%ProgramDirPath%tools\7za\7za.exe" 2> NUL 1> NUL
EXIT /B %ERRORLEVEL%
REM # ================================================================================================
REM # Documentation
REM # Test to see if the {PROJECT_ROOT}\Tools dir. exists on the system and if the user has sufficient
REM # privileges to access the directory.
REM # Return
REM # ExitCode [Int]
REM # Returns the exit code reported by the system or DIR [intCMD].
REM # ================================================================================================
:CompactProject_CheckResources_CheckPermissions_ToolsDir
DIR /B "%ProgramDirPath%tools" 2> NUL 1> NUL
EXIT /B %ERRORLEVEL%
REM # ================================================================================================
REM # Documentation
REM # Display an error that some of the required dependencies that is used during the compiling process
REM # could not be located.
REM # Parameters
REM # ErrorCode [int] = %1
REM # Specify the error code that should be presented on the screen.
REM # 0 = Tools Dir Unaccessible
REM # 1 = Missing Files
REM # 2 = Permission Issue
REM # ErrorMSG [String] = %2
REM # Contains the error message that is to be displayed on the screen.
REM # ================================================================================================
:CompactProject_CheckResources_ErrMSG
REM Figure out what error message to display on the screen
IF %1 EQU 0 CALL :CompactProject_CheckResources_ErrMSG_ToolsDirUnaccessible "%~2"
IF %1 EQU 1 CALL :CompactProject_CheckResources_ErrMSG_MissingFiles "%~2"
IF %1 EQU 2 CALL :CompactProject_CheckResources_ErrMSG_PermissionIssue "%~2"
REM Allow the user to read the message
PAUSE
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Display an error message that some of the resources were not successfully located.
REM # Parameters
REM # ErrorMSG [String] = %1
REM # Contains the error message that is to be displayed on the screen.
REM # ================================================================================================
:CompactProject_CheckResources_ErrMSG_MissingFiles
ECHO.
ECHO CRITICAL ERROR: RESOURCES NOT FOUND!
ECHO %~1
ECHO Program Path: %ProgramDirPath%
ECHO User Path: %CD%
ECHO.
ECHO Please report this error to the WolfenDoom project team!
EXPLORER https://github.com/Realm667/WolfenDoom/issues
ECHO.
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Display an error message that there is permission complications and the user needs to resolve.
REM # Parameters
REM # ErrorMSG [String] = %1
REM # Contains the error message that is to be displayed on the screen.
REM # ================================================================================================
:CompactProject_CheckResources_ErrMSG_PermissionIssue
ECHO.
ECHO CRITICAL ERROR: INSUFFICIENT PERMISSIONS
ECHO %~1
ECHO.
ECHO Please inspect the file permissions or contact your administrator for assistance.
ECHO.
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Display an error message that the {PROJECT_ROOT}\Tools} is not accessible; either the directory
REM # does not exist or there is a permission issue that the user needs to resolve.
REM # Parameters
REM # ErrorMSG [String] = %1
REM # Contains the error message that is to be displayed on the screen.
REM # ================================================================================================
:CompactProject_CheckResources_ErrMSG_ToolsDirUnaccessible
ECHO.
ECHO CRITICAL ERROR: TOOLS DIR. UNACCESSIBLE
ECHO %~1
ECHO.
ECHO Check to make sure that the path exists and that you have enough permissions.
ECHO.
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Before we compile the project, first make sure that the resources exist - and that there will not be any issues.
REM # Priorities:
REM # LOW - BELOWNORMAL - NORMAL - ABOVENORMAL - HIGH - REALTIME [AKA Ludicrous Speed - Spaceballs reference]
REM # Parameters
REM # ArchiveType [String] = %1
REM # Contains the archive file type. For example: zip [PK3] or 7zip [PK7]
REM # ArchiveMethod [String] = %2
REM # Contains the method type of the archive file. For example: DEFLATE, DEFLATE64, PPMD, or LZMA.
REM # CompressionLevel [int] = %3
REM # Upholds the compression level of the archive file. Range is from 0-9
REM # PriorityLevel [String] = %4
REM # Manages how much processing time the task has within the process-ribbon managed by the OS.
REM # Do note that 'Normal' is the default value, and 'RealTime' can cause the system to slow-down in favor
REM # of the program that has the 'RealTime' flag. Meaning, if executed with 'RealTime', the user might
REM # notice that their normal activities will be greatly delayed until the program with 'RealTime' is completed.
REM # ================================================================================================
:CompactProject_Execute
START "WolfenDoom Compile: 7Zip" /B /%4 /WAIT "%ProgramDirPath%tools\7za\7za.exe" a -t%1 -mm=%2 -mx=%3 -x@"%ProgramDirPath%tools\7za\7zExcludeListDir.txt" -xr@"%ProgramDirPath%tools\7za\7zExcludeList.txt" "%ProgramDirPath%..\%projectName%.ipk3" "%ProgramDirPath%*"
REM Because I couldn't use the error-pipes with 'Start', we'll have to check the ExitCode in a conditional statement
IF %ERRORLEVEL% GEQ 1 (
CALL :CompactProject_Execute_ErrMSG %ERRORLEVEL%
EXIT /B 1
) ELSE (
EXIT /B 0
)
REM # ================================================================================================
REM # Documentation
REM # Determine what project filename to use.
REM # IIF Git features are enabled, then attach the commit hash to
REM # the filename.
REM # Else use the generic file name without a hash.
REM # ================================================================================================
:CompactProject_Execute_ProjectName
REM If git features is not available, then just use the generic name.
REM No hash will be used.
IF %featuresGit% NEQ True (
REM Avoid redundancy
IF "%projectName%" NEQ "boa" SET "projectName=boa"
GOTO :EOF
)
REM Assume Git features are available for us to utilize
REM Attach the hash to the file name.
CALL :GitFeature_FetchCommitHash
REM Avoid redundancy
IF "%projectName%" NEQ "boa-%GitCommitHash%" SET "projectName=boa-%GitCommitHash%"
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # If 7Zip returned an error, let the user know that the process was terminated prematurely or failed.
REM # Parameters
REM # ExitCode [Int] = %1
REM # Holds the value of the ExitCode from 7Zip
REM # ================================================================================================
:CompactProject_Execute_ErrMSG
ECHO.
ECHO CRITICAL ERROR: 7ZIP FAILED!
ECHO 7Zip was unable to complete the operation and closed with an Exit Code: %1.
ECHO.
ECHO Tips:
ECHO * Make sure you have enough permission to run applications.
ECHO * Make sure that the system has enough memory to perform the operation.
ECHO * Make sure that the files are not locked by other applications.
ECHO * Examine any warning messages provided and try to address them as much as possible.
ECHO.
ECHO If this issue reoccurs please let us know.
PAUSE
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Create a new window and highlight the newly created build.
REM # ================================================================================================
:CompactProject_WindowsExplorer
EXPLORER /select,"%ProgramDirPath%..\%projectName%.ipk3"
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Provide a simple interface for incoming operations.
REM # The borders in between the actual update is only for readability
REM # to the users.
REM # Parameters
REM # InterfaceHeadOrTail [Int] = %1
REM # Displays either the header or footer on the screen
REM # when processing a task.
REM # 0 = Header
REM # 1 = Footer
REM # TaskString [String] = %2
REM # Displays the message on the screen of the main operation.
REM # ================================================================================================
:ProcessingInterface
IF %1 EQU 0 (
CLS
CALL :BufferHeader
ECHO %~2. . .
ECHO -------------------------------------
) ELSE (
ECHO -------------------------------------
PAUSE
)
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # Check to see if we can be able to utilize Git features within this program.
REM # ================================================================================================
:GitFeature_DependencyCheck
CALL :GitFeature_DependencyCheck_GitExecutable
IF %ERRORLEVEL% EQU 1 (
REM Could not detect the git executable
SET featuresGit=False
GOTO :EOF
)
CALL :GitFeature_DependencyCheck_RepoGitDB
IF %ERRORLEVEL% EQU 1 (
REM Could not find the .git directory
SET featuresGit=False
GOTO :EOF
)
REM Safe to use git features; found the .git directory and the git executable.
SET featuresGit=True
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Check to see if the git executable exists within the host system.
REM # To do this, we merely check if 'git' was detected during an
REM # invoktion test - which requires 'git' to be in %PATH% within the
REM # environment - if git was _NOT_ detected then we can't use git
REM # features, but we can use the features if it was detected.
REM #
REM # Cautionaries:
REM # If git.exe is in the console's environment but failed the
REM # detection phase, the permissions may need to be checked
REM # as well as the network if routing via UNC - I doubt CMD allows
REM # UNC anyways.
REM # IIF %ERRORLEVEL% EQU 9009, then git is not available in the
REM # environment.
REM # IIF %ERRORLEVEL% EQU 1, git was invoked and it successfully
REM # executed by outputting the main menu to NULL.
REM # IIF any other exit code, see documentation for the proper
REM # termination fault.
REM #
REM # Return
REM # ReturnCode [Bool]
REM # 0 = Git executable detected.
REM # 1 = Git executable not detected.
REM # ================================================================================================
:GitFeature_DependencyCheck_GitExecutable
GIT 2> NUL 1> NUL
IF %ERRORLEVEL% EQU 1 (
REM Found the git executable
EXIT /B 0
)
REM Could not find the git executable
EXIT /B 1
REM # ================================================================================================
REM # Documentation
REM # When the end-user has the source code, it may or may not contain the .git DB directory.
REM # This function is designed to check wither or not the directory exists within the source code.
REM #
REM # Return
REM # ReturnCode [Bool]
REM # 0 = .git directory found.
REM # 1 = .git directory not found.
REM # ================================================================================================
:GitFeature_DependencyCheck_RepoGitDB
REM Silently perform a check to see if the source contains the .git directory
GIT --git-dir="%ProgramDirPath%.git" status 2> NUL 1> NUL
IF %ERRORLEVEL% EQU 0 (
REM .git directory was successfully found
EXIT /B 0
)
REM Could not find the .git directory within the source.
EXIT /B 1
REM # ================================================================================================
REM # Documentation
REM # Retrieves and returns the HEAD commit hash of the project.
REM # Sets the value of the commit hash to the variable 'GitCommitHash'.
REM # To use this hash in other functions, first call this function and then use the variable
REM # %GitCommitHash% in any function. However, first make sure that the Git dependency is
REM # available on the host.
REM # ================================================================================================
:GitFeature_FetchCommitHash
FOR /F %%a IN ('GIT --git-dir="%ProgramDirPath%.git" rev-parse --short HEAD') DO SET GitCommitHash=%%a
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Provide a simple interface and automatically update repository.
REM # ================================================================================================
:GitFeature_UpdateBranch
CALL :ProcessingInterface 0 "Updating project repository"
CALL :GitFeature_UpdateBranch_Master
CALL :ProcessingInterface 1
EXIT /B 0
REM # ================================================================================================
REM # Documentation
REM # When called, this function will update the master branch of the GIT local repo. However, first make sure that the Git dependency is
REM # available on the host.
REM # ================================================================================================
:GitFeature_UpdateBranch_Master
GIT --git-dir="%ProgramDirPath%.git" pull origin master
GOTO :EOF
REM # ================================================================================================
REM # Documentation
REM # Terminate the program without destroying the console process if invoked via CUI.
REM # ================================================================================================
:TerminateProcess
ECHO Closing program. . .
REM Restore the terminal window's title to something generic
TITLE Command Prompt
EXIT /B 0