Skip to content

Commit

Permalink
Issue #24 - First attempt at common version
Browse files Browse the repository at this point in the history
- This is the first attempt to use a common version number for all
projects, msi, and nuget packages.  Won't be able to test this properly
until all tests pass.
- Updated gitignore file to not check in BuildArtefacts
- Updated projects to use CommonAssemblyVersion and CommonWixInfo files
- Added psake build scripts
- Added build.bat file that will be used by MyGet Build Services
  • Loading branch information
gep13 committed Feb 13, 2013
1 parent e5cd91b commit 09815ac
Show file tree
Hide file tree
Showing 14 changed files with 425 additions and 355 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ _ReSharper.*
*.vspcc
*.vscc
*.vssscc
*ncrunch*
*ncrunch*
BuildArtifacts
16 changes: 16 additions & 0 deletions BuildScripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
param (
[string]$Action="default",
[switch]$Help
)
$here = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

if($Help){
try {
Get-Help "$($MyInvocation.MyCommand.Definition)" -full | Out-Host -paging
Write-Host "Available build tasks:"
psake -nologo -docs | Out-Host -paging
} catch {}
return
}

psake "$here/default.ps1" $Action
39 changes: 39 additions & 0 deletions BuildScripts/default.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
$psake.use_exit_on_error = $true
properties {
$baseDir = (Split-Path -parent $psake.build_script_dir)
#$versionTag = git describe --abbrev=0 --tags
#$version = $versionTag + "."
#$version += (git log $($version + '..') --pretty=oneline | measure-object).Count
$version = "0.1.5"
$nugetExe = "$env:ChocolateyInstall\ChocolateyInstall\nuget"
$assemblyVersionPattern = 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)'
$assemblyVersion = 'AssemblyVersion("' + $version + '")'
$wixVersionPattern = 'VersionNumber="[0-9]+(\.([0-9]+|\*)){1,3}"'
$wivVersion = 'VersionNumber="' + $version + '"'
}

Task default -depends Build
Task Build -depends Package -description 'Versions and packages'
Task Package -depends Version-Files, Build-Solution, Pack-Nuget -description 'Versions the CommonAssemblyInfo and WiX files, builds the solution, and packs the msi'

Task Version-Files -description 'Stamps the common file with the version' {
(Get-Content "$baseDir\SharedSource\Common\CommonAssemblyVersion.cs") | % {$_ -replace $assemblyVersionPattern, $assemblyVersion } | Set-Content "$baseDir\SharedSource\Common\CommonAssemblyVersion.cs"
(Get-Content "$baseDir\SharedSource\Common\CommonWixInfo.wxi") | % {$_ -replace $wixVersionPattern, $wivVersion } | Set-Content "$baseDir\SharedSource\Common\CommonWixInfo.wxi"
}

Task Build-Solution -description 'Builds the main solution for the package' {
exec { msbuild "$baseDir\Chocolatey Explorer\Chocolatey Explorer.sln" }
}


Task Pack-Nuget -description 'Packs the module and example package' {
if (Test-Path "$baseDir\BuildArtifacts") {
Remove-Item "$baseDir\BuildArtifacts" -Recurse -Force
}
if (Test-Path "$baseDir\buildPackages\*.nupkg") {
Remove-Item "$baseDir\buildPackages\*.nupkg" -Force
}

mkdir "$baseDir\BuildArtifacts"
exec { .$nugetExe pack "$baseDir\ChocolateyPackage\ChocolateyGUI\ChocolateyGUI.nuspec" -OutputDirectory "$baseDir\BuildArtifacts" -NoPackageAnalysis -version $version }
}
530 changes: 268 additions & 262 deletions Chocolatey Explorer/Chocolatey.Explorer.csproj

Large diffs are not rendered by default.

