forked from managedfusion/managedfusion-rewriter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ManagedFusion.Rewriter.msbuild
72 lines (58 loc) · 2.73 KB
/
ManagedFusion.Rewriter.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
<?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)" />
<ItemGroup>
<MainProjects Include="src\**\*.csproj" />
<TestProjects Include="test\**\*.csproj" />
<AllProjects Include="@(MainProjects);@(TestProjects)" />
</ItemGroup>
<PropertyGroup>
<AssemblyName>ManagedFusion.Rewriter</AssemblyName>
<AssemblyInfo>src\Properties\AssemblyInfo.cs</AssemblyInfo>
<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)")]' />
</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="Test">
<TeamCityProgressMessage Text="Packaging NuGet" />
<ItemGroup>
<AssembliesToPackage Include="src\bin\**\$(AssemblyName).dll" />
<AssembliesToPackage Include="src\bin\**\$(AssemblyName).pdb" />
</ItemGroup>
<Copy SourceFiles="@(AssembliesToPackage)" DestinationFolder="$(PackageBuildPath)" />
<Exec Command="$(NuGetExe) update" />
<Exec Command="$(NuGetExe) pack -sym src/$(AssemblyName).csproj -o $(PackageBuildPath)" />
</Target>
<Target Name="Deploy" DependsOnTargets="Package">
<TeamCityProgressMessage Text="Deploying NuGet" />
<Exec Command="$(NuGetExe) push $(NuPackage) $(package_key)" />
</Target>
</Project>