<?xml version="1.0"?>
<project name="MinimalAddin" default="build">

  <property name="output.dir" value="../../../bin" />
  <property name="output.dll" value="../../../bin/MaxTimeDecorator.dll"/>
  <property name="test.dll" value="../../../bin/MaxTimeDecoratorTests.dll"/>

  <target name="clean">
    <delete file="${output.dll}" />
    <delete file="${test.dll}" />
  </target>

  <target name="build">
    <mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" />
    <copy file="../../../../bin/nunit.framework.dll" todir="${output.dir}" 
      if="${file::exists('../../../../bin/nunit.framework.dll')}" />
    <copy file="../../../../bin/nunit.core.interfaces.dll" todir="${output.dir}" 
      if="${file::exists('../../../../bin/nunit.core.interfaces.dll')}" />
    <copy file="../../../../bin/nunit.core.interfaces.dll" todir="${output.dir}" 
      if="${file::exists('../../../../bin/nunit.core.dll')}" />

    <csc target="library" output="${output.dll}">
      <sources>
        <include name="*.cs"/>
      </sources>
      <references basedir="${output.dir}">
        <include name="nunit.core.interfaces.dll" />
        <include name="nunit.core.dll" />
      </references>
    </csc>

    <csc target="library" output="${test.dll}">
      <sources>
        <include name="Tests/*.cs"/>
      </sources>
      <references basedir="${output.dir}">
        <include name="nunit.framework.dll" />
        <include name="MaxTimeDecorator.dll"/>
      </references>
    </csc>
  </target>

  <target name="rebuild" depends="clean,build" />

  <target name="package">
    <copy todir="${package.samples.dir}/Extensibility/Core/MaxTimeDecorator">
      <fileset basedir=".">
        <include name="MaxTimeDecorator.csproj" />
        <include name="MaxTimeDecorator.build" />
        <include name="AssemblyInfo.cs" />
        <include name="MaxTimeAttribute.cs" />
        <include name="MaxTimeDecorator.cs" />
        <include name="MaxTimeTestCase.cs" />
        <include name="Tests/MaxTimeDecoratorTests.csproj" />
        <include name="Tests/AssemblyInfo.cs" />
        <include name="Tests/MaxTimeDecoratorTests.cs" />
      </fileset>
    </copy>

    <xmlpoke 
      file="${package.samples.dir}/Extensibility/Core/MaxTimeDecorator/MaxTimeDecorator.csproj"
      xpath="/VisualStudioProject/CSHARP/Build/References/Reference[@Name='nunit.core']/@HintPath"
      value="..\..\..\..\bin\nunit.core.dll" />

    <xmlpoke 
      file="${package.samples.dir}/Extensibility/Core/MaxTimeDecorator/MaxTimeDecorator.csproj"
      xpath="/VisualStudioProject/CSHARP/Build/References/Reference[@Name='nunit.core.interfaces']/@HintPath"
      value="..\..\..\..\bin\nunit.core.interfaces.dll" />

    <xmlpoke 
      file="${package.samples.dir}/Extensibility/Core/MaxTimeDecorator/Tests/MaxTimeDecoratorTests.csproj"
      xpath="/VisualStudioProject/CSHARP/Build/References/Reference[@Name='nunit.framework']/@HintPath"
      value="..\..\..\..\..\bin\nunit.framework.dll" />
  </target>

</project>