21 changes: 2 additions & 19 deletions Chocolatey Explorer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 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("ChocolateyGUI")]
[assembly: AssemblyDescription("GUI for chocolatey")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Christiaan Baes ")]
[assembly: AssemblyDescription("GUI for chocolatey")]
[assembly: AssemblyProduct("ChocolateyGUI")]
[assembly: AssemblyCopyright("Copyright © Christiaan Baes 2011")]
[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
Expand All @@ -22,15 +16,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("37cbac12-c5b9-42be-8b8d-777bcd3347d4")]

// 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("0.0.6.*")]
[assembly: AssemblyFileVersion("0.0.6.*")]
[assembly: AssemblyFileVersion("1.0.0")]
6 changes: 6 additions & 0 deletions Chocolatey.Explorer.Test/Chocolatey.Explorer.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedSource\Common\CommonAssemblyVersion.cs">
<Link>CommonAssemblyVersion.cs</Link>
</Compile>
<Compile Include="..\SharedSource\Common\CommonCopyrightInfo.cs">
<Link>CommonCopyrightInfo.cs</Link>
</Compile>
<Compile Include="IoC\TestRegistry.cs" />
<Compile Include="Model\TestPackage.cs" />
<Compile Include="Model\TestPackageVersion.cs" />
Expand Down
21 changes: 2 additions & 19 deletions Chocolatey.Explorer.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 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("Chocolatey.Explorer.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Chocolatey.Explorer.Test")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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
Expand All @@ -22,15 +16,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2c9b0b00-9658-4f5f-aecd-c455dbd0752c")]

// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
2 changes: 1 addition & 1 deletion ChocolateyPackage/ChocolateyGUI/ChocolateyGUI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>ChocolateyGUI</id>
<version>0.1.4</version>
<version>$version$</version>
<title>ChocolateyGUI</title>
<authors>Christiaan Baes</authors>
<owners>Christiaan Baes</owners>
Expand Down
4 changes: 3 additions & 1 deletion Setup_ChocolateyGUI/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="ChocolateyGUI" Language="1033" Version="0.10.4.0" Manufacturer="Baes Christiaan" UpgradeCode="f8164f91-fa5c-4789-b68d-9beb5b146155">
<?include ..\SharedSource\Common\CommonWixInfo.wxi ?>

<Product Id="*" Name="$(var.ProductName)" Language="$(var.Language)" Version="$(var.VersionNumber)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />


Expand Down
109 changes: 57 additions & 52 deletions Setup_ChocolateyGUI/Setup_ChocolateyGUI.wixproj
Original file line number Diff line number Diff line change
@@ -1,60 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WIXRoot>SharedBinaries\WiX\Current\</WIXRoot>
<WIX Condition="'$(SolutionRoot)' == ''">.\..\$(WIXRoot)</WIX>
<WIX Condition="'$(SolutionRoot)' != ''">$(SolutionRoot)\$(WIXRoot)</WIX>
<WixTargetsPath Condition="'$(WixTargetsPath)' == ''">$(WIX)Wix.targets</WixTargetsPath>
<WixCATargetsPath Condition="'$(WixCATargetsPath)' == ''">$(WIX)Wix.ca.targets</WixCATargetsPath>
<WixToolPath Condition="'$(WixToolPath)' == ''">$(WIX)tools\</WixToolPath>
<!-- Relative to the targets file that defines the UsingTask element is defined -->
<WixTasksPath>tools\WixTasks.dll</WixTasksPath>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.7</ProductVersion>
<ProjectGuid>1772c1e5-8896-4e28-933a-9413eb588a82</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Setup_ChocolateyGUI</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\ChocolateyPackage\ChocolateyGUI\tools\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<SuppressPdbOutput>True</SuppressPdbOutput>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Chocolatey Explorer\Chocolatey.Explorer.csproj">
<Name>Chocolatey.Explorer</Name>
<Project>{44d4bf09-b14f-4241-9cb7-02b26027f4ab}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixNetFxExtension">
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WIXRoot>SharedBinaries\WiX\Current\</WIXRoot>
<WIX Condition="'$(SolutionRoot)' == ''">.\..\$(WIXRoot)</WIX>
<WIX Condition="'$(SolutionRoot)' != ''">$(SolutionRoot)\$(WIXRoot)</WIX>
<WixTargetsPath Condition="'$(WixTargetsPath)' == ''">$(WIX)Wix.targets</WixTargetsPath>
<WixCATargetsPath Condition="'$(WixCATargetsPath)' == ''">$(WIX)Wix.ca.targets</WixCATargetsPath>
<WixToolPath Condition="'$(WixToolPath)' == ''">$(WIX)tools\</WixToolPath>
<!-- Relative to the targets file that defines the UsingTask element is defined -->
<WixTasksPath>tools\WixTasks.dll</WixTasksPath>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.7</ProductVersion>
<ProjectGuid>1772c1e5-8896-4e28-933a-9413eb588a82</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Setup_ChocolateyGUI</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\ChocolateyPackage\ChocolateyGUI\tools\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\ChocolateyPackage\ChocolateyGUI\tools\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<SuppressPdbOutput>True</SuppressPdbOutput>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Chocolatey Explorer\Chocolatey.Explorer.csproj">
<Name>Chocolatey.Explorer</Name>
<Project>{44d4bf09-b14f-4241-9cb7-02b26027f4ab}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixNetFxExtension">
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Content Include="..\SharedSource\Common\CommonWixInfo.wxi">
<Link>CommonWixInfo.wxi</Link>
</Content>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
3 changes: 3 additions & 0 deletions SharedSource/Common/CommonAssemblyVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Reflection;

[assembly: AssemblyVersion("0.1.5")]
7 changes: 7 additions & 0 deletions SharedSource/Common/CommonCopyrightInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using System.Reflection;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Christiaan Baes ")]
[assembly: AssemblyCopyright("Copyright © Christiaan Baes 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
8 changes: 8 additions & 0 deletions SharedSource/Common/CommonWixInfo.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define VersionNumber="0.1.5" ?>
<?define UpgradeCode="f8164f91-fa5c-4789-b68d-9beb5b146155" ?>
<?define ProductName="ChocolateyGUI" ?>
<?define Language="1033" ?>
<?define Manufacturer="Baes Christiaan"?>
</Include>
11 changes: 11 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off

if '%1'=='/?' goto help
if '%1'=='-help' goto help
if '%1'=='-h' goto help

powershell -NoProfile -ExecutionPolicy bypass -Command "%~dp0buildscripts\build.ps1 %*"
goto :eof

:help
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0buildscripts\build.ps1' -help"

0 comments on commit 09815ac

Please sign in to comment.