Changeset 195

Show
Ignore:
Timestamp:
06/14/07 15:44:13 (1 year ago)
Author:
mrook
Message:

Update buildfile examples (closes issue #100)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/phing_guide/book/chapters/GettingStarted.html

    r182 r195  
    5858 
    5959<project name="FooBar" default="dist" basedir="."> 
    60  
    61   <target name="prepare"> 
    62     <echo msg="Preparing build..." /> 
    63     <mkdir dir="./build" /> 
    64   </target> 
    65  
    66   <target name="build" depends="prepare"> 
    67     <echo>Building...</echo> 
    68     <copy file="./src/File.php" to="./build/File.php"/> 
    69     <copy file="./src/File2.php" to="./build/File2.php"/> 
    70   </target> 
    71  
    72   <target name="dist" depends="build"> 
    73     <echo message="Creating archive..." /> 
    74     <tar outfile="furbee.tar.gz" basedir="./build"/> 
    75   </target> 
    76  
    77   <target name="clean"> 
    78     <echo msg="Cleaning up..."/> 
    79     <delete file="./build"/> 
    80   </target> 
     60    <target name="prepare"> 
     61        <echo msg="Making directory ./build" /> 
     62        <mkdir dir="./build" /> 
     63    </target> 
     64 
     65    <target name="build" depends="prepare"> 
     66        <echo msg="Copying files to build directory..." /> 
     67 
     68        <echo msg="Copying ./about.php to ./build directory..." /> 
     69        <copy file="./about.php" tofile="./build/about.php" /> 
     70 
     71        <echo msg="Copying ./browsers.php to ./build directory..." /> 
     72        <copy file="./browsers.php" tofile="./build/browsers.php" /> 
     73 
     74        <echo msg="Copying ./contact.php to ./build directory..." /> 
     75        <copy file="./contact.php" tofile="./build/contact.php" /> 
     76    </target> 
     77 
     78    <target name="dist" depends="build"> 
     79        <echo msg="Creating archive..." /> 
     80 
     81        <tar destfile="./build/build.tar.gz" compression="gzip"> 
     82            <fileset dir="./build"> 
     83                <include name="*" /> 
     84            </fileset> 
     85        </tar> 
     86 
     87        <echo msg="Files copied and compressed in build directory OK!" /> 
     88    </target> 
    8189</project> 
    8290</pre> 
     
    270278 
    271279&lt;project name=&quot;testsite&quot; basedir=&quot;.&quot; default=&quot;main&quot;&gt; 
    272  
    273   &lt;property environment=&quot;env&quot;/&gt; 
    274  
    275   &lt;property file=&quot;${env.BCHOME}/build.properties&quot;/&gt; 
    276  
    277   &lt;property name=&quot;package&quot;  value=&quot;${phing.project.name}&quot; override=&quot;true&quot; /&gt; 
    278   &lt;property name=&quot;builddir&quot; value=&quot;${env.BCHOME}/build/testsite&quot; override=&quot;true&quot; /&gt; 
    279   &lt;property name=&quot;srcdir&quot;   value=&quot;${project.basedir}&quot; override=&quot;true&quot; /&gt; 
    280  
    281   &lt;!-- Fileset for all files --&gt; 
    282   &lt;fileset dir=&quot;.&quot; id=&quot;allfiles&quot;&gt; 
    283     &lt;include name=&quot;**&quot;&gt; 
    284   &lt;/fileset&gt; 
    285  
    286   &lt;!-- Main Target --&gt; 
    287   &lt;target name=&quot;main&quot; description=&quot;main target&quot;&gt; 
    288     &lt;copy todir=&quot;${builddir}&quot;&gt; 
    289       &lt;fileset refid=&quot;allfiles&quot; /&gt; 
    290     &lt;/copy&gt; 
    291   &lt;/target&gt; 
    292  
    293  
    294   &lt;!-- Rebuild --&gt; 
    295   &lt;target name=&quot;rebuild&quot; description=&quot;rebuilds this package&quot;&gt; 
    296     &lt;delete dir=&quot;${builddir}&quot; /&gt; 
    297     &lt;phingcall target=&quot;main&quot;/&gt; 
    298   &lt;/target&gt; 
     280    &lt;property file=&quot;./build.properties&quot; /&gt; 
     281 
     282    &lt;property name=&quot;package&quot;  value=&quot;${phing.project.name}&quot; override=&quot;true&quot; /&gt; 
     283    &lt;property name=&quot;builddir&quot; value=&quot;./build/testsite&quot; override=&quot;true&quot; /&gt; 
     284    &lt;property name=&quot;srcdir&quot;   value=&quot;${project.basedir}&quot; override=&quot;true&quot; /&gt; 
     285 
     286    &lt;!-- Fileset for all files --&gt; 
     287    &lt;fileset dir=&quot;.&quot; id=&quot;allfiles&quot;&gt; 
     288        &lt;include name=&quot;**&quot; /&gt; 
     289    &lt;/fileset&gt; 
     290 
     291    &lt;!-- Main Target --&gt; 
     292    &lt;target name=&quot;main&quot; description=&quot;main target&quot;&gt; 
     293        &lt;copy todir=&quot;${builddir}&quot;&gt; 
     294            &lt;fileset refid=&quot;allfiles&quot; /&gt; 
     295        &lt;/copy&gt; 
     296    &lt;/target&gt; 
     297 
     298    &lt;!-- Rebuild --&gt; 
     299    &lt;target name=&quot;rebuild&quot; description=&quot;rebuilds this package&quot;&gt; 
     300        &lt;delete dir=&quot;${builddir}&quot; /&gt; 
     301        &lt;phingcall target=&quot;main&quot; /&gt; 
     302    &lt;/target&gt; 
    299303&lt;/project&gt; 
    300304</pre> 
     
    306310</p> 
    307311 
    308 <p> The first five tags within the <em>project</em> tag define properties. They 
    309   appear in the three ways this tag can occur: </p> 
     312<p> The first five four within the <em>project</em> tag define properties. They 
     313  appear in the two ways this tag can occur: </p> 
    310314<ul> 
    311   <li>The first occurrence of the <em>property</em> tag only contains the <em>environment</em> 
    312     tag. This way, it makes all environment variables available as &quot;<em>env.VARIABLE_NAME</em>&quot;.</li> 
    313315  <li>The second <em>property</em> tag contains only the <em>file</em> attribute. 
    314316    The value has to be a relative or absolute path to a property file (for the