This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
IntegratedBuild.proj
94 lines (80 loc) · 4.48 KB
/
IntegratedBuild.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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>1.1.0</VersionPrefix>
<TestsEnabled>true</TestsEnabled>
<SolutionDir>$(MSBuildProjectDirectory)\src\</SolutionDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(APPVEYOR)' != '' ">
<VersionControlInfo>$(APPVEYOR_REPO_COMMIT) ($(APPVEYOR_REPO_BRANCH))</VersionControlInfo>
<BuildNumber>$(APPVEYOR_BUILD_NUMBER)</BuildNumber>
</PropertyGroup>
<PropertyGroup Condition=" '$(TRAVIS)' == 'true' ">
<VersionControlInfo>$(TRAVIS_COMMIT) ($(TRAVIS_BRANCH))</VersionControlInfo>
<BuildNumber>$(TRAVIS_BUILD_NUMBER)</BuildNumber>
</PropertyGroup>
<PropertyGroup>
<VersionControlInfo Condition=" '$(VersionControlInfo)' == '' ">(unknown version control revision)</VersionControlInfo>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
<AssemblyVersion>$(VersionPrefix).$(BuildNumber)</AssemblyVersion>
<VersionSuffix>build$(BuildNumber)</VersionSuffix>
<PackageVersion>$(VersionPrefix)</PackageVersion>
<PackageVersion Condition=" '$(VersionSuffix)' != '' ">$(PackageVersion)-$(VersionSuffix)</PackageVersion>
<AssemblyInformationalVersion>$(PackageVersion) $(VersionControlInfo)</AssemblyInformationalVersion>
</PropertyGroup>
<ItemGroup>
<VersionInfoContent Include="[assembly: global::System.Reflection.AssemblyVersionAttribute("$(AssemblyVersion)")]"/>
<VersionInfoContent Include="[assembly: global::System.Reflection.AssemblyFileVersionAttribute("$(AssemblyVersion)")]"/>
<VersionInfoContent Include="[assembly: global::System.Reflection.AssemblyInformationalVersionAttribute("$(AssemblyInformationalVersion)")]"/>
</ItemGroup>
<Target Name="Build" DependsOnTargets="Clean;RestoreSolutionPackages;GenerateVersionInfo;Compile;Test;Package"/>
<Target Name="Clean">
<ItemGroup>
<Trash Include="build\**\*" />
<Trash Include="$(SolutionDir)*\bin\**\*" />
<Trash Include="$(SolutionDir)*\obj\**\*" />
</ItemGroup>
<Delete Files="@(Trash)"/>
</Target>
<Target Name="RestoreSolutionPackages" DependsOnTargets="DownloadNuGetCommandLineClient">
<Exec Command="$(NuGetCommand) restore $(SolutionDir) -NonInteractive"/>
</Target>
<Target Name="Compile">
<ItemGroup>
<Solution Include="$(SolutionDir)*.sln"/>
</ItemGroup>
<MSBuild Projects="@(Solution)" Targets="Build" Properties="Configuration=Debug"/>
<MSBuild Projects="@(Solution)" Targets="Build" Properties="Configuration=Release"/>
</Target>
<Target Name="Test" Condition=" '$(TestsEnabled)' == 'true' ">
<ItemGroup>
<NUnitRunner Include="$(SolutionDir)packages\NUnit.Runners.*\tools\nunit-console.exe"/>
</ItemGroup>
<Error Text="No NUnit test runner package found in $(SolutionDir)packages." Condition=" '@(NUnitRunner)' == '' "/>
<CreateProperty Value=""%(NUnitRunner.Identity)"" Condition=" '$(OS)' == 'Windows_NT' ">
<Output TaskParameter="Value" PropertyName="NUnitRunnerCommand"/>
</CreateProperty>
<CreateProperty Value="mono --runtime=v4.0.30319 "%(NUnitRunner.Identity)"" Condition=" '$(OS)' != 'Windows_NT' ">
<Output TaskParameter="Value" PropertyName="NUnitRunnerCommand"/>
</CreateProperty>
<Message Text="Using test runner $(NUnitRunnerCommand)"/>
<ItemGroup>
<TestAssembly Include="$(SolutionDir)*/bin/Debug/*Test*.dll"/>
</ItemGroup>
<Exec Command="$(NUnitRunnerCommand) @(TestAssembly -> '"%(FullPath)"', ' ') -noshadow"/>
</Target>
<Target Name="Package">
<MakeDir Directories="build/artifacts"/>
<Exec Command="$(NuGetCommand) pack -o $(MSBuildProjectDirectory)/build/artifacts -Properties Configuration=Release -Version "$(PackageVersion)" -NoPackageAnalysis"/>
</Target>
<Target Name="GenerateVersionInfo">
<MakeDir Directories="build/artifacts"/>
<WriteLinesToFile File="build/VersionInfo.cs" Lines="@(VersionInfoContent)" Overwrite="true"/>
<Message Text="PackageVersion: $(PackageVersion)"/>
<Message Text="AssemblyVersion: $(AssemblyVersion)"/>
<Message Text="AssemblyInformationalVersion: $(AssemblyInformationalVersion)"/>
<Copy SourceFiles="build/VersionInfo.cs" DestinationFiles="build/artifacts/VersionInfo-$(BuildNumber).cs"/>
<Message Text="To repeat this build: git checkout $(TRAVIS_COMMIT); msbuild /p:TRAVIS=true,TRAVIS_COMMIT=$(TRAVIS_COMMIT),TRAVIS_BRANCH=$(TRAVIS_BRANCH),TRAVIS_BUILD_NUMBER=$(TRAVIS_BUILD_NUMBER)"/>
</Target>
<Import Project="NuGet.targets"/>
</Project>