-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathgenerate4.cmd
More file actions
150 lines (125 loc) · 3.68 KB
/
generate4.cmd
File metadata and controls
150 lines (125 loc) · 3.68 KB
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
@echo off
setlocal EnableDelayedExpansion
setlocal EnableExtensions
REM ###########################################################################
REM Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
REM
REM Generate libbitcoin-build artifacts from XML + GSL.
REM
REM This executes the iMatix GSL code generator.
REM See https://github.com/imatix/gsl for details.
REM
REM Direct GSL download https://www.nuget.org/api/v2/package/gsl/4.1.0.1
REM Extract gsl.exe from package using NuGet's File > Export
REM ###########################################################################
REM Do everything relative to this file location.
set "PATH_INITIAL=!CD!"
pushd %~dp0
set "PATH_FILE=!CD!"
set "GSL_EXE=gsl -q"
REM Clean directories for generated build artifacts.
rmdir /s /q "output" 2>NUL
call :msg "Current directory: !CD!"
if not exist "!CD!\generate4.xml" (
call :msg_error "Error: 'generate4.xml' not found in '!CD!'."
exit /b 1
) else (
call :msg_success "File 'generate4.xml' appears in '!CD!'."
)
call :msg_heading "Begin Execution context"
call :msg "PATH_INITIAL : !PATH_INITIAL!"
call :msg "PATH_FILE : !PATH_FILE!"
call :msg "GSL_EXE : !GSL_EXE!"
call :msg "GITHUB_PATH : !GITHUB_PATH!"
call :msg_heading "End Execution context"
!GSL_EXE! -q -script:"!CD!\gsl.copy_properties.cmd" "!CD!\generate4.xml"
if %ERRORLEVEL% neq 0 (
call :msg_error "GSL execution failure."
exit /b 1
)
!GSL_EXE! -q -script:"!CD!\gsl.generate_artifacts.cmd" "!CD!\generate4.xml"
if %ERRORLEVEL% neq 0 (
call :msg_error "GSL execution failure."
exit /b 1
)
if not exist "!CD!\copy_properties.cmd" (
call :msg_error "Error: 'copy_properties.cmd' not found in '!CD!'."
exit /b 1
)
call :msg "Execute copy_properties.cmd..."
call "!CD!\copy_properties.cmd"
if %ERRORLEVEL% neq 0 (
call :msg_error "Failure calling 'copy_properties.cmd'."
exit /b 1
)
if not exist "!CD!\generate_artifacts.cmd" (
call :msg_error "Error: 'generate_artifacts.cmd' not found in '!CD!'."
exit /b 1
)
call :msg "Execute generate_artifacts.cmd..."
call "!CD!\generate_artifacts.cmd"
if %ERRORLEVEL% neq 0 (
call :msg_error "Failure calling 'generate_artifacts.cmd'."
exit /b 1
)
if not exist "!CD!\generate.cmd" (
call :msg_error "Error: 'generate.cmd' not found in '!CD!'."
exit /b 1
)
if not exist "!CD!\version4.xml" (
call :msg_error "Error: 'version4.xml' not found in '!CD!'."
exit /b 1
)
call :msg "Execute generate.cmd..."
call "!CD!\generate.cmd" "!CD!\version4.xml" %*
if %ERRORLEVEL% neq 0 (
call :msg_error "Failure calling 'generate.cmd'."
exit /b 1
)
if not exist "!CD!\copy_projects.cmd" (
call :msg_error "Error: 'copy_projects.cmd' not found in '!CD!'."
exit /b 1
)
call :msg "Execute copy_projects.cmd..."
call "!CD!\copy_projects.cmd" %*
if %ERRORLEVEL% neq 0 (
call :msg_error "Failure calling 'copy_projects.cmd'."
exit /b 1
)
REM Restore directory.
popd
call :msg_success "Script execution completed successfully."
REM Delay for manual confirmation.
if not defined CI (
pause
)
exit /b 0
:msg_heading
call :msg "***************************************************************************"
call :msg "%~1"
call :msg "***************************************************************************"
exit /b %ERRORLEVEL%
:msg
if "%~1" == "" (
echo.
) else (
echo %~1
)
exit /b %ERRORLEVEL%
:msg_empty
echo.
exit /b %ERRORLEVEL%
:msg_verbose
if "!DISPLAY_VERBOSE!" == "yes" (
echo [96m%~1[0m
)
exit /b %ERRORLEVEL%
:msg_success
echo [92m%~1[0m
exit /b %ERRORLEVEL%
:msg_warn
echo [93m%~1[0m
exit /b %ERRORLEVEL%
:msg_error
echo [91m%~1[0m
exit /b %ERRORLEVEL%