forked from EvilBeaver/OneScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildAll.csproj
208 lines (147 loc) · 7.9 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
<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>
<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>
</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">
<Time>
<Output TaskParameter="Month" PropertyName="Month" />
<Output TaskParameter="Day" PropertyName="Day" />
<Output TaskParameter="Year" PropertyName="Year" />
</Time>
<AssemblyInfo CodeLanguage="CS"
OutputFile="src\GlobalAssemblyInfo.cs"
GenerateClass="true"
AssemblyCompany="BeaverSoft"
AssemblyCopyright="Copyright (c) 2014 BeaverSoft"
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))"/>
<Delete Files="@(RemoveXMLTestResultOnClean)" />
<MSBuild Projects="$(Solution)" Targets="Clean" Properties="Configuration=$(Configuration);OutputPath=$(OutputPathForBuild)"/>
</Target>
<Target Name="Compile">
<MSBuild Projects="$(Solution)" Properties="Configuration=$(Configuration);OutputPath=$(OutputPathForBuild)" />
<!--TODO Why Snheopat.Engine build into source dir -->
<ItemGroup>
<SnegopatEngine Include="$(MSBuildProjectDirectory)\src\Release\ScriptEngine.Snegopat.dll"/>
</ItemGroup>
<Copy SourceFiles="@(SnegopatEngine)" DestinationFolder="$(OutputPathForBuild)\" />
</Target>
<Target Name="PreparePackage">
<!--Сборка документации-->
<CallTarget Targets="GenerateDocs" Condition="Exists($(OneScriptDocumenter))"/>
<CreateItem Include="$(OutputPathForBuild)\*.pdb;$(OutputPathForBuild)\*.XML;$(OutputPathForBuild)\StandaloneRunner.exe">
<Output TaskParameter="Include" ItemName="RemoveUnnessesaryFiles" />
</CreateItem>
<Delete Files="@(RemoveUnnessesaryFiles)" />
<ItemGroup>
<BinaryFiles Include="$(OutputPathForBuild)\*"/>
<LibraryFiles Include="$(MSBuildProjectDirectory)\oscript-library\src\**\*"/>
<ExampleFiles Include="$(MSBuildProjectDirectory)\install\examples\**\*"/>
</ItemGroup>
<Move SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinFolder)"/>
<Copy SourceFiles="@(LibraryFiles)" DestinationFolder="$(LibFolder)\%(RecursiveDir)"/>
<Copy SourceFiles="@(ExampleFiles)" DestinationFolder="$(ExamplesFolder)\%(RecursiveDir)"/>
<!-- Копирование скрипта запуска для opm -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\opm.bat" DestinationFolder="$(BinFolder)"/>
</Target>
<Target Name="CreateInstall">
<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)\""/>
</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">
<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">
<ItemGroup>
<NugetAbleProject Include="ScriptEngine"/>
<NugetAbleProject Include="ScriptEngine.HostedScript"/>
</ItemGroup>
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\src\%(NugetAbleProject.Identity)"
Command="$(NugetExecutable) pack %(NugetAbleProject.Identity).csproj -Version $(Major).$(Minor).$(Build) -Prop Configuration=Release -Prop "TargetPath=$(BinFolder)%(NugetAbleProject.Identity).dll" -OutputDirectory "$(DistPath)\""/>
</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="$(OutputPathForBuild)\bin\oscript.exe $(MSBuildProjectDirectory)\tests\testrunner.os -runall . xddReportPath ." IgnoreExitCode="true"/>
</Target>
<Target Name="CreateZipForUpdateDll">
<CreateItem Include="$(OutputPathForBuild)\**\*" Exclude="$(DefaultExclude)" >
<Output TaskParameter="Include" ItemName="ZipFiles" />
</CreateItem>
<Zip Files="@(ZipFiles)"
WorkingDirectory="$(OutputPathForBuild)"
ZipFileName="$(DistPath)OneScript-$(Major).$(Minor).$(Build)-bin.zip" />
</Target>
</Project>