forked from jonwagner/Insight.Database.Schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autobuild.proj
87 lines (87 loc) · 4.81 KB
/
autobuild.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
<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>
<Target Name="AutoBuild" DependsOnTargets="IncrementVersion;Build">
</Target>
<!-- IncrementVersion - Increments the version number. $(Revision) will be the new revision. -->
<Target Name="IncrementVersion">
<HgUpdate LocalPath="$(MSBuildProjectDirectory)" />
<!-- 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" />
<Output TaskParameter="Revision" PropertyName="Revision" />
</Version>
<HgCommit LocalPath="." Message="Version $(Major).$(Minor).$(Build)" />
<HgTag LocalPath="$(MSBuildProjectDirectory)" Tag="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>
<HgVersion LocalPath=".">
<Output TaskParameter="Revision" PropertyName="Revision" />
</HgVersion>
<Message Text="Current Version: $(Major).$(Minor).$(Build).$(Revision)" />
</Target>
<!-- Generate the assembly info with the revision -->
<Target Name="AssemblyInfo" DependsOnTargets="GetLocalVersion">
<Message Text="Building Version: $(Major).$(Minor).$(Build).$(Revision)" />
<!-- Write the assembly information to the file -->
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="AssemblyVersion\s*\(\s*".*"\s*\)\s*\]" ReplacementText="AssemblyVersion("$(Major).$(Minor).$(Build).$(Revision)")]" />
<FileUpdate Files="@(AssemblyInfoFiles)" Regex="AssemblyFileVersion\s*\(\s*".*"\s*\)\s*\]" ReplacementText="AssemblyFileVersion("$(Major).$(Minor).$(Build).$(Revision)")]" />
<Message Text="Updating NuGet Package Versions" />
<XmlUpdate XmlFileName="%(NuGetFiles.Identity)" XPath="//package/metadata/version" Value="$(Major).$(Minor).$(Build).$(Revision)" />
</Target>
<!-- Build the program -->
<Target Name="Build" DependsOnTargets="AssemblyInfo">
<Message Text="Building Version: $(Major).$(Minor).$(Build).$(Revision)" />
<Delete Files="%(NuPackFiles.Identity)" />
<!-- Build the solution -->
<MSBuild Projects="%(SolutionFiles.Identity)" Properties="Configuration=$(Configuration)" StopOnFirstFailure="true" />
<!-- Build the NuGet Packages -->
<MakeDir Directories="Build\Output" />
<Exec Command="nuget.exe pack %(NuGetFiles.Identity) /OutputDirectory Build\Output" />
<!-- Make sure that we revert the assembly info -->
<CallTarget Targets="RevertAssemblyInfo" />
<OnError ExecuteTargets="RevertAssemblyInfo" />
</Target>
<Target Name="RevertAssemblyInfo">
<!-- Revert the Assembly Info files when complete -->
<Exec Command="hg revert --no-backup %(AssemblyInfoFiles.Identity)" Condition="Exists(%(AssemblyInfoFiles.Identity))" />
<Exec Command="hg revert --no-backup %(NuGetFiles.Identity)" Condition="Exists(%(NuGetFiles.Identity))" />
</Target>
<Import Project="packages\BuildTools.AutoBuild.1.0.17.47\tools\Build\MSBuild.Community.Tasks.Targets" />
<Import Project="packages\BuildTools.AutoBuild.1.0.17.47\tools\Build\MSBuild.Mercurial.Tasks" />
</Project>