-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
.vssbe
316 lines (316 loc) · 10.9 KB
/
.vssbe
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
{
"Header": {
"_": [
" This file for vsSolutionBuildEvent ",
" https://github.com/3F/vsSolutionBuildEvent "
],
"Compatibility": "0.12.4"
},
"PreBuild": [
{
"Enabled": true,
"Name": "ActDir",
"Caption": "Prepare output directory",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[($(Configuration) == \"PublicRelease\") {",
" #[$(cfgname = 'Release')]",
" $(isPubRel = true)",
"}",
"else{",
" #[$(cfgname = $(Configuration))]",
" $(isPubRel = false)",
"}]",
"",
"#[$(dbin = \"bin/$(cfgname)/\")]",
"",
"$(revDeltaBase = \"2017/06/22\")",
"$(revDeltaMin = $([System.Math]::Pow(10, 3)))",
"$(revDeltaMax = 65534) #[\" limit of AssemblyVersion - 65534 max allowed ! that is 65536 (0-65535) is not a correct range, (2^16 - 2) \"]",
"",
"$$(netstamp = $(TargetFrameworkVersion.Replace('v', '').Replace('.', '')))",
"",
"$(pDir = \"MvsSln\")",
"$(odir = \"$(dbin)raw\")",
"",
"#[var +revBuild]",
"#[var +bSha1]",
"#[var +bName]",
"#[var +bRevc]",
"",
"#[var pVer = #[File get(\".version\")]]",
"",
"##[IO delete.directory(\"$(dbin)\", true)]",
"#[IO copy.directory(\"\", \"$(dbin)\", true)]"
]
}
},
{
"Enabled": true,
"Name": "ModulesAndPkg",
"Caption": "Submodules and dep packages",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"~ Packages",
"",
"#[( !(#[IO exists.file(\"packages/__checked\")]) )",
"{",
" #[IO copy.directory(\"\", \"packages/\", true)]",
" #[File write(\"packages/__checked\"): ]",
"}]",
"",
"Call restore target to update nodes due to different options like MvsSlnFeatureHuid=true etc.",
"#[File scall(\".tools\\hmsbuild.bat\", \"~c $(Configuration) -t:restore /v:q /nologo\", 200)]"
]
}
},
{
"Enabled": true,
"Name": "ActUpdVersions",
"Caption": "Update version number ...",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[( ! $(isPubRel) ) {",
" #[IO replace.Regex(\"$(pDir)/MvsSlnVersion.cs\", \"(\\sS_NUM\\s=).+?\\\";\", \"$1 \\\"$(pVer)\\\";\")]",
"}]",
"",
"#[IO replace.Regex(\"$(pDir)/MvsSln.csproj\", \"<Version>.+?</Version>\", \"<Version>$(pVer)</Version>\")]"
]
}
},
{
"Enabled": true,
"Name": "ActVersion",
"Caption": "Update Version",
"ToConfiguration": [
"PublicRelease|Any CPU"
],
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[($(isPubRel)) ",
"{",
" #[var tBase = $([System.DateTime]::Parse('$(revDeltaBase)').ToBinary())]",
" #[var tNow = $([System.DateTime]::UtcNow.Ticks)]",
" #[var revBuild = #[$(",
" [System.TimeSpan]::FromTicks('$(",
" [MSBuild]::Subtract($(tNow), $(tBase))",
" )')",
" .TotalMinutes.ToString('0')",
" )]]",
" ",
" #[var revBuild = #[$(",
" ",
" [MSBuild]::Add(",
" $(revDeltaMin), ",
" $([MSBuild]::Modulo(",
" $(revBuild), ",
" $([MSBuild]::Subtract(",
" $(revDeltaMax), $(revDeltaMin)",
" ))",
" ))",
" )",
" ",
" )]]",
" ",
" #[$(pVerBuild = \"$(pVer).$(revBuild)\")]",
" #[$(pVerBuild0 = $(pVerBuild))]",
"}",
"else",
"{",
" #[$(revBuild = 0)]",
" #[$(pVerBuild = \"$(pVer)\")]",
" #[$(pVerBuild0 = \"$(pVerBuild).0\")]",
"}]",
"",
"",
"#[var tpl = // This code was generated by a vsSolutionBuildEvent. ",
"// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.",
"namespace net.r_eg.MvsSln",
"{",
" using System;",
"",
" public readonly struct MvsSlnVersion",
" {",
" public static readonly Version number = new Version(S_NUM_REV);",
"",
" public const string S_NUM = \"%S_NUM%\";",
" public const string S_REV = \"%S_REV%\";",
"",
" public const string S_NUM_REV = S_NUM + \".\" + S_REV;",
"",
" public const string BRANCH_SHA1 = \"%B_SHA1%\";",
" public const string BRANCH_NAME = \"%B_NAME%\";",
" public const string BRANCH_REVC = \"%B_REVC%\";",
"",
" internal const string S_INFO = S_NUM_REV + \"+\" + BRANCH_SHA1;",
" internal const string S_INFO_FULL = S_INFO + \":\" + BRANCH_NAME + \"-\" + BRANCH_REVC;",
" }",
"}]",
"",
"",
"#[var tpl = $(tpl.Replace(\"%S_NUM%\", \"$(pVer)\").Replace(\"%S_REV%\", \"$(revBuild)\"))]",
"",
"#[\" ",
" Checking of the git to define sha1, branch name, etc.",
"\"]",
"#[var isGit = #[IO cmd(\"git rev-parse 2>&1\")]]",
"#[( $(isGit) == \"\" )",
"{",
" #[var bSha1 = #[IO sout(\"git\", \"rev-parse --short HEAD\")]]",
" #[var bName = #[IO sout(\"git\", \"rev-parse --abbrev-ref HEAD\")]]",
" #[var bRevc = #[IO sout(\"git\", \"rev-list HEAD --count\")]]",
" ",
" #[($(bName) == \"HEAD\") {",
" #[var bName = $(APPVEYOR_REPO_BRANCH)]",
" }]",
" ",
" #[$(printVersion = \"$(pVerBuild)+$(bSha1)\")]",
"}",
"else {",
" #[$(bSha1 = '-')] #[$(bName = '-')] #[$(bRevc = '-')]",
" ",
" #[$(printVersion = \"$(pVerBuild)\")]",
"}]",
"",
"#[var tpl = #[$(tpl.Replace(\"%B_SHA1%\", \"#[var bSha1]\")",
" .Replace(\"%B_NAME%\", \"#[var bName]\")",
" .Replace(\"%B_REVC%\", \"#[var bRevc]\") )]]",
"",
"#[\" ",
" Save result",
"\"]",
"#[File write(\"$(pDir)/MvsSlnVersion.cs\"):#[var tpl]]"
]
}
},
{
"Enabled": true,
"Name": "ActInfo",
"Caption": "Compile info",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[var buildInfo = $([System.String]::Concat(\" \"))",
" MvsSln #[$(printVersion)]",
"",
"",
" Configuration: #[$(Configuration)]",
"",
" Platforms: #[$(TargetFrameworks)]",
"",
" ",
" :: generated by a vsSolutionBuildEvent v#[$(vsSolutionBuildEvent)]",
"]",
"",
"#[( $(isPubRel) ) { ",
" #[IO replace.Regex(\"$(pDir)/MvsSln.csproj\", \"<BuildInfoVSSBE>[\\s\\S]*?</BuildInfoVSSBE>\", \"<BuildInfoVSSBE>$(buildInfo)</BuildInfoVSSBE>\")]",
"}else{",
" #[IO replace.Regex(\"$(pDir)/MvsSln.csproj\", \"<BuildInfoVSSBE>[\\s\\S]*?</BuildInfoVSSBE>\", \"<BuildInfoVSSBE></BuildInfoVSSBE>\")]",
"}]",
"",
"#[IO writeLine(\"$(pDir)/obj/release-info.txt\"):#[var buildInfo]]",
""
]
}
}
],
"PostBuild": [
{
"Enabled": true,
"Name": "ActBinaries",
"Caption": "Binaries & tools ...",
"IgnoreIfBuildFailed": true,
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[IO copy.file(",
" \"$(SolutionDir).tools/*.*\", ",
" \"$(odir)/tools/\", ",
" true, ",
" {\"*.nuspec\", \"*.config\"})]",
"",
"##[IO copy.file(\"$(pDir)/$(OutputPath:$(pDir))/*.*\", ",
" \"$(odir)/lib/net$(netstamp)/\", true)]",
"",
"#[IO copy.file(",
" {\"License.txt\", \"3rd-party.txt\", \"Readme.md\", \"changelog.txt\", \".version\", \"$(pDir)/obj/release-info.txt\"}, ",
" \"$(odir)/\", true",
")]",
"",
"#[( $(cfgname) == \"Release\" )",
"{",
"",
" #[$(_targets = $(TargetFrameworks))]",
" #[$(_loop = true)]",
" ",
" #[Box iterate(i = 0; $(_loop); i += 1): ",
" #[try",
" {",
" ",
" #[$(_target = $(_targets.Split(\";\")[$(i)]))]",
" ",
" #[IO copy.file",
" (",
" \"$(OutDir:MvsSln)$(_target)/*.*\", ",
" \"$(odir)/lib/$(_target)/\", ",
" true,",
" {\"*.json\"}",
" )]",
" }",
" catch { $(_loop = false) }]",
" ]",
" ",
"}]",
"",
""
]
}
},
{
"Enabled": true,
"Name": "ActPack",
"Caption": "Packing with 7z & GetNuTool ...",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"##[IO replace(\"$(odir)/MvsSln.nuspec\", \"{build_info}\", \"$(buildInfo)\")]",
"",
"##[NuGet gnt.raw(\"/t:pack /p:ngin=\\\"$(odir)\\\" /p:ngout=\\\"$(dbin)\\\"\")]",
"",
"#[( $(cfgname) == \"Release\" )",
"{",
" ",
" #[($(revBuild) == \"\" || $(revBuild) ~= \"*\") {",
" #[$(zipname = \"MvsSln.$(pVer).zip\")]",
" }",
" else {",
" #[$(zipname = \"MvsSln.$(pVer).$(revBuild)+$(bSha1).zip\")]",
" }]",
" ",
" #[7z pack.directory(\"$(odir)\", \"$(dbin)\\\\$(zipname)\")]",
"",
"}]",
"",
"",
"#[IO copy.file",
"(",
" \"$(OutDir:MvsSln)*$(pVer).nupkg\",",
" \"$(dbin)/\", ",
" true ",
")]"
]
}
}
]
}