Skip to content

Commit

Permalink
use gitversion to determine the version number
Browse files Browse the repository at this point in the history
NOTE: this introduces a requirement that nuget restore is called on
      the solution before the build script will run, as the script
      imports a targets file brought down in the GitVersionTask
      package

    - go.cmd has been updated to call this explicitly

    - teamcity will be configured to do the same

    - this avoids checking in the GitVersionTask binaries
  • Loading branch information
dalpert-korewireless committed Jan 14, 2017
1 parent 5f8cee2 commit a102aa1
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 41 deletions.
2 changes: 1 addition & 1 deletion build/EasyHttp.nuspec
Expand Up @@ -18,6 +18,6 @@
</dependencies>
</metadata>
<files>
<file src="..\src\EasyHttp\bin\Release\EasyHttp.*" target="lib\net40" />
<file src="..\src\EasyHttp\bin\$configuration$\EasyHttp.*" target="lib\net40" />
</files>
</package>
46 changes: 34 additions & 12 deletions build/build.proj
Expand Up @@ -2,33 +2,55 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CIBuild">

<PropertyGroup>
<Version>0.0.0.1</Version>
<BuildConfiguration>Debug</BuildConfiguration>

<RootDir>$(MSBuildFileThisDirectory)..\</RootDir>
<SourceDir>$(RootDir)src\</SourceDir>
<PackageDir>$(SourceDir)packages\</PackageDir>
<RootDir>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)..\"))</RootDir>
<SoultionDir>$(RootDir)src\</SoultionDir>
<PackagesDir>$(SoultionDir)packages\</PackagesDir>
<BinDir>$(RootDir)Bin\</BinDir>

<MSpecConsoleRunner>$(PackageDir)Machine.Specifications.0.5.10\tools\mspec-x86-clr4.exe</MSpecConsoleRunner>
<NugetExe>$(SourceDir).nuget\nuget.exe</NugetExe>
<VersionStemFile>$(RootDir)version.txt</VersionStemFile>

<MSpecConsoleRunner>$(PackagesDir)Machine.Specifications.0.5.10\tools\mspec-x86-clr4.exe</MSpecConsoleRunner>
<NugetExe>$(SoultionDir).nuget\nuget.exe</NugetExe>
<NuspecFile>$(MSBuildFileThisDirectory)EasyHttp.nuspec</NuspecFile>
</PropertyGroup>

<Target Name="CIBuild" DependsOnTargets="$(CIBuild_DependsOn)"/>
<Target Name="Next" DependsOnTargets="$(Next_DependsOn)"/>

<ItemGroup>
<Solution Include="$(SourceDir)EasyHttp.sln"/>
<Solution Include="$(SoultionDir)EasyHttp.sln"/>
</ItemGroup>

<Import Project="$(PackagesDir)GitVersionTask.3.6.5\build\dotnet\GitVersionTask.targets"/>

<PropertyGroup>
<CIBuild_DependsOn>
<!-- Step 1 --> Build;
<!-- Step 2 --> RunTests;
<!-- Step 3 --> BuildPackage;
GetVersion; <!-- from GitVersionTask.targets -->
Describe; <!-- self-documenting -->
Build; <!-- Step 1 -->
RunTests; <!-- Step 2 -->
BuildPackage; <!-- Step 3 -->
</CIBuild_DependsOn>
</PropertyGroup>

<Target Name="Describe" DependsOnTargets="GetVersion">
<Message Text=" RootDir: $(RootDir)"/>
<Message Text=" SourceDir: $(SoultionDir)"/>
<Message Text=" PackageDir: $(PackagesDir)"/>
<Message Text=" BinDir: $(BinDir)"/>
<Message Text=""/>
<Message Text=" BuildConfiguration: $(BuildConfiguration)"/>
<Message Text=" BranchName: $(GitVersion_BranchName)"/>
<Message Text=""/>
<Message Text=" AssemblySemVer: $(GitVersion_AssemblySemVer)"/>
<Message Text=" FullSemVer: $(GitVersion_FullSemVer)"/>
<Message Text="InformationalVersion: $(GitVersion_InformationalVersion)"/>
<Message Text=""/>
<Message Text=" NugetVersion: $(GitVersion_NugetVersion)"/>
</Target>

