-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathautobuild.proj
More file actions
110 lines (101 loc) · 5.67 KB
/
autobuild.proj
File metadata and controls
110 lines (101 loc) · 5.67 KB
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
<Project DefaultTargets="AutoBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- ********************************************************************** -->
<!-- BEGINNING OF CONFIGURATION DATA -->
<!-- ********************************************************************** -->
<PropertyGroup>
<Configuration>Release</Configuration>
</PropertyGroup>
<!-- These are the solutions to build -->
<ItemGroup>
<SolutionFiles Include="**\*.sln" />
</ItemGroup>
<!-- This is the list of assemblyinfo files that we need to insert version information into -->
<ItemGroup>
<AssemblyInfoFiles Include="**\AssemblyInfo.cs" />
</ItemGroup>
<!-- This is the list of nuget package files that we need to insert version information into -->
<ItemGroup>
<NuGetFiles Include="*.nuspec" />
</ItemGroup>
<!-- This is the list of nuget package files that we need to delete when we build -->
<ItemGroup>
<NuPackFiles Include="**\*.nupkg" Exclude="packages\**\*.nupkg" />
</ItemGroup>
<!-- ********************************************************************** -->
<!-- END OF CONFIGURATION DATA -->
<!-- ********************************************************************** -->
<PropertyGroup>
<VersionFile>version.txt</VersionFile>
</PropertyGroup>
<!-- Standard autobuild. -->
<Target Name="AutoBuild" DependsOnTargets="IncrementVersion;TestBuild">
</Target>
<!-- Test Build without increment version. -->
<Target Name="TestBuild" DependsOnTargets="AssemblyInfo;BuildNet40;Build;Package">
<!-- Make sure that we revert the assembly info -->
<CallTarget Targets="RevertAssemblyInfo" />
<OnError ExecuteTargets="RevertAssemblyInfo" />
</Target>
<!-- IncrementVersion - Increments the version number. $(Revision) will be the new revision. -->
<Target Name="IncrementVersion">
<!-- Update the build number from the version file -->
<Version VersionFile="$(VersionFile)" BuildType="Increment" RevisionType="None">
<Output TaskParameter="Major" PropertyName="Major" />
<Output TaskParameter="Minor" PropertyName="Minor" />
<Output TaskParameter="Build" PropertyName="Build" />
</Version>
<Exec Command="git commit -a -m "Version $(Major).$(Minor).$(Build)"" />
<Exec Command="git tag -a -m "Version $(Major).$(Minor).$(Build)" Version_$(Major).$(Minor).$(Build)" />
</Target>
<!-- GetLocalVersion - Gets the version information for the local repository -->
<Target Name="GetLocalVersion">
<!-- Get the major/minor/build number from the version file -->
<Version VersionFile="$(VersionFile)" BuildType="None" RevisionType="None">
<Output TaskParameter="Major" PropertyName="Major" />
<Output TaskParameter="Minor" PropertyName="Minor" />
<Output TaskParameter="Build" PropertyName="Build" />
</Version>
<Message Text="Current Version: $(Major).$(Minor).$(Build)" />
</Target>
<!-- Generate the assembly info with the revision -->
<Target Name="AssemblyInfo" DependsOnTargets="GetLocalVersion">
<Message Text="Building Version: $(Major).$(Minor).$(Build)" />
<!-- Write the assembly information to the file -->
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="AssemblyVersion\s*\(\s*".*"\s*\)\s*\]" ReplacementText="AssemblyVersion("$(Major).$(Minor).$(Build)")]" />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="AssemblyFileVersion\s*\(\s*".*"\s*\)\s*\]" ReplacementText="AssemblyFileVersion("$(Major).$(Minor).$(Build)")]" />
<Message Text="Updating NuGet Package Versions" />
<XmlUpdate XmlFileName="%(NuGetFiles.Identity)" XPath="//package/metadata/version" Value="$(Major).$(Minor).$(Build)" />
</Target>
<!-- Build the .NET 4.0 assembly -->
<Target Name="BuildNet40">
<MSBuild Projects="%(SolutionFiles.Identity)" Properties="Configuration=$(Configuration);TargetFrameworkVersion=v4.0;" StopOnFirstFailure="true" />
<MakeDir Directories="Insight.Database.Schema\bin\NET40"/>
<Copy SourceFiles="@(Net40Outputs)" DestinationFolder="Insight.Database.Schema\bin\NET40"/>
</Target>
<ItemGroup>
<Net40Outputs Include="Insight.Database.Schema\bin\Release\Insight.Database.Schema.*"></Net40Outputs>
<Net40Outputs Include="Insight.Database.Schema\bin\Release\Insight.Database.*"></Net40Outputs>
<Net40Outputs Include="Insight.Database.Schema.Installer\bin\Release\InsightInstaller.exe"></Net40Outputs>
</ItemGroup>
<!-- Build the program -->
<Target Name="Build">
<Message Text="Building Version: $(Major).$(Minor).$(Build)" />
<Delete Files="%(NuPackFiles.Identity)" />
<!-- Build the solution -->
<MSBuild Projects="%(SolutionFiles.Identity)" Properties="Configuration=$(Configuration)" StopOnFirstFailure="true" />
<!-- Test Before Packaging -->
<Exec Command="packages\NUnit.2.6.0.12054\tools\nunit-console .\Insight.Database.Schema.Tests\bin\$(Configuration)\Insight.Database.Schema.Tests.dll"/>
</Target>
<Target Name="RevertAssemblyInfo">
<!-- Revert the Assembly Info files when complete -->
<Exec Command="git checkout %(AssemblyInfoFiles.Identity)" Condition="Exists(%(AssemblyInfoFiles.Identity))" />
<Exec Command="git checkout %(NuGetFiles.Identity)" Condition="Exists(%(NuGetFiles.Identity))" />
</Target>
<Import Project="packages\BuildTools.AutoBuild.1.0.17.47\tools\Build\MSBuild.Community.Tasks.Targets" />
<!-- Build the NuGet Package -->
<Target Name="Package">
<Message Text="Packaging NuGet" />
<MakeDir Directories="Build\Output" />
<Exec Command=".nuget\nuget.exe pack %(NuGetFiles.Identity) /OutputDirectory Build\Output" />
</Target>
</Project>