Skip to content

Commit

Permalink
Add a build script (msbuild)
Browse files Browse the repository at this point in the history
- Script does clean, compile, unit test run, and NuGet packaging
- Introduce a SharedAssemblyInfo file that can be generated by the build script for sharing common assembly information across projects (including version number)
- Also added a unit tests project with a dummy test to prove that test running was working
  • Loading branch information
LukeTillman committed Apr 10, 2014
1 parent 7f21a22 commit d819985
Show file tree
Hide file tree
Showing 77 changed files with 11,753 additions and 350 deletions.
3 changes: 3 additions & 0 deletions build/.gitignore
@@ -0,0 +1,3 @@
# Ignore build output folders
[Tt]estresults/
[Pp]ackages/
2 changes: 2 additions & 0 deletions build/Build.bat
@@ -0,0 +1,2 @@
@echo off
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.proj /v:m %*
35 changes: 21 additions & 14 deletions build/CassandraCSharpDriver.nuspec
@@ -1,17 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>CassandraCSharpDriver</id>
<version>2.0.1</version>
<title>Datastax C# Driver for Apache Cassandra</title>
<authors>Datastax</authors>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://github.com/datastax/csharp-driver</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>A C# client driver for Apache Cassandra. This driver works exclusively with
the Cassandra Query Language version 3 (CQL3) and the CQL Native Protocol available from Cassandra 1.2.</description>
<releaseNotes />
<copyright>Copyright (C) 2013 DataStax Inc.</copyright>
<tags>cassandra apache datastax driver database nosql</tags>
</metadata>
<metadata>
<id>CassandraCSharpDriver</id>
<version>2.0.1</version>
<title>Datastax C# Driver for Apache Cassandra</title>
<authors>Datastax</authors>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://github.com/datastax/csharp-driver</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>
A C# client driver for Apache Cassandra. This driver works exclusively with the Cassandra Query Language version 3 (CQL3) and the CQL Native Protocol available from Cassandra 1.2.
</description>
<releaseNotes />
<copyright>Copyright (C) 2013 DataStax Inc.</copyright>
<tags>cassandra apache datastax driver database nosql</tags>
</metadata>
<files>
<file src="Cassandra\bin\Release\Cassandra.*" target="lib\net40" />
<file src="Cassandra.Data\bin\Release\Cassandra.Data.*" target="lib\net40" />
<file src="Cassandra.Data.Linq\bin\Release\Cassandra.Data.Linq.*" target="lib\net40" />
<file src="Cassandra.DSE\bin\Release\Cassandra.DSE.*" target="lib\net40" />
</files>
</package>
3 changes: 3 additions & 0 deletions build/ClickToBuild.bat
@@ -0,0 +1,3 @@
@echo off
call build.bat
pause
102 changes: 102 additions & 0 deletions build/build.proj
@@ -0,0 +1,102 @@
<Project DefaultTargets="local" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Add some tasks from MSBuild Community Tasks project -->
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Git.GitVersion" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.AssemblyInfo" />

<PropertyGroup>
<!-- Define some base paths -->
<BaseFolder>..</BaseFolder>
<SourceFolder>$(BaseFolder)\src</SourceFolder>
<ToolsFolder>$(BaseFolder)\tools</ToolsFolder>
<BuildFolder>$(BaseFolder)\build</BuildFolder>

<!-- Paths for build output -->
<TestResultsFolder>$(BuildFolder)\testresults</TestResultsFolder>
<PackagesFolder>$(BuildFolder)\packages</PackagesFolder>

<!-- Specific Tools -->
<NuGet>$(ToolsFolder)\nuget.exe</NuGet>
<NUnit>$(SourceFolder)\packages\NUnit.Runners.2.6.3\tools\nunit-console.exe</NUnit>
<MSBuildCommunityTasksLib>$(ToolsFolder)\MSBuildTasks.1.4.0.65\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>

<!-- Other properties -->
<Version>2.0.1</Version>
<SharedAssemblyInfo>$(SourceFolder)\SharedAssemblyInfo.cs</SharedAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<!-- Projects to Build -->
<AllProjects Include="$(SourceFolder)\**\*.csproj" />

<!-- NuGet spec files which will be used to create packages -->
<NuSpecFiles Include="$(BuildFolder)\*.nuspec" />
</ItemGroup>

<!--
These are the top level targets, meant to be invoked by msbuild. Ways to invoke:
local - runs the build and unit tests
full - runs local, plus does packaging (useful if testing packaging)
ci - runs full, plus updates assemblies with a shared version number (meant to be run from a CI server)
-->
<Target Name="local" DependsOnTargets="compile;test" />
<Target Name="full" DependsOnTargets="local;package" />
<Target Name="ci" DependsOnTargets="generate_assembly_info;full"/>

