forked from smartstore/SmartStoreNET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmartStoreNET.Tasks.Targets
221 lines (170 loc) · 9.42 KB
/
SmartStoreNET.Tasks.Targets
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
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- General -->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<!-- Initialization -->
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">Any CPU</Platform>
<Platform Condition="'$(Platform)' == 'MCD'">Any CPU</Platform>
<RootFolder>$(MSBuildProjectDirectory)</RootFolder>
<LibFolder>$(RootFolder)\lib</LibFolder>
<SrcFolder>$(RootFolder)\src</SrcFolder>
<SlnName>SmartStoreNET</SlnName>
<BuildFolder>$(RootFolder)\build</BuildFolder>
<MsBuildTasksFolder>$(RootFolder)\buildtasks</MsBuildTasksFolder>
<ArtifactsFolder>$(RootFolder)\artifacts</ArtifactsFolder>
<SqlCeFolder>$(LibFolder)\sqlce</SqlCeFolder>
<V8Folder>$(LibFolder)\ClearScript.V8</V8Folder>
<SourceArtifactFolder>$(ArtifactsFolder)\Source</SourceArtifactFolder>
<MsDeployArtifactFolder>$(ArtifactsFolder)\MsDeploy</MsDeployArtifactFolder>
<GalleryArtifactFolder>$(ArtifactsFolder)\Gallery</GalleryArtifactFolder>
<PluginsSrcFolder>$(SrcFolder)\Plugins</PluginsSrcFolder>
<WebFolder>$(SrcFolder)\Presentation\SmartStore.Web</WebFolder>
<WebPluginsFolder>$(WebFolder)\Plugins</WebPluginsFolder>
<WebThemesFolder>$(WebFolder)\Themes</WebThemesFolder>
<CompileFolder>$(BuildFolder)\Compile</CompileFolder>
<WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
<StageFolder>$(BuildFolder)\Web</StageFolder>
<MsDeployFolder>$(BuildFolder)\MsDeploy</MsDeployFolder>
<PrecompiledFolder>$(BuildFolder)\Precompiled</PrecompiledFolder>
<ProfilingFolder>$(BuildFolder)\Profiling</ProfilingFolder>
<GalleryFolder>$(BuildFolder)\Gallery</GalleryFolder>
<TransformInputFile>$(WebFolder)\Web.config</TransformInputFile>
<TransformFile>$(WebFolder)\Web.$(Configuration).config</TransformFile>
<TransformOutputFile>$(StageFolder)\Web.config</TransformOutputFile>
<BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform>
<BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform>
<xVersion>$(BUILD_NUMBER)</xVersion>
<Version>2.1.1</Version>
<ZipDirectory>$(StageFolder)</ZipDirectory>
<ZipVersionFileSuffix Condition="$(Version) != ''">.$(Version)</ZipVersionFileSuffix>
<ZipVersionFileSuffix Condition="$(Version) == ''"></ZipVersionFileSuffix>
<ZipFileSuffix>.Web</ZipFileSuffix>
</PropertyGroup>
<Import Project="$(LibFolder)\MSBuild\MSBuild.Community.Tasks.Targets"/>
<Import Project="$(LibFolder)\MSBuild\Extensions\MSBuild.ExtensionPack.VersionNumber.targets"/>
<!-- Coordinating Targets -->
<Target Name="Build">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
</Target>
<Target Name="BuildFull">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Test"/>
</Target>
<Target Name="Deploy">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Stage"/>
</Target>
<Target Name="DeployFull">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Test"/>
<CallTarget Targets="Stage"/>
</Target>
<!-- Building -->
<Target Name="Clean">
<!-- delete Web/Plugins folder -->
<RemoveDir Directories="$(WebPluginsFolder)" ContinueOnError="false" />
<!-- "clean" solution -->
<MSBuild Projects="$(SrcFolder)\$(SlnName).sln" Targets="Clean" />
</Target>
<Target Name="Compile">
<!-- compile solution -->
<MSBuild Projects="$(SrcFolder)\$(SlnName).sln" Targets="Build" Properties="Configuration=$(Configuration);Platform=$(Platform)" />
</Target>
<Target Name="Stage" DependsOnTargets="Build">
<ItemGroup>
<PluginFiles Include="$(WebPluginsFolder)\**\*" />
<MigrationFiles Include="$(WebFolder)\App_Data\Migrations\**\*.sql" />
<MigrationFiles Include="$(WebFolder)\App_Data\Migrations\**\*.txt" />
<UploadedImages Include="$(WebFolder)\Media\uploaded\**\*" />
<SqlCe-Native-Binaries-x86 Include="$(SqlCeFolder)\x86\**\*"/>
<SqlCe-Native-Binaries-amd64 Include="$(SqlCeFolder)\amd64\**\*"/>
<V8-Libs Include="$(V8Folder)\lib\**\*"/>
<V8-Native-Binaries-x86 Include="$(V8Folder)\Native\x86\**\*"/>
<V8-Native-Binaries-amd64 Include="$(V8Folder)\Native\amd64\**\*"/>
</ItemGroup>
<!-- delete the build folder -->
<RemoveDir Directories="$(BuildFolder)" ContinueOnError="true"/>
<!-- create required target folders -->
<MakeDir Directories="$(BuildFolder)" />
<MakeDir Directories="$(StageFolder)" />
<MakeDir Directories="$(StageFolder)\Plugins\bin\" />
<MakeDir Directories="$(StageFolder)\App_Data\Migrations\" />
<!-- publish SmartStore.Web -->
<MSBuild Projects="$(WebFolder)\SmartStore.Web.csproj"
Targets="ResolveReferences;_CopyWebApplication"
Properties="WebProjectOutputDir=$(StageFolder)\;
OutDir=$(StageFolder)\bin\;Configuration=$(Configuration)" />
<!-- copy the plugins to the stage directory -->
<Copy SourceFiles="@(PluginFiles)" DestinationFolder="$(StageFolder)\Plugins\%(RecursiveDir)" />
<!-- copy the migration sql scripts to the stage directory -->
<Copy SourceFiles="@(MigrationFiles)" DestinationFolder="$(StageFolder)\App_Data\Migrations\%(RecursiveDir)" />
<!-- publish SmartStore.Admin -->
<MSBuild Projects="$(WebFolder)\Administration\SmartStore.Admin.csproj"
Targets="ResolveReferences;_CopyWebApplication"
Properties="WebProjectOutputDir=$(StageFolder)\Administration\;
OutDir=$(StageFolder)\Administration\bin\;Configuration=$(Configuration)" />
<!-- move SmartStore.Admin/bin/ to the root bin/ -->
<CreateItem Include="$(StageFolder)\Administration\bin\*.dll">
<Output TaskParameter="Include" ItemName="AdminCompileOutput" />
</CreateItem>
<Copy SourceFiles="@(AdminCompileOutput)" DestinationFolder="$(StageFolder)\bin\" />
<!-- delete the bin in SmartStore.Admin -->
<RemoveDir Directories="$(StageFolder)\Administration\bin\" />
<!-- delete the packages.config files -->
<Delete Files="$(StageFolder)\Administration\packages.config; $(StageFolder)\packages.config"/>
<!-- copy \Media\uploaded\ folder to stage -->
<!--<RemoveDir Directories="$(StageFolder)\Media\uploaded\" />
<Copy SourceFiles="@(UploadedImages)" DestinationFolder="$(StageFolder)\Media\uploaded\%(RecursiveDir)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" />-->
<!-- copy SQL Compact native binaries-->
<Copy SourceFiles="@(SqlCe-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(SqlCe-Native-Binaries-amd64)" DestinationFolder="$(StageFolder)\bin\amd64\%(RecursiveDir)" />
<!-- copy ClearScript.V8 Javascript engine files -->
<Copy SourceFiles="@(V8-Libs)" DestinationFolder="$(StageFolder)\bin\ClearScript.V8\%(RecursiveDir)" />
<Copy SourceFiles="@(V8-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(V8-Native-Binaries-amd64)" DestinationFolder="$(StageFolder)\bin\amd64\%(RecursiveDir)" />
<!-- transform config files -->
<TransformXml Source="$(TransformInputFile)" Transform="$(TransformFile)" Destination="$(TransformOutputFile)" />
<!-- delete obsolete config files -->
<Attrib Files="$(StageFolder)\Web.Release.config" ReadOnly="false"/>
<Attrib Files="$(StageFolder)\Web.Debug.config" ReadOnly="false"/>
<Delete Files="$(StageFolder)\Web.Release.config"/>
<Delete Files="$(StageFolder)\Web.Debug.config" />
<!-- extra processing of the staged config files -->
<XmlUpdate XmlFileName="$(TransformOutputFile)" XPath="/configuration/system.web/compilation/@debug" Value="false" />
<XmlUpdate XmlFileName="$(TransformOutputFile)" XPath="/configuration/system.web/trace/@enabled" Value="false" />
<XmlUpdate XmlFileName="$(TransformOutputFile)" XPath="/configuration/system.web/machineKey/@validationKey" Value="AutoGenerate" />
<XmlUpdate XmlFileName="$(TransformOutputFile)" XPath="/configuration/system.web/machineKey/@decryptionKey" Value="AutoGenerate" />
</Target>
<Target Name="Package-Zip">
<ItemGroup>
<Zip-Files Include="$(ZipDirectory)\**\*" />
</ItemGroup>
<Zip Files="@(Zip-Files)" WorkingDirectory="$(ZipDirectory)" ZipFileName="$(BuildFolder)\SmartStoreNET$(ZipFileSuffix)$(ZipVersionFileSuffix).zip" />
</Target>
<!-- Testing -->
<Target Name="Test">
<PropertyGroup>
<TestFolder>$(BuildFolder)\Compile</TestFolder>
</PropertyGroup>
<!-- TeamCity support -->
<ItemGroup>
<NUnitAddinFiles Include="$(teamcity_dotnet_nunitaddin)-2.6.0.*" />
</ItemGroup>
<Copy SourceFiles="@(NUnitAddinFiles)" DestinationFolder="$(LibFolder)\nunit\addins" />
<!-- Compile to "OutputFolder" -->
<MSBuild Projects="$(SrcFolder)\$(SlnName).sln" Targets="Build" Properties="Configuration=$(Configuration);Platform=$(Platform);OutputPath=$(TestFolder)" />
<!-- Run unit test assemblies -->
<CreateItem Include="$(TestFolder)\*.Tests.dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<!-- execute test -->
<Message Text="Executing test fixtures with NUnit... This is a long running process and could take a few minutes... Dont't panic ;-)"/>
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(LibFolder)\nunit" WorkingDirectory="$(TestFolder)" OutputXmlFile="$(BuildFolder)\SmartStoreNET.Tests.xml" />
</Target>
</Project>