forked from fluentcassandra/fluentcassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FluentCassandra.msbuild
82 lines (67 loc) · 3.17 KB
/
FluentCassandra.msbuild
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<UsingTask TaskName="NUnitTeamCity" AssemblyFile="$(teamcity_dotnet_nunitlauncher_msbuild_task)" />
<UsingTask AssemblyFile="$(MSBuildExtensionsPath)\NuGet\NuGet.MSBuild.dll" TaskName="NuGet.MSBuild.NuGet" />
<ItemGroup>
<MainProjects Include="src\**\*.csproj" />
<TestProjects Include="test\**\*.csproj" />
<AllProjects Include="@(MainProjects);@(TestProjects)" />
</ItemGroup>
<PropertyGroup>
<AssemblyName>FluentCassandra</AssemblyName>
<AssemblyNetVersion>net40</AssemblyNetVersion>
<AssemblyInfo>src\Properties\AssemblyInfo.cs</AssemblyInfo>
<PackagePath>nuget</PackagePath>
<PackageSpec>$(PackagePath)\$(AssemblyName).nuspec</PackageSpec>
<PackageBuildPath>build</PackageBuildPath>
<PackageId>$(AssemblyName)</PackageId>
<NuGetExe>lib\nuget.exe</NuGetExe>
<NuPackage>$(PackageBuildPath)\$(PackageId).$(build_number).nupkg</NuPackage>
</PropertyGroup>
<Target Name="CleanPackage">
<RemoveDir Directories="$(PackageBuildPath)" Condition="Exists($(PackageBuildPath))"/>
</Target>
<Target Name="Clean" DependsOnTargets="CleanPackage">
<TeamCityProgressMessage Text="Cleaning Projects" />
<MSBuild Projects="@(AllProjects)" Targets="Clean"/>
</Target>
<Target Name="SetVersion" DependsOnTargets="Clean">
<TeamCityProgressMessage Text="Update Version" />
<FileUpdate
Files="$(AssemblyInfo)"
Regex='\[assembly: (Assembly(File)?Version)\("([0-9\.\*]+)"\)\]'
ReplacementText='[assembly: $1("$(build_number)")]' />
<XmlUpdate
XmlFileName="$(PackageSpec)"
XPath="/package/metadata/version"
Value="$(build_number)"/>
</Target>
<Target Name="Test" DependsOnTargets="SetVersion">
<TeamCityProgressMessage Text="Building Tests" />
<MSBuild Projects="@(TestProjects)" Targets="Rebuild" Properties="Configuration=Release">
<Output TaskParameter="TargetOutputs" ItemName="TestOutput"/>
</MSBuild>
<TeamCityProgressMessage Text="Running Tests" />
<NUnitTeamCity Assemblies="@(TestOutput)" NUnitVersion="NUnit-2.5.9" />
</Target>
<Target Name="Build" DependsOnTargets="SetVersion">
<TeamCityProgressMessage Text="Building Projects" />
<MSBuild Projects="@(MainProjects)" Targets="Rebuild" Properties="Configuration=Release" />
</Target>
<Target Name="Package" DependsOnTargets="Build">
<TeamCityProgressMessage Text="Packaging NuGet" />
<ItemGroup>
<AssembliesToPackage Include="src\bin\**\$(AssemblyName).dll" />
</ItemGroup>
<RemoveDir Directories="$(PackagePath)\lib" />
<Copy SourceFiles="@(AssembliesToPackage)" DestinationFolder="$(PackagePath)\lib\$(AssemblyNetVersion)\" />
<Copy SourceFiles="@(AssembliesToPackage)" DestinationFolder="$(PackageBuildPath)" />
<Exec Command="$(NuGetExe) update" />
<Exec Command="$(NuGetExe) pack $(PackageSpec) -o $(PackageBuildPath)" />
</Target>
<Target Name="Deploy" DependsOnTargets="Package">
<TeamCityProgressMessage Text="Deploying NuGet" />
<Exec Command="$(NuGetExe) push $(NuPackage) $(package_key)" />
</Target>
</Project>