Appendix J. File Formats

J.1 Build File Format

The following XML file shows a basic Phing build file skeleton that can be used as a starting point for your own build files. See the references in Appendix A, Fact Sheet and Appendix B, Core tasks for more detailed information on properties and tasks.

<?xml version="1.0" encoding="UTF-8"?>

<!--
  =========================================================================
  The root tag of each build file must be a "project" tag.
  =========================================================================
-->
<project name="(projectname)" basedir="(projectbasedir)"
         default="(targetname)" description="(projectdescription)">

  <!--
    =========================================================================
    Inclusion of optional overall project properties.
    =========================================================================
  -->
  <property file="(main property file)" />

  <!--
    =========================================================================
     Build file wide properties used in the targets below
    =========================================================================
  -->

  <!-- Useful to make the current buildtime available as a property -->
  <tstamp>
      <!-- Format is, e.g. Sat, 03 Oct 2009, 16:31 -->
      <format property="buildtime" pattern="%a, %d %b %Y, %H:%M"/>
  </tstamp>

  <property name="(first.property1)"  value="(value1)" override="true" />
  <property name="(second.property2)"  value="(value2)" override="true" />

  <!--
    =========================================================================
    Type and task calls here, i.e. filesets, patternsets,
    CopyTask calls etc.
    =========================================================================
  -->
    <!-- Filesets  -->
    <fileset dir="(fileset.directory)" id="(fileset.reference)">
        <include name="(include.pattern)"/>
    </fileset>

    <!-- Custom tasks  -->
    <taskdef classname="(task.classname)" name="task.name" />

  <!--
    =========================================================================
    All target definitions
    ("if" and "unless" attributes are optional)
    =========================================================================
  -->
  <target name="(targetname)" [depends="targetname1,targetname2"]
          [if="(ifproperty)"] [unless="(unlessproperty)"] >
    <!--
      ----------------------------------------------------------------------
      Type and task calls here, i.e. filesets, patternsets,
      CopyTask calls, etc.
      ----------------------------------------------------------------------
    -->
  </target>

  <!--
    =========================================================================
    More targets here
    =========================================================================
  -->
  <target name="..." >
    <!--
      ----------------------------------------------------------------------
      Type and task calls here, i.e. filesets, patternsets,
      CopyTask calls, etc.
      ----------------------------------------------------------------------
    -->

  </target>
</project>

Note

By convention properties are named in dot notation in Phing build files, e.g. ftp.upload, temp.builddir and so on