<!-- Cleans output folders, projects -->
<Target Name="clean">
<Message Text="Cleaning build output folders" Importance="high" />
<RemoveDir Directories="$(TestResultsFolder)" ContinueOnError="true" />
<RemoveDir Directories="$(PackagesFolder)" ContinueOnError="true" />

<Message Text="Cleaning projects" Importance="high" />
<MSBuild Projects="@(AllProjects)" Targets="clean" StopOnFirstFailure="true" Properties="Configuration=Release" />
</Target>

<!-- Compiles code -->
<Target Name="compile" DependsOnTargets="clean">
<Message Text="Compiling projects" Importance="high" />
<MSBuild Projects="@(AllProjects)" Targets="build" StopOnFirstFailure="true" Properties="Configuration=Release" />
</Target>

<!-- Creates nuget package(s) -->
<Target Name="package" DependsOnTargets="compile">
<Message Text="Creating NuGet package(s)" Importance="high" />
<MakeDir Directories="$(PackagesFolder)" />
<Exec Command="$(NuGet) pack %(NuSpecFiles.FullPath) -basepath $(SourceFolder) -o $(PackagesFolder) -version $(Version) -symbols" />
</Target>

<!-- Runs unit tests -->
<Target Name="test" DependsOnTargets="compile">
<Message Text="Running unit tests" Importance="high" />
<MakeDir Directories="$(TestResultsFolder)" />
<Exec Command="$(NUnit) $(SourceFolder)\Cassandra.Tests\bin\Release\Cassandra.Tests.dll /labels /nologo /framework=net-4.0 /xml=&quot;$(TestResultsFolder)\Cassandra.Tests.xml&quot; /out=&quot;$(TestResultsFolder)\Cassandra.Tests.txt&quot;" />
</Target>

<!-- Creates a shared assembly info file so that all assemblies get some common attributes (like version number) -->
<Target Name="generate_assembly_info">
<PropertyGroup>
<GitHash />
</PropertyGroup>

<!-- Require that the BUILD_NUMBER environment variable is present (should be set automatically by Jenkins) -->
<Error Condition="$(BUILD_NUMBER) == ''" Text="The BUILD_NUMBER environment variable is not set." />

<!-- Get the Git commit hash and put it into the GitHash property -->
<GitVersion LocalPath="$(MSBuildProjectDirectory)">
<Output TaskParameter="CommitHash" PropertyName="GitHash" />
</GitVersion>

<!-- Generate the shared assembly info file -->
<AssemblyInfo
OutputFile="$(SharedAssemblyInfo)"
CodeLanguage ="CS"
AssemblyCompany="DataStax"
AssemblyProduct="Cassandra .NET Driver"
ComVisible="false"
AssemblyCopyright="Copyright © $([System.DateTime]::UtcNow.Year) by DataStax"
AssemblyVersion="$(Version)"
AssemblyInformationalVersion="$(Version) (git $(GitHash))"
AssemblyFileVersion="$(Version).$(BUILD_NUMBER)" />
</Target>

</Project>
17 changes: 0 additions & 17 deletions build/make.bat

This file was deleted.

118 changes: 0 additions & 118 deletions build/readme.txt

This file was deleted.

4 changes: 4 additions & 0 deletions src/.nuget/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit.Runners" version="2.6.3" />
</packages>
3 changes: 3 additions & 0 deletions src/Cassandra.DSE/Cassandra.DSE.csproj
Expand Up @@ -42,6 +42,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="DseAuthProvider.cs" />
<Compile Include="KerberosAuthenticator.SSPI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
35 changes: 4 additions & 31 deletions src/Cassandra.DSE/Properties/AssemblyInfo.cs
@@ -1,36 +1,9 @@
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("Cassandra.Data")]
[assembly: AssemblyDescription("Datastax C# DSE Extensions for Apache Cassandra")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Datastax")]
[assembly: AssemblyProduct("CassandraCSharpDriver")]
[assembly: AssemblyCopyright("Copyright (coffee) Datastax 2012")]
[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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// See the SharedAssemblyInfo.cs file for information shared by all assemblies
[assembly: AssemblyTitle("Cassandra.DSE")]
[assembly: AssemblyDescription("DataStax .NET DSE Extensions for Apache Cassandra")]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("064f850a-21d3-4671-9e57-cb9b90db717c")]

// 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("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: Guid("064f850a-21d3-4671-9e57-cb9b90db717c")]
3 changes: 3 additions & 0 deletions src/Cassandra.Data.Linq/Cassandra.Data.Linq.csproj
Expand Up @@ -37,6 +37,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AllowFilteringAttribute.cs" />
<Compile Include="Batch.cs" />
<Compile Include="BatchV1.cs" />
Expand Down

0 comments on commit d819985

Please sign in to comment.