forked from EvilBeaver/OneScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildAll.csproj
246 lines (180 loc) · 10.1 KB
/
BuildAll.csproj
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
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<Configuration>Release</Configuration>
<OutputPathForBuild>$(MSBuildProjectDirectory)\install\build\</OutputPathForBuild>
<DistPath>$(MSBuildProjectDirectory)\dist\</DistPath>
<BinFolder>$(OutputPathForBuild)\bin\</BinFolder>
<LibFolder>$(OutputPathForBuild)\lib\</LibFolder>
<DocFolder>$(OutputPathForBuild)\doc\</DocFolder>
<DebugDest>$(OutputPathForBuild)\vscode\</DebugDest>
<MDDocFolder>$(MSBuildProjectDirectory)\mddoc</MDDocFolder>
<ExamplesFolder>$(OutputPathForBuild)\examples\</ExamplesFolder>
<Solution>$(MSBuildProjectDirectory)\src\1Script.sln</Solution>
<InstallerStandartPath>"$(InnoSetupPath)\iscc.exe"</InstallerStandartPath>
<NugetExecutable>"$(NugetPath)\nuget.exe"</NugetExecutable>
<Major>1</Major>
<Minor>0</Minor>
<Build>11</Build>
<Revision>0</Revision>
</PropertyGroup>
<PropertyGroup Condition=" '$(ReleaseNumber)' != '' ">
<!-- CI Build Number -->
<Build>$(ReleaseNumber)</Build>
<VersionSuffix>$(Build)$(Suffix)</VersionSuffix>
</PropertyGroup>
<PropertyGroup Condition=" '$(BUILD_NUMBER)' != '' ">
<!-- CI Build Number -->
<Revision>$(BUILD_NUMBER)</Revision>
</PropertyGroup>
<ItemGroup>
<DefaultExclude Include="**\.git\**" />
<DefaultExclude Include="**\.git*" />
<DefaultExclude Include="**\*.pdb" />
<DefaultExclude Include="**\*.XML" />
<DefaultExclude Include="*.zip" />
<DefaultExclude Include="$(OutputPathForBuild)\*.pdb" />
<DefaultExclude Include="$(OutputPathForBuild)\*.XML" />
</ItemGroup>
<Target Name="VersionGenerate">
<AssemblyInfo CodeLanguage="CS"
OutputFile="src\GlobalAssemblyInfo.cs"
GenerateClass="true"
AssemblyCompany="EvilBeaver"
AssemblyCopyright="Copyright (c) 2016 EvilBeaver"
AssemblyConfiguration="Configuration=$(Configuration) Commit $(CommitHash)"
AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)"
AssemblyInformationalVersion="$(Major).$(Minor).$(Build).$(Revision)" />
</Target>
<Target Name="Configure">
<!--CI server will be generate build numbaer and regenerate all AssemblyInfo without commit-->
<CallTarget Targets="VersionGenerate" Condition=" '$(BUILD_NUMBER)' != '' "/>
<Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
<Message Text="Commit Hash: $(CommitHash)"/>
</Target>
<Target Name="Build" DependsOnTargets="CleanAll;Configure;Compile" >
<CallTarget Targets="PreparePackage" />
</Target>
<Target Name="CleanAll">
<CreateItem Include="$(OutputPathForBuild)\**\*">
<Output TaskParameter="Include" ItemName="RemoveFiles" />
</CreateItem>
<CreateItem Include="$(MSBuildProjectDirectory)\tests\*.os.xml">
<Output TaskParameter="Include" ItemName="RemoveXMLTestResultOnClean" />
</CreateItem>
<DeleteTree Directories="$(DistPath)/**/*" Condition="Exists($(DistPath))"/>
<DeleteTree Directories="$(OutputPathForBuild)/**/*" Condition="Exists($(OutputPathForBuild))"/>
<DeleteTree Directories="$(MDDocFolder)/**/*" Condition="Exists($(MDDocFolder))"/>
<Delete Files="@(RemoveXMLTestResultOnClean)" />
<MSBuild Projects="$(Solution)" Targets="Clean" Properties="Configuration=$(Configuration);OutputPath=$(OutputPathForBuild)"/>
</Target>
<Target Name="Compile" DependsOnTargets="RestoreNugetPackages">
<MSBuild Projects="$(Solution)" Properties="Configuration=$(Configuration);OutputPath=$(OutputPathForBuild)" />
</Target>
<Target Name="RestoreNugetPackages">
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\src" Command="$(NugetExecutable) restore 1Script.sln"/>
</Target>
<Target Name="PreparePackage">
<!--Сборка документации-->
<CallTarget Targets="GenerateDocs"/>
<CreateItem Include="$(OutputPathForBuild)\*.pdb;$(OutputPathForBuild)\*.XML;$(OutputPathForBuild)\StandaloneRunner.exe">
<Output TaskParameter="Include" ItemName="RemoveUnnessesaryFiles" />
</CreateItem>
<Delete Files="@(RemoveUnnessesaryFiles)" />
<MakeDir Directories="@(DebugDist)"/>
<ItemGroup>
<DbgFiles Include="$(OutputPathForBuild)\DebugServer.exe"/>
<DbgFiles Include="$(OutputPathForBuild)\DebugServer.exe.config"/>
<DbgFiles Include="$(OutputPathForBuild)\OneScript.DebugProtocol.dll"/>
<DbgFiles Include="$(OutputPathForBuild)\Newtonsoft.Json.dll"/>
</ItemGroup>
<Copy SourceFiles="@(DbgFiles)" DestinationFolder="$(DebugDest)\bin"/>
<Move SourceFiles="$(OutputPathForBuild)\package.json" DestinationFolder="$(DebugDest)"/>
<Move SourceFiles="$(OutputPathForBuild)\images\mono-debug-icon.png" DestinationFolder="$(DebugDest)\images"/>
<ItemGroup>
<BinaryFiles Include="$(OutputPathForBuild)\oscript.exe"/>
<BinaryFiles Include="$(OutputPathForBuild)\TestApp.exe"/>
<BinaryFiles Include="$(OutputPathForBuild)\ScriptEngine.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\ScriptEngine.HostedScript.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\OneScript.DebugProtocol.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\Ionic.Zip.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\Newtonsoft.Json.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\ICSharpCode.AvalonEdit.dll"/>
<BinaryFiles Include="$(OutputPathForBuild)\oscript.cfg"/>
<LibraryFiles Include="$(MSBuildProjectDirectory)\oscript-library\src\**\*" Exclude="$(MSBuildProjectDirectory)\oscript-library\**\*.git"/>
<ExampleFiles Include="$(MSBuildProjectDirectory)\install\examples\**\*"/>
</ItemGroup>
<Move SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinFolder)"/>
<Copy SourceFiles="@(LibraryFiles)" DestinationFolder="$(LibFolder)\%(RecursiveDir)"/>
<Copy SourceFiles="@(ExampleFiles)" DestinationFolder="$(ExamplesFolder)\%(RecursiveDir)"/>
<!-- Удаление артефактов NUnit -->
<ItemGroup>
<NUnitArtifacts Include="$(OutputPathForBuild)\*.dll"/>
<NUnitArtifacts Include="$(OutputPathForBuild)\ru\*.dll"/>
</ItemGroup>
<Delete Files="@(DbgFiles)"/>
<Delete Files="@(NUnitArtifacts)"/>
<RemoveDir Directories="$(OutputPathForBuild)\ru"/>
<!-- Копирование скрипта запуска для opm -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\opm.bat" DestinationFolder="$(BinFolder)"/>
</Target>
<Target Name="CreateInstall" DependsOnTargets="PrepareDistOutputFolder">
<Exec Command="$(InstallerStandartPath) "$(MSBuildProjectDirectory)\install\install.iss" /o"$(DistPath)"" />
</Target>
<Target Name="GenerateDocs">
<Exec Command="$(OneScriptDocumenter) $(TMP)\tempdoc.xml "$(OutputPathForBuild)\ScriptEngine.dll" "$(OutputPathForBuild)\ScriptEngine.HostedScript.dll" "$(OutputPathForBuild)\oscript.exe""/>
<Exec Command="$(OneScriptDocumenter) html $(TMP)\tempdoc.xml "$(DocFolder)\""/>
<Exec Command="$(OneScriptDocumenter) markdown $(TMP)\tempdoc.xml "$(MDDocFolder)" /syntax/page"/>
</Target>
<Target Name="CreateSignedInstall" DependsOnTargets="CreateMSI;CreateInstall">
<ItemGroup>
<FileToSign Include="$(DistPath)\*.msi" />
<FileToSign Include="$(DistPath)\*.exe" />
</ItemGroup>
<PropertyGroup>
<CertPass>"$(CertPassword)"</CertPass>
<CertFile>"$(CertPath)"</CertFile>
</PropertyGroup>
<!--Exec Command="echo $(CertPass) > crtpassword.txt"/-->
<Exec Command=""$(SignTool)" sign /f $(CertFile) /p $(CertPass) /t http://timestamp.verisign.com/scripts/timstamp.dll /d "OneScript Engine" /du http://oscript.io @(FileToSign,' ')"/>
</Target>
<Target Name="CreateMSI" DependsOnTargets="PrepareDistOutputFolder">
<Message Text="$(OutputPathForBuild)"/>
<MSBuild Projects="$(MSBuildProjectDirectory)\src\Installer\Installer.wixproj"
Properties="Configuration=$(Configuration);OutputPath=$(DistPath);OutputPathForBuild=$(OutputPathForBuild);Version=$(Major).$(Minor).$(Build)" />
</Target>
<Target Name="CreateNuget" DependsOnTargets="PrepareDistOutputFolder">
<CreateItem Include="$(DistPath)\*nupkg">
<Output TaskParameter="Include" ItemName="OldNugetOutput" />
</CreateItem>
<Delete Files="@(OldNugetOutput)" />
<ItemGroup>
<NugetAbleProject Include="ScriptEngine"/>
<NugetAbleProject Include="ScriptEngine.HostedScript"/>
</ItemGroup>
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\src\%(NugetAbleProject.Identity)"
Command="$(NugetExecutable) pack %(NugetAbleProject.Identity).csproj -Version $(Major).$(Minor).$(VersionSuffix) -Prop Configuration=Release -Prop "TargetPath=$(BinFolder)%(NugetAbleProject.Identity).dll" -OutputDirectory "$(DistPath)\""/>
</Target>
<Target Name="PublishNuget">
<ItemGroup>
<FileToPush Include="$(DistPath)*.nupkg" />
</ItemGroup>
<Exec Command="$(NugetExecutable) push "%(FileToPush.Identity)" $(NugetApiKey) -Source https://www.nuget.org/api/v2/package"/>
</Target>
<!--aditional tasks-->
<Target Name="xUnitTest">
<CreateItem Include="$(MSBuildProjectDirectory)\tests\*.os.xml">
<Output TaskParameter="Include" ItemName="RemoveXMLTestResult" />
</CreateItem>
<Delete Files="@(RemoveXMLTestResult)" />
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\tests" Command=""$(BinFolder)\oscript.exe" "$(MSBuildProjectDirectory)\tests\testrunner.os" -runall . xddReportPath ." IgnoreExitCode="true"/>
</Target>
<Target Name="PrepareDistOutputFolder">
<MakeDir Directories="$(DistPath)" Condition="!Exists($(DistPath))"/>
</Target>
<Target Name="CreateZip" DependsOnTargets="PrepareDistOutputFolder">
<Exec Command=""$(BinFolder)oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" pack "$(OutputPathForBuild)*" "$(DistPath)OneScript-1.0.$(ReleaseNumber).zip""/>
<Exec Command=""$(BinFolder)oscript.exe" "$(MSBuildProjectDirectory)\install\unicode-zipper.os" pack "$(MDDocFolder)\*" "$(DistPath)mddoc-1.0.$(ReleaseNumber).zip""/>
</Target>
</Project>