-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.cmd
More file actions
215 lines (141 loc) · 3.74 KB
/
Copy pathbuild.cmd
File metadata and controls
215 lines (141 loc) · 3.74 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
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
@ECHO OFF
REM #########################################################################
REM File: build.cmd (for recls.NET)
REM
REM Created: 26th September 2017
REM Updated: 5th April 2019
REM
REM Copyright (c) 2009-2019, Matthew Wilson and Synesis Software. All rights
REM reserved.
REM
REM #########################################################################
REM ##############################################
REM compatibility
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
IF ERRORLEVEL 1 (
ECHO This script requires extensions and delayed expansion
EXIT /B 1
)
REM ##############################################
REM constants
SET dir_script=%~dp0
SET dir_project_root=%dir_script%
SET dir_build=%dir_project_root%\build\packages
SET build_msbuild=MSBUILD.exe
SET build_nologo=-nologo
SET build_solution=recls.NET.sln
SET build_target_ALL=Build
SET build_target_DEFAULT=Build
SET build_configuration_ALL=Debug;Release;
SET build_platform_ALL="Any CPU"
SET build_platform_DEFAULT="Any CPU"
REM ##############################################
REM command-line parsing
IF /I {%~1} == {--help} GOTO show_usage
IF /I {%~1} == {package} GOTO build_package
IF {%~1} == {} GOTO build_all
IF NOT {%~2} == {} GOTO build_specific
GOTO show_usage
GOTO :EOF
REM ##############################################
REM Targets
REM ################
REM show_usage()
:show_usage
ECHO USAGE: %~n0^(%~x0^) [ { --help ^| package ^<version^> ^<key-path^> ^| ^<target^> ^<configuration^> [ ^<platform^> ] ^| } ]
ECHO.
ECHO where ^<target^> is one of { Build ^| Clean ^| Rebuild }
ECHO.
GOTO :EOF
REM ################
REM build_package()
:build_package
IF {%~3} == {} GOTO show_usage
ECHO.
ECHO Building ...
CALL %~dpnx0 Build Release
IF ERRORLEVEL 1 (
REM
) ELSE (
ECHO.
ECHO Signing ...
%dir_project_root%\scripts\sign_assemblies %3
ECHO Packaging ...
IF NOT EXIST %dir_build% mkdir %dir_build%
IF {%NUGET%} == {} (
ECHO %%NUGET%% is not defined
EXIT /B 1
) ELSE (
"%NUGET:"=%" pack %dir_project_root%\buildsrc\nuget\recls.NET.nuspec -Version %2 -OutputDirectory %dir_build%
)
)
GOTO :EOF
REM ################
REM build_all()
:build_all
ECHO building with following:
ECHO ^ ^ target(s):
for %%t in (!build_target_ALL!) do @ECHO ^ ^ ^ ^ %%t
ECHO ^ ^ configuration(s):
for %%c in (!build_configuration_ALL!) do @ECHO ^ ^ ^ ^ %%c
ECHO ^ ^ platform(s):
for %%p in (!build_platform_ALL!) do @ECHO ^ ^ ^ ^ %%p
ECHO.
for %%t in (!build_target_ALL!) do (
for %%c in (!build_configuration_ALL!) do (
REM for %%p in (!build_platform_ALL!) do (
SET arg_t=%%t
SET arg_c=%%c
REM SET arg_p=%%p
SET arg_p=
CALL %~dpnx0 !arg_t! !arg_c! !arg_p!
IF ERRORLEVEL 1 (
EXIT /B 1
)
REM )
)
)
EXIT /B 0
GOTO :EOF
REM ################
REM build_specific()
:build_specific
SET raw_target=%~1
SET raw_configuration=%~2
SET raw_platform=%~3
IF /I {!raw_target!} == {build} (
SET raw_target=Build
)
IF /I {!raw_target!} == {clean} (
SET raw_target=Clean
)
IF /I {!raw_target!} == {rebuild} (
SET raw_target=Rebuild
)
IF /I {!raw_configuration!} == {debug} (
SET raw_configuration=Debug
)
IF /I {!raw_configuration!} == {release} (
SET raw_configuration=Release
)
SET build_target=/t:"!raw_target!"
SET build_configuration=/p:Configuration="!raw_configuration!"
IF {!raw_platform!} == {} (
SET build_platform=/p:Platform="!build_platform_DEFAULT:"=!"
) ELSE (
SET build_platform=/p:Platform="%~3"
)
ECHO Building ...
!build_msbuild! !build_nologo! !build_solution! !build_target! !build_configuration! !build_platform!
IF ERRORLEVEL 1 (
ECHO Build failed
EXIT /B 1
) ELSE (
IF /I {!raw_target!} == {Clean} (
ECHO Cleaned
) ELSE (
ECHO Build Succeeded
)
)
GOTO :EOF
REM ############################ end of file ############################# #