Skip to content

Commit

Permalink
Modified build:
Browse files Browse the repository at this point in the history
(1) SharedBuildAssemblyInfo.cs is added to git and reverted after build or fail
(2) Added git.exe to tools for reverting target
(3) Echoed build.version to teamcity according to ninject2
  • Loading branch information
danielmarbach committed Jun 6, 2010
1 parent a439aa2 commit f911894
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
18 changes: 15 additions & 3 deletions Ninject.build
Expand Up @@ -6,15 +6,18 @@
<property name="path.bin.tests" value="${path.bin}/tests"/>
<property name="path.lib" value="${path.base}/lib"/>
<property name="path.dist" value="${path.base}/dist"/>
<property name="path.build.assemblyinfo" value="${path.src}/${build.asminfo}" dynamic="true"/>
<property name="path.src" value="${path.base}/src"/>
<property name="path.tools" value="${path.base}/tools"/>
<property name="path.tools.nunit" value="${path.tools}/nunit"/>
<property name="path.tools.git" value="${path.tools}/git"/>

<property name="version" value="1.5.0.0" overwrite="false"/>
<property name="version.major" value="${version::get-major(version::parse(version))}" dynamic="true"/>
<property name="version.minor" value="${version::get-minor(version::parse(version))}" dynamic="true"/>
<property name="version.build" value="${version::get-build(version::parse(version))}" dynamic="true"/>
<property name="version.revision" value="${version::get-revision(version::parse(version))}" dynamic="true"/>
<property name="version.revision" value="${version::get-revision(version::parse(version))}" dynamic="true" unless="${environment::variable-exists('BUILD_NUMBER')}"/>
<property name="version.revision" value="${environment::get-variable('BUILD_NUMBER')}" dynamic="true" if="${environment::variable-exists('BUILD_NUMBER')}"/>
<property name="build.version" value="${version.major}.${version.minor}.${version.build}.${version.revision}" dynamic="true"/>

<property name="package" value="false" readonly="false" overwrite="false"/>
Expand Down Expand Up @@ -69,7 +72,8 @@
</target>

<target name="create-assembly-info">
<asminfo output="${path.src}/${build.asminfo}" language="CSharp">
<echo message="##teamcity[buildNumber '${build.version}']" />
<asminfo output="${path.build.assemblyinfo}" language="CSharp">
<imports>
<import namespace="System"/>
<import namespace="System.Reflection"/>
Expand All @@ -78,7 +82,7 @@
<attributes>
<attribute type="AssemblyProductAttribute" value="Ninject: Dependency Injector for .NET"/>
<attribute type="AssemblyCompanyAttribute" value="Enkari, Ltd. and contributors"/>
<attribute type="AssemblyCopyrightAttribute" value="Copyright ©2007-2009, Enkari, Ltd. and contributors"/>
<attribute type="AssemblyCopyrightAttribute" value="Copyright ©2007-2010, Enkari, Ltd. and contributors"/>
<attribute type="AssemblyVersionAttribute" value="${build.version}"/>
<attribute type="ComVisibleAttribute" value="false"/>
<attribute type="CLSCompliantAttribute" value="true"/>
Expand Down Expand Up @@ -706,5 +710,13 @@
</fileset>
</zip>
</target>

<target name="revert">
<echo message="Reverting version info"/>
<exec
program="${path.tools.git}/git.exe"
commandline='checkout "${path.build.assemblyinfo}"'
failonerror="false"/>
</target>

</project>
23 changes: 21 additions & 2 deletions build.cmd
@@ -1,2 +1,21 @@
@echo off
tools\nant\nant.exe -buildfile:ninject.build %1 %2 %3 %4 %5 %6 %7 %8
@echo off
set nantfile=Ninject.build
set nantexe=tools\nant\nant.exe

%nantexe% -buildfile:%nantfile% %1 %2 %3 %4 %5 %6 %7 %8
IF ERRORLEVEL 1 GOTO Failed

%nantexe% -buildfile:%nantfile% -q -nologo revert
IF ERRORLEVEL 1 GOTO Failed

echo "Release build completed."
GOTO End

:Failed
%nantexe% -buildfile:%nantfile% -q -nologo revert
echo "============================================================"
echo "BUILD FAILED"
echo "============================================================"

:End
pause
21 changes: 21 additions & 0 deletions src/SharedBuildAssemblyInfo.cs
@@ -0,0 +1,21 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;

//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: AssemblyProductAttribute("Ninject: Dependency Injector for .NET")]
[assembly: AssemblyCompanyAttribute("Enkari, Ltd. and contributors")]
[assembly: AssemblyCopyrightAttribute("Copyright ©2007-2010, Enkari, Ltd. and contributors")]
[assembly: AssemblyVersionAttribute("1.5.0.0")]
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(true)]

Binary file added tools/git/git.exe
Binary file not shown.
Binary file added tools/git/libiconv2.dll
Binary file not shown.
Binary file added tools/git/pthreadGC2.dll
Binary file not shown.

0 comments on commit f911894

Please sign in to comment.