<Target Name="Build">
<MSBuild Projects="%(Solution.Identity)"
Targets="Rebuild"
Expand All @@ -37,7 +59,7 @@

<Target Name="RunTests">
<ItemGroup>
<TestAssemblies Include="$(SourceDir)EasyHttp.Specs\bin\$(BuildConfiguration)\EasyHttp.Specs.dll"/>
<TestAssemblies Include="$(SoultionDir)EasyHttp.Specs\bin\$(BuildConfiguration)\EasyHttp.Specs.dll"/>
</ItemGroup>

<PropertyGroup>
Expand All @@ -49,7 +71,7 @@

<Target Name="BuildPackage">
<PropertyGroup>
<cmd>"$(NugetExe)" pack "$(NuspecFile)" -Properties Configuration=$(BuildConfiguration) -Version $(Version)</cmd>
<cmd>"$(NugetExe)" pack "$(NuspecFile)" -Properties Configuration=$(BuildConfiguration) -Version $(GitVersion_NugetVersion)</cmd>
</PropertyGroup>

<Exec Command="$(cmd)"/>
Expand Down
1 change: 1 addition & 0 deletions go.cmd
@@ -1 +1,2 @@
src\.nuget\nuget.exe restore src\EasyHttp.sln
msbuild build\build.proj
3 changes: 3 additions & 0 deletions src/EasyHttp.Specs/EasyHttp.Specs.csproj
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>edaf544e</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -142,7 +143,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets'))" />
</Target>
<Import Project="..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
1 change: 1 addition & 0 deletions src/EasyHttp.Specs/packages.config
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitVersionTask" version="3.6.5" targetFramework="net40" developmentDependency="true" />
<package id="JsonFx" version="2.0.1209.2802" targetFramework="net40" />
<package id="Machine.Specifications" version="0.5.7" />
<package id="Machine.Specifications" version="0.5.10" targetFramework="net40" />
Expand Down
2 changes: 1 addition & 1 deletion src/EasyHttp.sln
Expand Up @@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1E909D
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{50BFC87E-51D5-4EF8-B3F0-63DED1F151E6}"
Expand All @@ -19,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{50BFC8
..\build\EasyHttp.nuspec = ..\build\EasyHttp.nuspec
..\go.cmd = ..\go.cmd
..\build\logo.png = ..\build\logo.png
..\version.txt = ..\version.txt
EndProjectSection
EndProject
Global
Expand Down
7 changes: 6 additions & 1 deletion src/EasyHttp/EasyHttp.csproj
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>a224e9f0</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -95,7 +96,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Expand All @@ -104,7 +107,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets'))" />
</Target>
<Import Project="..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.6.5\build\portable-net+sl+win+wpa+wp\GitVersionTask.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
42 changes: 16 additions & 26 deletions src/EasyHttp/Properties/AssemblyInfo.cs
@@ -1,10 +1,10 @@
#region License
// Distributed under the BSD License
// =================================
//
//
// Copyright (c) 2010, Hadi Hariri
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
Expand All @@ -15,7 +15,7 @@
// * Neither the name of Hadi Hariri nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand All @@ -27,26 +27,26 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// =============================================================
//
//
//
//
// Parts of this Software use JsonFX Serialization Library which is distributed under the MIT License:
//
//
// Distributed under the terms of an MIT-style license:
//
//
// The MIT License
//
//
// Copyright (c) 2006-2009 Stephen M. McKamey
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -60,7 +60,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EasyHttp")]
Expand All @@ -72,24 +72,14 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a75f86cc-b989-4128-9589-64f345d75a72")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.*")]
// Version information for an assembly managed by GitVersionTask

[assembly: CLSCompliant(true)]
1 change: 1 addition & 0 deletions src/EasyHttp/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitVersionTask" version="3.6.5" targetFramework="net40" developmentDependency="true" />
<package id="JsonFx" version="2.0.1209.2802" targetFramework="net40" />
</packages>

0 comments on commit a102aa1

Please sign in to comment.