forked from libbitcoin/libbitcoin-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cmd
136 lines (123 loc) · 3.65 KB
/
build.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
REM ###########################################################################
REM # Copyright (c) 2014-2019 libbitcoin-node developers (see COPYING).
REM #
REM # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
REM #
REM ###########################################################################
@echo off
SETLOCAL ENABLEEXTENSIONS
SET "parent=%~dp0"
SET "path_base=%~1"
SET "nuget_pkg_path=%~1\.nuget\packages"
SET "msbuild_args=/verbosity:minimal /p:Platform=%~2 /p:Configuration=%~3"
SET "proj_version=%~4"
SET "msbuild_exe=msbuild"
IF EXIST "%~5" SET "msbuild_exe=%~5"
call :pending "Build initialized..."
IF NOT EXIST "%nuget_pkg_path%" (
call mkdir "%nuget_pkg_path%"
IF %ERRORLEVEL% NEQ 0 (
call :failure "mkdir %nuget_pkg_path% failed."
exit /b 1
)
)
call :init libbitcoin libbitcoin-system master
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing repository libbitcoin libbitcoin-system master failed."
exit /b 1
)
call :init libbitcoin libbitcoin-consensus master
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing repository libbitcoin libbitcoin-consensus master failed."
exit /b 1
)
call :init libbitcoin libbitcoin-database master
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing repository libbitcoin libbitcoin-database master failed."
exit /b 1
)
call :init libbitcoin libbitcoin-blockchain master
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing repository libbitcoin libbitcoin-blockchain master failed."
exit /b 1
)
call :init libbitcoin libbitcoin-network master
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing repository libbitcoin libbitcoin-network master failed."
exit /b 1
)
call :bld_repo libbitcoin-node
IF %ERRORLEVEL% NEQ 0 (
call :failure "Building libbitcoin-node failed."
exit /b 1
)
call :success "Build complete."
exit /b 0
:init
call :pending "Initializing repository %~1/%~2/%~3..."
IF NOT EXIST "%path_base%\%~2" (
call git clone -q --branch=%~3 https://github.com/%~1/%~2 "%path_base%\%~2"
IF %ERRORLEVEL% NEQ 0 (
call :failure "git clone %~1/%~2 failed."
exit /b 1
)
) ELSE (
call :success "%path_base%\%~2 exists, assuming valid clone."
)
call :bld_proj %~2
IF %ERRORLEVEL% NEQ 0 (
call :failure "Building project %~2 failed."
exit /b 1
)
call :success "Initialization of %~1/%~2/%~3 complete."
exit /b 0
:bld_repo
call :pending "Building respository %~1..."
call :depends "%~1"
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing dependencies %~1 failed."
exit /b 1
)
call cd /d "%path_base%\%~1\builds\msvc\%proj_version%"
call "%msbuild_exe%" %msbuild_args% %~1.sln
IF %ERRORLEVEL% NEQ 0 (
call :failure "%msbuild_exe% %msbuild_args% %~1.sln failed."
exit /b 1
)
call :success "Building repository %~1 execution complete."
call cd /d "%path_base%"
exit /b 0
:bld_proj
call :pending "Building respository project %~1..."
call :depends %~1
IF %ERRORLEVEL% NEQ 0 (
call :failure "Initializing dependencies %~1 failed."
exit /b 1
)
call cd /d "%path_base%\%~1\builds\msvc\%proj_version%"
call "%msbuild_exe%" %msbuild_args% /target:%~1:Rebuild %~1.sln
IF %ERRORLEVEL% NEQ 0 (
call :failure "%msbuild_exe% %msbuild_args% /target:%~1:Rebuild %~1.sln"
exit /b 1
)
call :success "Building repository project %~1 execution complete."
call cd /d "%path_base%"
exit /b 0
:depends
call :pending "nuget restoring dependencies for %~1..."
call nuget restore "%path_base%\%~1\builds\msvc\%proj_version%\%~1.sln" -Outputdir "%nuget_pkg_path%"
IF %ERRORLEVEL% NEQ 0 (
call :failure "nuget restore failed."
exit /b 1
)
call :success "nuget restoration for %~1 complete."
exit /b 0
:pending
echo [93m%~1[0m
exit /b 0
:success
echo [92m%~1[0m
exit /b 0
:failure
echo [91m%~1[0m
exit /b 0