<?xml version="1.0"?>

<!-- use this file to set the paths to the required tools
     TortoiseSVN needs to build everything.

     first make a copy of this file and rename the copy to
     default.build.user
     then check the TODO comments and adjust the paths in
     the "value" field if necessary.

     Note: if you followed the instructions in build.txt,
     the build script should automatically use the correct
     paths.
-->

<project name="ToolPaths" default="env">

  <!-- ====================================================================== -->
  <!-- These two targets have to exist in doc.build.user                      -->
  <!-- ====================================================================== -->

  <target name="VSNET" description="Checks if the env variables for VS.NET2010 are set">
    <if test="${not environment::variable-exists('VCINSTALLDIR')}">
      <fail>You must first call "%VS100COMNTOOLS%\vsvars32.bat"</fail>
    </if>
    <!-- Uncomment the line below to allow limited building using VC Express instead of VS.NET. -->
    <!-- <property name="buildtool" value="vcexpress.exe" /> -->

    <!-- Uncomment and modify the path of the statement below if you're building
         a version of TSVN which uses a different working copy format than
         the working copy you have checked out. -->
    <!-- <property name="SubWCRevFileName" value="C:\Program Files\TortoiseSVN\bin\SubWCRev.exe"/> -->

  </target>

  <target name="env" depends="VSNET">
    <!--
      WiX3 installer already sets an environment variable to
      its target folder. We need to move it to the \bin folder
      conditionally as "manual" installations   might not have
      that sub-folder.
    -->

    <if test="${not environment::variable-exists('WIX')}">
      <setenv>
        <!--
          TODO: change path value, if WIX is not defined
        -->
        <variable name="WIX" value="C:\WiX" />
      </setenv>
    </if>
    <if test="${file::exists(environment::get-variable('WIX') + '\bin\candle.exe')}">
      <setenv>
        <variable name="WIX" value="%WIX%\bin" />
      </setenv>
    </if>

    <!--
      Tools should be in ".\Tools" but you may set the TSVNTOOLS
      environment variable instead. If both isn't the case,
      modify the hard-coded path accordingly.
    -->

    <if test="${not environment::variable-exists('TSVNTOOLS')}">
      <setenv>
        <variable name="TSVNTOOLS" value="${project::get-base-directory() + '\Tools'}" />
      </setenv>
    </if>
    <if test="${not file::exists(environment::get-variable('TSVNTOOLS') + '\hhc.exe')}">
      <setenv>
        <!--
          TODO: change path value, if neither TSVNTOOLS is defined
          nor have tools be copied directly below the TSVN root.
        -->
        <variable name="TSVNTOOLS" value="C:\Tools" />
      </setenv>
    </if>

    <!-- when creating the msi for a release, the task can also
         zip all debug symbols. To do that, specify the path to
         7zip here -->
    <property name="sevenzip" value="c:\program files\7-zip\7z.exe" />
    
    <!--
      Update environment & we are good to go.
    -->

    <setenv>
      <variable name="PATH" value="%TSVNTOOLS%\;%PATH%" />
      <variable name="PATH" value="%TSVNTOOLS%\fop;%PATH%" />
      <variable name="PATH" value="%WIX%;%PATH%" />
      <variable name="WIXUI" value="%WIX%" />
      <variable name="HHLOC" value="%TSVNTOOLS%\hhc.exe" />
      <variable name="XSLROOT" value="%TSVNTOOLS%\xsl" />
      <variable name="DEBUGTOOLS" value="C:\Program Files (x86)\Debugging Tools for Windows (x86)" />
    </setenv>
  </target>
</project>

