-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
.vssbe
320 lines (320 loc) · 11 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
317
318
319
320
{
"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/01/01\")",
"$(revDeltaMin = $([System.Math]::Pow(10, 3)))",
"$(revDeltaMax = 65534) //limit of AssemblyVersion (2^16 - 2)",
"",
"",
"$(netstamp = $(TargetFrameworkVersion.Replace('v', '').Replace('.', '')))",
"",
"$(pDir = \"Conari\")",
"$(odir = \"$(dbin)raw\")",
"$(objDir = $(RootObjDir))",
"$(prjDir = $(RootOutDir))",
"",
"$(pConariTest = \"ConariTest\")",
"$(pUnLib = \"UnLib\")",
"",
"#[var +revBuild]",
"#[var +bSha1]",
"#[var +bName]",
"#[var +bRevc]",
"",
"#[try",
"{",
" #[IO delete.directory(\"$(dbin)\", true)]",
"}catch{ F-53, SobaScript }]",
"",
"#[IO copy.directory(\"\", \"$(dbin)\", true)]"
]
}
},
{
"Enabled": true,
"Name": "ModulesAndPkg",
"Caption": "submodules and packages",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[( !(#[IO exists.file(\"UnmanagedEmitCalli/UnmanagedEmitCalli.sln\")]) )",
"{",
" #[File call(\"git\", \"submodule update --init UnmanagedEmitCalli\", 300)]",
"}]",
"",
"",
"~ Packages",
"",
"#[( !(#[IO exists.file(\"packages/__checked\")]) )",
"{",
" Call restore target to update nodes due to different options like MvsSlnFeatureHuid=true etc.",
" #[File scall(\".tools\\hMSBuild.bat\", \"~x ~c $(Configuration) -t:restore Conari.sln\", 200)]",
" ",
" #[IO copy.directory(\"\", \"packages/\", true)]",
" #[File write(\"packages/__checked\"): ]",
"}]"
]
}
},
{
"Enabled": true,
"Name": "ActVer",
"Caption": "Update version number ...",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[var pVer = #[File get(\".version\")]]",
"",
"Fix possible newlines when committing through GitHub web editor",
"https://github.com/3F/7z.Libs/commit/67c83ced",
"#[$(pVer = $(pVer.Trim()))]",
"",
"#[( ! $(isPubRel) ) {",
" #[IO replace.Regex(\"$(pDir)/ConariVersion.cs\", \"(\\sS_NUM\\s=).+?\\\";\", \"$1 \\\"$(pVer)\\\";\")]",
"}]",
"",
"#[IO replace.Regex(\"$(pDir)/Conari.csproj\", \"<Version>.+?</Version>\", \"<Version>$(pVer)</Version>\")]"
]
}
},
{
"Enabled": true,
"Name": "ActConariVersion",
"Caption": "Update ConariVersion",
"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.Conari",
"{",
" using System;",
"",
" public struct ConariVersion",
" {",
" public static readonly Version number = new Version(S_NUM_REV);",
"",
" public const string S_NUM = \"$(pVer)\";",
" public const string S_REV = \"$(revBuild)\";",
"",
" 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;",
" }",
"}]",
"",
"",
"#[\" ",
" Checking of the git to define sha1, branch name, etc.",
"\"]",
"#[($(isPubRel) ) { #[var isGit = #[IO cmd(\"git rev-parse 2>&1\")]] }else{ #[var -isGit] }]",
"#[( $(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)]",
" }]",
" ",
" #[$(rxwPrintVersion = \"$(pVerBuild)+$(bSha1)\")]",
" #[$(rwwProductVersion = \"$(pVer)+$(bSha1)\")]",
" #[$(buildCfg = $(Configuration))]",
"}",
"else {",
" #[$(bSha1 = '-')] #[$(bName = '-')] #[$(bRevc = '-')]",
" #[$(buildCfg = '')]",
" #[$(rxwPrintVersion = \"$(pVerBuild)\")]",
" #[$(rwwProductVersion = \"$(pVer)\")]",
"}]",
"",
"#[var tpl = #[$(tpl.Replace(\"%B_SHA1%\", \"#[var bSha1]\")",
" .Replace(\"%B_NAME%\", \"#[var bName]\")",
" .Replace(\"%B_REVC%\", \"#[var bRevc]\") )]]",
"",
"",
"#[File write(\"$(pDir)/ConariVersion.cs\"):#[$(tpl.Replace('\\n', '\\r\\n'))]]"
]
}
},
{
"Enabled": true,
"Name": "ActInfo",
"Caption": "Compile info",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[var buildInfo = $([System.String]::Concat(\" \"))",
" Conari #[$(rwwProductVersion)]",
" ",
" ",
" Configuration: #[$(Configuration)]",
" ",
" Platforms: #[$(TargetFrameworks)]",
" ",
" Build number: #[$(revBuild)]",
" ",
" ",
" :: generated by a vsSolutionBuildEvent #[$(vsSolutionBuildEvent)]",
"]",
"",
"#[( $(isPubRel) ) { ",
" #[IO replace.Regex(\"$(pDir)/Conari.csproj\", \"<BuildInfoVSSBE>[\\s\\S]*?</BuildInfoVSSBE>\", \"<BuildInfoVSSBE>$(buildInfo)</BuildInfoVSSBE>\")]",
"}else{",
" #[IO replace.Regex(\"$(pDir)/Conari.csproj\", \"<BuildInfoVSSBE>[\\s\\S]*?</BuildInfoVSSBE>\", \"<BuildInfoVSSBE></BuildInfoVSSBE>\")]",
"}]",
"",
"#[IO copy.directory(\"\", \"$(objDir)\", true)]",
"#[IO writeLine(\"$(objDir)/build-info.txt\"):#[$(buildInfo.Replace('\\n', '\\r\\n'))]]"
]
}
}
],
"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",
"(",
" {",
" \".version\",",
" \"LICENSE.txt\",",
" \"3rd-party-NOTICES.txt\",",
" \"Readme.md\",",
" \"changelog.txt\",",
" \"$(objDir)/build-info.txt\"",
" },",
" \"$(odir)/\", true",
")]",
"",
"",
"#[$(_targets = $(TargetFrameworks:Conari))]",
"#[$(_loop = true)]",
"",
"#[Box iterate(i = 0; $(_loop); i += 1): ",
" #[try",
" {",
"",
" #[$(_target = $(_targets.Split(\";\")[$(i)].Trim()))]",
" #[(! \"$(_target)\" == \"\" )",
" {",
" #[IO copy.file",
" (",
" \"$(OutDir:Conari)/$(_target)/*.*\", ",
" \"$(odir)/lib/$(_target)/\", ",
" true,",
" {\"*.json\"}",
" )]",
" }] ",
" }",
" catch { $(_loop = false) }]",
"]",
"",
"#[IO copy.file(\"$(prjDir)$(pUnLib)\\$(cfgname)\\*.dll\", \"$(prjDir)$(pConariTest)\\$(cfgname)\\\\\", true)]",
""
]
}
},
{
"Enabled": true,
"Name": "ActPack",
"Caption": "zip archives etc.",
"IgnoreIfBuildFailed": true,
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[($(isPubRel)) ",
"{",
" #[7z pack.directory(\"$(odir)\", \"$(dbin)\\\\Conari.$(rxwPrintVersion).zip\")]",
"}]",
"",
"",
"#[IO copy.file",
"(",
" \"$(OutDir:Conari)/*$(pVer).nupkg\",",
" \"$(dbin)/\", ",
" true ",
")]"
]
}
}
]
}