-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathweb.proj
255 lines (207 loc) · 10.5 KB
/
web.proj
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
<?xml version='1.0' encoding='utf-8'?>
<Project InitialTargets="PackageRestore" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<UsingTask AssemblyFile="$(ExtensionPackPath)MSBuild.ExtensionPack.dll" TaskName="Ftp" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksPath)MSBuild.Community.Tasks.dll" TaskName="FtpUpload" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksPath)MSBuild.Community.Tasks.dll" TaskName="Unzip" />
<PropertyGroup>
<ProjectFolder>$(MSBuildThisFileDirectory)</ProjectFolder>
<Configuration>Release</Configuration>
<NpmPackageFolder>$(ProjectFolder)node_modules\</NpmPackageFolder>
<NugetPackageFolder>$(ProjectFolder)packages\</NugetPackageFolder>
<CommonFolder>$(ProjectFolder)common\</CommonFolder>
<WebRootFolder>$(ProjectFolder)root\</WebRootFolder>
<WebRootSourceFolder>$(WebRootFolder)src\</WebRootSourceFolder>
<WebRootOutputFolder>$(WebRootFolder)out\</WebRootOutputFolder>
<WebV3ManualFolder>$(ProjectFolder)v3manual\</WebV3ManualFolder>
<WebV3ManualSourceFolder>$(WebV3ManualFolder)src\</WebV3ManualSourceFolder>
<WebV3ManualOutputFolder>$(WebV3ManualFolder)out\</WebV3ManualOutputFolder>
<WebV4ManualFolder>$(ProjectFolder)v4manual\</WebV4ManualFolder>
<WebV4ManualSourceFolder>$(WebV4ManualFolder)src\</WebV4ManualSourceFolder>
<WebV4ManualOutputFolder>$(WebV4ManualFolder)out\</WebV4ManualOutputFolder>
<BuildFolder>$(OutputFolder)</BuildFolder>
<BuildFolder Condition="'$(BuildFolder)' == '' ">$(ProjectRoot)build\</BuildFolder>
<BuildFolder Condition="'$(BuildFolder)' != '' and !HasTrailingSlash('$(BuildFolder)')">$(BuildFolder)\</BuildFolder>
<DownloadFolder>$(BuildFolder)dl\</DownloadFolder>
<PublishFolder>$(BuildFolder)publish\</PublishFolder>
</PropertyGroup>
<!-- TODO: remove this when the Ftp MSBuild Task starts working -->
<PropertyGroup>
<WgetExe>$(ProjectFolder)tools\wget\wget.exe</WgetExe>
</PropertyGroup>
<ItemGroup>
<CommonFiles Include="$(CommonFolder)**" />
</ItemGroup>
<Target Name="GetRootInputsOutputs">
<ItemGroup>
<RootInput Include="@(CommonFiles)" />
<RootInput Include="$(WebRootFolder)docpad.coffee" />
<RootInput Include="$(WebRootSourceFolder)**" />
<RootOutput Include="$(WebRootOutputFolder)**" />
<RootOutput Include="$(WebRootOutputFolder)" Condition=" '@(RootOutput)'=='' " />
</ItemGroup>
</Target>
<Target Name="BuildRoot"
Inputs="@(RootInput)"
Outputs="@(RootOutput)"
DependsOnTargets="GetRootInputsOutputs">
<Copy SourceFiles="@(CommonFiles)"
DestinationFiles="@(CommonFiles->'$(WebRootSourceFolder)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
<Exec Command="node $(ProjectFolder)node_modules\docpad\bin\docpad generate --env static"
WorkingDirectory="$(WebRootFolder)" />
<ItemGroup>
<!-- We're using cleanurls on this project so only grab the index.html files but skip the individual news items -->
<PublishSource Include="$(WebRootOutputFolder)**\index.html" Exclude="$(WebRootOutputFolder)news\*\index.html" />
<PublishSource Include="$(WebRootOutputFolder)**" Exclude="$(WebRootOutputFolder)**\*.html" />
</ItemGroup>
</Target>
<Target Name="GetV3ManualInputsOutputs">
<ItemGroup>
<V3ManualInput Include="@(CommonFiles)" />
<V3ManualInput Include="$(WebV3ManualFolder)docpad.coffee" />
<V3ManualInput Include="$(WebV3ManualSourceFolder)**" />
<V3ManualOutput Include="$(WebV3ManualOutputFolder)**" />
<V3ManualOutput Include="$(WebV3ManualOutputFolder)" Condition=" '@(V3ManualOutput)'=='' " />
</ItemGroup>
</Target>
<Target Name="BuildV3Manual"
Inputs="@(V3ManualInput)"
Outputs="@(V3ManualOutput)"
DependsOnTargets="GetV3ManualInputsOutputs">
<Copy SourceFiles="@(CommonFiles)"
DestinationFiles="@(CommonFiles->'$(WebV3ManualSourceFolder)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
<Exec Command="node $(ProjectFolder)node_modules\docpad\bin\docpad generate --env static"
WorkingDirectory="$(WebV3ManualFolder)" />
<ItemGroup>
<!-- The manual is not designed to use cleanurls so grab everything -->
<PublishSource Include="$(WebV3ManualOutputFolder)**" />
</ItemGroup>
</Target>
<Target Name="BuildApi">
<MSBuild Projects="api\api.csproj" Properties="Configuration=$(Configuration)" />
<ItemGroup>
<PublishSource Include="api\bin\$(Configuration)\*.dll">
<RelativeOutputFolder>bin\</RelativeOutputFolder>
</PublishSource>
<PublishSource Include="api\bin\$(Configuration)\*.pdb">
<RelativeOutputFolder>bin\</RelativeOutputFolder>
</PublishSource>
<PublishSource Include="api\bin\$(Configuration)\web.config" />
<PublishSource Include="api\bin\$(Configuration)\App_Data\redirects.json">
<RelativeOutputFolder>App_Data\</RelativeOutputFolder>
</PublishSource>
</ItemGroup>
</Target>
<Target Name="IncorporateIssueTracker">
<ItemGroup>
<IssueTrackerFiles Include="issues\**">
<RelativeOutputFolder>issues\%(RecursiveDir)%(Filename)%(Extension)</RelativeOutputFolder>
</IssueTrackerFiles>
<PublishSource Include="@(IssueTrackerFiles)" />
</ItemGroup>
</Target>
<Target Name="CopyToPublishFolder"
Condition=" '@(PublishSource)'!='' ">
<Copy SourceFiles='@(PublishSource)'
DestinationFiles="@(PublishSource->'$(PublishFolder)%(RecursiveDir)%(Filename)%(Extension)' )"
SkipUnchangedFiles='true' UseHardlinksIfPossible='false'
Condition=" '%(PublishSource.RelativeOutputFolder)'=='' " />
<Copy SourceFiles='@(PublishSource)'
DestinationFiles="@(PublishSource->'$(PublishFolder)%(RelativeOutputFolder)%(RecursiveDir)%(Filename)%(Extension)' )"
SkipUnchangedFiles='true' UseHardlinksIfPossible='false'
Condition=" '%(PublishSource.RelativeOutputFolder)'!='' " />
</Target>
<Target Name="Build"
DependsOnTargets="BuildRoot;BuildV3Manual;BuildApi;IncorporateIssueTracker;CopyToPublishFolder;BuildSitemap">
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BuildFolder);$(WebRootOutputFolder);$(WebReleaseOutputFolder);$(WebV3ManualOutputFolder)" />
<Delete Files="@(CommonFiles->'$(WebRootSourceFolder)%(RecursiveDir)%(Filename)%(Extension)')" />
<Delete Files="@(CommonFiles->'$(WebV3ManualSourceFolder)%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="Rebuild"
DependsOnTargets="Clean;Build">
</Target>
<!--
================================================================================================
Pull
Downloads stage content from website.
================================================================================================
-->
<Target Name="Pull"
DependsOnTargets="CheckPassword;DownloadStagedFiles;GatherDownloadedStagedFiles;UnzipManuals;CopyReleaseMetadata" />
<Target Name="DownloadStagedFiles"
DependsOnTargets="CheckPassword">
<!-- This MSBuild task does not work correctly
<Ftp TaskAction="DownloadFiles"
Host="ftp.wixtoolset.org"
Username="$(Username)"
UserPassword="$(Password)"
RemoteDirectoryName="App_Data\staged"
WorkingDirectory="$(DownloadFolder)" />
-->
<Exec Command=""$(WgetExe)" ftp://ftp.wixtoolset.org/App_Data/staged/* --ftp-user=$(Username) --ftp-password=$(Password) -nH -nd -N -P $(DownloadFolder) -q"
WorkingDirectory="$(ProjectFolder)" />
</Target>
<Target Name="GatherDownloadedStagedFiles">
<ItemGroup>
<ManualZip Include="$(DownloadFolder)**\v3manual.zip">
<OutputFolder>$(WebV3ManualSourceFolder)\documents\documentation\manual\v3</OutputFolder>
</ManualZip>
<ManualZip Include="$(DownloadFolder)**\v4manual.zip">
<OutputFolder>$(WebV4ManualSourceFolder)\documents\documentation\manual\v4</OutputFolder>
</ManualZip>
<ReleaseMetadataFile Include="$(DownloadFolder)**\*.json">
<OutputFolder>$(WebRootSourceFolder)\documents\App_Data\releases\info\</OutputFolder>
</ReleaseMetadataFile>
<ReleaseMetadataFile Include="$(DownloadFolder)**\*.md">
<OutputFolder>$(WebRootSourceFolder)\documents\releases\</OutputFolder>
</ReleaseMetadataFile>
</ItemGroup>
</Target>
<Target Name="UnzipManuals"
Condition=" '@(ManualZip)'!='' ">
<RemoveDir Directories="%(ManualZip.OutputFolder)" />
<Unzip ZipFileName="@(ManualZip)"
TargetDirectory="%(OutputFolder)"
Quiet="true" />
</Target>
<Target Name="CopyReleaseMetadata">
<Copy SourceFiles='@(ReleaseMetadataFile)'
DestinationFiles="@(ReleaseMetadataFile->'%(OutputFolder)%(RecursiveDir)%(Filename)%(Extension)' )"
SkipUnchangedFiles='true' />
</Target>
<!--
================================================================================================
Push
Builds and uploads website.
================================================================================================
-->
<Target Name="Push"
DependsOnTargets="CheckPassword;Build;Publish">
</Target>
<Target Name="Publish"
DependsOnTargets="CheckPassword;GetPublishFiles">
<Error Text="There are no files to publish. Consider doing a build first or just do -t:Push." Condition=" '@(PublishFiles)'=='' " />
<FtpUpload RemoteUri="ftp://ftp.wixtoolset.org/"
Username="$(Username)"
Password="$(Password)"
LocalFiles="@(PublishFiles)"
RemoteFiles="@(PublishFiles->'%(Uri)')" />
</Target>
<Target Name="GetPublishFiles">
<ItemGroup>
<_ThrowAwayCollection Include="$(PublishFolder)**"/>
<PublishFiles Include="@(_ThrowAwayCollection)">
<Uri>$([System.String]::Copy('%(_ThrowAwayCollection.RecursiveDir)').Replace('\','/'))%(Filename)%(Extension)</Uri>
</PublishFiles>
</ItemGroup>
</Target>
<Target Name="CheckPassword">
<Error Text="Must specify username property on the command-line using the -p:Username= property." Condition=" '$(username)'=='' " />
<Error Text="Must specify password property on the command-line using the -p:Password= property." Condition=" '$(password)'=='' " />
</Target>
<Import Project="tools\PackageRestore.targets" />
<Import Project="tools\Sitemap.targets" />
</Project>