forked from FluentValidation/FluentValidation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeployment.proj
118 lines (90 loc) · 6.4 KB
/
Deployment.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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="default">
<PropertyGroup>
<BaseDir>$(MSBuildProjectDirectory)\..</BaseDir>
<BuildDir>$(BaseDir)\build</BuildDir>
<PackageDir>$(BuildDir)\Packages</PackageDir>
<PackageSuffix Condition="'$(PackageSuffix)'!=''"></PackageSuffix>
<OutputDir>$(BuildDir)\$(Configuration)$(PackageSuffix)</OutputDir>
<MSBuildExtensions>$(BaseDir)\.build\msbuild.community.tasks.dll</MSBuildExtensions>
</PropertyGroup>
<UsingTask AssemblyFile="$(MSBuildExtensions)" TaskName="MSBuild.Community.Tasks.Zip" />
<UsingTask AssemblyFile="$(MSBuildExtensions)" TaskName="MSBuild.Community.Tasks.XmlUpdate" />
<Target Name="default" DependsOnTargets="Deploy; PackageZip; CreatePackages" />
<Target Name="Deploy">
<ItemGroup>
<MainBinaries Include="$(BaseDir)\src\FluentValidation\bin\$(Configuration)$(PackageSuffix)\**\*.*" />
<Mvc5Binaries Include="$(BaseDir)\src\FluentValidation.Mvc5\bin\$(Configuration)$(PackageSuffix)\FluentValidation.Mvc.*" />
<PortableBinaries Include="$(BaseDir)\src\FluentValidation.Portable\bin\$(Configuration)$(PackageSuffix)\**\*.*" />
<WebApiBinaries Include="$(BaseDir)\src\FluentValidation.WebApi\bin\$(Configuration)$(PackageSuffix)\FluentValidation.WebApi.*" />
<Docs Include="$(BaseDir)\Changelog.txt;$(BaseDir)\License.txt" />
</ItemGroup>
<!-- Copy to the output directory -->
<Copy SourceFiles="@(MainBinaries)" DestinationFolder="$(OutputDir)\FluentValidation\%(RecursiveDir)" />
<Copy SourceFiles="@(Mvc5Binaries)" DestinationFolder="$(OutputDir)\MVC\MVC5" />
<Copy SourceFiles="@(WebApiBinaries)" DestinationFolder="$(OutputDir)\WebApi" />
<Copy SourceFIles="@(PortableBinaries)" DestinationFolder="$(OutputDir)\Portable" />
<Copy SourceFiles="@(Docs)" DestinationFolder="$(OutputDir)" />
</Target>
<Target Name="PackageZip">
<ItemGroup>
<FilesToZip Include="$(OutputDir)\**\*.*" />
</ItemGroup>
<Message Text="@(FilesToZip)" />
<Zip Files="@(FilesToZip)" ZipFileName="$(BuildDir)\FluentValidation$(PackageSuffix).zip" WorkingDirectory="$(OutputDir)" />
</Target>
<Target Name="CreatePackages" DependsOnTargets="Deploy">
<!-- First copy the nuspec template files to the package dir -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\FluentValidation$(PackageSuffix).nuspec" DestinationFolder="$(PackageDir)\temp\FluentValidation$(PackageSuffix)" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\FluentValidation.MVC5$(PackageSuffix).nuspec" DestinationFolder="$(PackageDir)\temp\FluentValidation.MVC5$(PackageSuffix)" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\FluentValidation.WebApi$(PackageSuffix).nuspec" DestinationFolder="$(PackageDir)\temp\FluentValidation.WebApi$(PackageSuffix)" />
<Copy SourceFiles="@(PortableBinaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation$(PackageSuffix)\lib\portable-win%2Bnet40%2Bsl50%2Bwp80\%(RecursiveDir)"/>
<!-- Copy the source files to the package dir -->
<Copy SourceFiles="@(MainBinaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation$(PackageSuffix)\lib\Net40\%(RecursiveDir)" />
<Copy SourceFiles="@(Mvc5Binaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation.MVC5$(PackageSuffix)\lib\Net45" />
<Copy SourceFiles="@(WebApiBinaries)" DestinationFolder="$(PackageDir)\temp\FluentValidation.WebApi$(PackageSuffix)\lib\Net45" />
<!-- Get the version number of the main FV assembly to insert into the nuspec files -->
<GetAssemblyIdentity AssemblyFiles="$(OutputDir)\FluentValidation\FluentValidation.dll">
<Output TaskParameter="Assemblies" ItemName="AsmInfo" />
</GetAssemblyIdentity>
<GetAssemblyIdentity AssemblyFiles="$(OutputDir)\Mvc\Mvc5\FluentValidation.Mvc.dll">
<Output TaskParameter="Assemblies" ItemName="Mvc5AsmInfo" />
</GetAssemblyIdentity>
<GetAssemblyIdentity AssemblyFiles="$(OutputDir)\WebApi\FluentValidation.WebApi.dll">
<Output TaskParameter="Assemblies" ItemName="WebApiAsmInfo" />
</GetAssemblyIdentity>
<!-- insert the version number into the nuspec files -->
<XmlUpdate
Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
XmlFileName="$(PackageDir)\temp\FluentValidation$(PackageSuffix)\FluentValidation$(PackageSuffix).nuspec"
XPath="/package/metadata/version"
Value="%(AsmInfo.Version)" />
<XmlUpdate
Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
XmlFileName="$(PackageDir)\temp\FluentValidation.MVC5$(PackageSuffix)\FluentValidation.MVC5$(PackageSuffix).nuspec"
XPath="/package/metadata/version"
Value="%(Mvc5AsmInfo.Version)" />
<XmlUpdate
Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
XmlFileName="$(PackageDir)\temp\FluentValidation.WebApi$(PackageSuffix)\FluentValidation.WebApi$(PackageSuffix).nuspec"
XPath="/package/metadata/version"
Value="%(WebApiAsmInfo.Version)" />
<!-- Also need to insert the version number into the MVC3 dependencies section -->
<XmlUpdate
Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
XmlFileName="$(PackageDir)\temp\FluentValidation.MVC5$(PackageSuffix)\FluentValidation.MVC5$(PackageSuffix).nuspec"
XPath="/package/metadata/dependencies/dependency[@id='FluentValidation$(PackageSuffix)']/@version"
Value="%(AsmInfo.Version)" />
<XmlUpdate
Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
XmlFileName="$(PackageDir)\temp\FluentValidation.WebApi$(PackageSuffix)\FluentValidation.WebApi$(PackageSuffix).nuspec"
XPath="/package/metadata/dependencies/dependency[@id='FluentValidation$(PackageSuffix)']/@version"
Value="%(AsmInfo.Version)" />
<Exec WorkingDirectory="$(BuildDir)\Packages"
Command="$(BaseDir)\.nuget\nuget.exe pack $(PackageDir)\temp\FluentValidation$(PackageSuffix)\FluentValidation$(PackageSuffix).nuspec" />
<Exec WorkingDirectory="$(BuildDir)\Packages"
Command="$(BaseDir)\.nuget\nuget.exe pack $(PackageDir)\temp\FluentValidation.MVC5$(PackageSuffix)\FluentValidation.MVC5$(PackageSuffix).nuspec" />
<Exec WorkingDirectory="$(BuildDir)\Packages"
Command="$(BaseDir)\.nuget\nuget.exe pack $(PackageDir)\temp\FluentValidation.WebApi$(PackageSuffix)\FluentValidation.WebApi$(PackageSuffix).nuspec" />
<RemoveDir Directories="$(PackageDir)\temp" />
</Target>
</Project>