forked from smartstore/SmartStoreNET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmartStoreNET.Tasks.Targets
239 lines (187 loc) · 11 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<!-- General -->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\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>
<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>
<StageFolder>$(BuildFolder)\Web</StageFolder>
<MsDeployFolder>$(BuildFolder)\MsDeploy</MsDeployFolder>
<PrecompiledFolder>$(BuildFolder)\Precompiled</PrecompiledFolder>
<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>3.0.2</Version>
<ZipDirectory>$(StageFolder)</ZipDirectory>
<ZipVersionFileSuffix Condition="$(Version) != ''">.$(Version)</ZipVersionFileSuffix>
<ZipVersionFileSuffix Condition="$(Version) == ''"></ZipVersionFileSuffix>
<ZipFileSuffix>.Community</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-x64 Include="$(SqlCeFolder)\x64\**\*"/>
<V8-Native-Binaries-x86 Include="$(SrcFolder)\packages\JavaScriptEngineSwitcher.V8.Native.win-x86.2.4.0\runtimes\win7-x86\native\**\*"/>
<V8-Native-Binaries-x64 Include="$(SrcFolder)\packages\JavaScriptEngineSwitcher.V8.Native.win-x64.2.4.0\runtimes\win7-x64\native\**\*"/>
<LibSass-Native-Binaries-x86 Include="$(SrcFolder)\packages\LibSassHost.Native.win-x86.1.0.3\runtimes\win7-x86\native\**\*"/>
<LibSass-Native-Binaries-x64 Include="$(SrcFolder)\packages\LibSassHost.Native.win-x64.1.0.3\runtimes\win7-x64\native\**\*"/>
<VC14-Native-Binaries-x86 Include="$(LibFolder)\msvcp140\x86\**\*"/>
<VC14-Native-Binaries-x64 Include="$(LibFolder)\msvcp140\x64\**\*"/>
<RoslynFiles Include="$(SrcFolder)\packages\Microsoft.Net.Compilers.1.3.2\tools\**\*"/>
</ItemGroup>
<!-- delete the build folder -->
<RemoveDir Directories="$(BuildFolder)" ContinueOnError="true"/>
<!-- create required target folders -->
<MakeDir Directories="$(BuildFolder)" />
<MakeDir Directories="$(StageFolder)" />
<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)" />
<MakeDir Directories="$(StageFolder)\Plugins\bin\" />
<!-- Ensure that an initially empty folder gets successfully zipped -->
<Copy SourceFiles="$(StageFolder)\Content\placeholder.txt" DestinationFolder="$(StageFolder)\Plugins\bin\" />
<!-- 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 root bin/ -->
<CreateItem Include="$(StageFolder)\Administration\bin\*.dll">
<Output TaskParameter="Include" ItemName="AdminCompileOutput" />
</CreateItem>
<Copy SourceFiles="@(AdminCompileOutput)" DestinationFolder="$(StageFolder)\bin\" />
<!-- delete \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 native binaries-->
<Copy SourceFiles="@(SqlCe-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(SqlCe-Native-Binaries-x64)" DestinationFolder="$(StageFolder)\bin\x64\%(RecursiveDir)" />
<Copy SourceFiles="@(V8-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(V8-Native-Binaries-x64)" DestinationFolder="$(StageFolder)\bin\x64\%(RecursiveDir)" />
<Copy SourceFiles="@(LibSass-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(LibSass-Native-Binaries-x64)" DestinationFolder="$(StageFolder)\bin\x64\%(RecursiveDir)" />
<Copy SourceFiles="@(VC14-Native-Binaries-x86)" DestinationFolder="$(StageFolder)\bin\x86\%(RecursiveDir)" />
<Copy SourceFiles="@(VC14-Native-Binaries-x64)" DestinationFolder="$(StageFolder)\bin\x64\%(RecursiveDir)" />
<!-- copy Roslyn compiler files -->
<Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(StageFolder)\bin\roslyn\%(RecursiveDir)" />
<!-- transform config files -->
<TransformXml Source="$(TransformInputFile)" Transform="$(TransformFile)" Destination="$(TransformOutputFile)" />
<TransformXml Source="$(WebFolder)\Config\log4net.Config" Transform="$(WebFolder)\Config\log4net.$(Configuration).Config" Destination="$(StageFolder)\Config\log4net.Config" />
<!-- 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" />
<!-- remove satellite dll folders gathered from nuget packages -->
<CallTarget Targets="Remove-Satellites"/>
</Target>
<Target Name="Remove-Satellites">
<PropertyGroup>
<BinDir>$(StageFolder)\bin</BinDir>
</PropertyGroup>
<ItemGroup>
<SatelliteDirs Include="$(BinDir)\da;$(BinDir)\fi;$(BinDir)\ja;$(BinDir)\ko;$(BinDir)\mk;$(BinDir)\nl;$(BinDir)\pt;$(BinDir)\no;$(BinDir)\pl;$(BinDir)\ru-ru;$(BinDir)\sv;$(BinDir)\tr;$(BinDir)\uk;$(BinDir)\zh-CHS;$(BinDir)\zh-Hans;$(BinDir)\zh-Hant" />
</ItemGroup>
<RemoveDir Directories="@(SatelliteDirs)" />
</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>