Changeset 1133

Show
Ignore:
Timestamp:
12/07/07 18:48:03 (9 months ago)
Author:
richi
Message:

build process: refactored build process / could be a little bit brittle

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build.properties

    r624 r1133  
     1stubbles.base.dir=. 
    12build.base.dir=build 
    23examples.base.dir=examples 
  • trunk/build.xml

    r1128 r1133  
    11<?xml version="1.0"?> 
    2 <project name="stubbles" basedir="." default="main"> 
     2<project name="stubbles" default="main"> 
    33  <property file="build.properties" /> 
    4   <taskDef name="mySimpletest" classname="MySimpleTestTask" classpath="${project.basedir}/src/test" /> 
    5   <taskDef name="checkStyle" classname="stubCheckStyleTask" classpath="${project.basedir}/src/main/php/info/phing/tasks" /> 
     4  <taskdef name="mySimpletest" classname="MySimpleTestTask" classpath="${stubbles.base.dir}/src/test" /> 
     5  <taskdef name="checkStyle" classname="stubCheckStyleTask" classpath="${stubbles.base.dir}/src/main/php/info/phing/tasks" /> 
    66 
    77  <target name="main" if="package" depends="packagecheck"> 
    8     <phing phingfile="${build.base.dir}/${package}/build.xml" inheritAll="false" /> 
     8    <phing phingfile="${build.base.dir}/${package}/build.xml" /> 
    99  </target> 
    1010 
    1111  <target name="build" if="package" depends="packagecheck"> 
    12     <phing phingfile="${build.base.dir}/${package}/build.xml" target="build" inheritAll="false" /> 
     12    <phing phingfile="${build.base.dir}/${package}/build.xml" target="build" /> 
    1313  </target> 
    1414 
     
    2525  <!-- Setup examples --> 
    2626  <target name="setup-examples" description="Setup the included examples"> 
    27     <phing phingfile="${project.basedir}/examples/build.xml" inheritAll="false"> 
    28       <property name="javascript.srcpath" value="${project.basedir}/src/main/javascript" /> 
     27    <phing phingfile="${stubbles.base.dir}/examples/build.xml" inheritAll="false"> 
     28      <property name="javascript.srcpath" value="./src/main/javascript" /> 
    2929    </phing> 
    3030  </target> 
     
    3434      <isset property="package" /> 
    3535      <then> 
    36         <phing phingfile="${build.base.dir}/${package}/build.xml" target="test" inheritAll="false" /> 
     36        <phing phingfile="${build.base.dir}/${package}/build.xml" target="test" /> 
    3737      </then> 
    3838      <else> 
    39         <phing phingfile="${build.base.dir}/stubbles/build.xml" target="test" inheritAll="false" /> 
     39        <phing phingfile="${build.base.dir}/stubbles/build.xml" target="test" /> 
    4040      </else> 
    4141    </if> 
     
    4646      <isset property="package" /> 
    4747      <then> 
    48         <phing phingfile="${build.base.dir}/${package}/build.xml" target="test-integration" inheritAll="false" /> 
     48        <phing phingfile="${build.base.dir}/${package}/build.xml" target="test-integration" /> 
    4949      </then> 
    5050      <else> 
    51         <phing phingfile="${build.base.dir}/stubbles/build.xml" target="test-integration" inheritAll="false" /> 
     51        <phing phingfile="${build.base.dir}/stubbles/build.xml" target="test-integration" /> 
    5252      </else> 
    5353    </if> 
     
    5656  <!-- workaround for PHP_CodeSniffer bug #11886 --> 
    5757  <target name="copy-standards" description="copy stubbles standards into PHP_CodeSniffer 'Standards' dir"> 
    58     <phing phingfile="${build.base.dir}/stubbles/build.xml" target="copy-standards" inheritAll="false" /> 
     58    <phing phingfile="${build.base.dir}/stubbles/build.xml" target="copy-standards" /> 
    5959  </target> 
    6060   
    6161  <target name="check-standards" description="check coding standards"> 
    62     <phing phingfile="${build.base.dir}/stubbles/build.xml" target="check-standards" inheritAll="false" /> 
     62    <phing phingfile="${build.base.dir}/stubbles/build.xml" target="check-standards" /> 
    6363  </target> 
    6464 
     
    6969    <echo>----------------------------------</echo> 
    7070    <checkStyle failonerror="true"> 
    71       <fileset dir="${project.basedir}/src/main/php"> 
     71      <fileset dir="${stubbles.base.dir}/src/main/php"> 
    7272        <include name="**/*.php" /> 
    7373        <exclude name="**/org/simpletest/**" /> 
    7474      </fileset> 
    75       <fileset dir="${project.basedir}/src/test/php"> 
     75      <fileset dir="${stubbles.base.dir}/src/test/php"> 
    7676        <include name="**/*.php" /> 
    7777      </fileset> 
    78       <fileset dir="${project.basedir}/examples"> 
     78      <fileset dir="${stubbles.base.dir}/examples"> 
    7979        <include name="**/*.php" /> 
    8080        <exclude name="yui/**" /> 
     
    8686 
    8787  <target name="clearCache" description="Clears all cache files."> 
    88     <delete file="${project.basedir}/lib/.cache" verbose="true"/> 
     88    <delete file="${stubbles.base.dir}/lib/.cache" verbose="true"/> 
    8989    <delete> 
    90       <fileset dir="${project.basedir}/cache"> 
     90      <fileset dir="./cache"> 
    9191        <include name="**/*.cache" /> 
    9292      </fileset> 
  • trunk/build/stubbles/build.xml

    r1128 r1133  
    11<?xml version="1.0"?> 
    2 <project name="stubbles" basedir="." default="main"> 
    3   <property name="build.base.dir" value="${project.basedir}/build" /> 
    4   <property name="pkg.dir" value="${project.basedir}/../../src/main/php/net/stubbles" /> 
     2<project name="stubbles" default="main"> 
     3  <property name="build.base.dir" value="${stubbles.base.dir}/build/stubbles/build" override="true"/> 
     4  <property name="pkg.dir" value="${stubbles.base.dir}/src/main/php/net/stubbles" /> 
    55  <property name="pkg.name" value="stubbles-${version}"/> 
    66  <property name="build.src.dir" value="${build.base.dir}/${pkg.name}"/> 
    7   <taskDef name="mySimpletest" classname="MySimpleTestTask" classpath="${project.basedir}/../../src/test" /> 
    8   <taskDef name="minifyJs" classname="stubJsMinTask" classpath="${project.basedir}/../../src/main/php/info/phing/tasks" /> 
    9   <taskDef name="checkStyle" classname="stubCheckStyleTask" classpath="${project.basedir}/../../src/main/php/info/phing/tasks" /> 
    10   <taskDef name="buildStar" classname="stubStarWriterTask" classpath="${project.basedir}/../../src/main/php/info/phing/tasks" /> 
    11   <typedef name="starDecorator" classname="StarDecorator" classpath="${project.basedir}/../../src/main/php/info/phing/types" /> 
     7   
     8  <path id="phing.tasks.classpath"> 
     9    <pathelement dir="${stubbles.base.dir}/src/main/php/info/phing/tasks"/> 
     10  </path> 
     11   
     12  <taskdef name="mySimpletest" classname="MySimpleTestTask" classpathref="${stubbles.base.dir}/src/test" /> 
     13  <taskdef name="minifyJs" classname="stubJsMinTask" classpathref="phing.tasks.classpath" /> 
     14  <taskdef name="checkStyle" classname="stubCheckStyleTask" classpathref="phing.tasks.classpath" /> 
     15  <taskdef name="buildStar" classname="stubStarWriterTask" classpathref="phing.tasks.classpath" /> 
     16  <typedef name="starDecorator" classname="StarDecorator" classpath="${stubbles.base.dir}/src/main/php/info/phing/types" /> 
    1217 
    1318  <target name="main" if="version" depends="check-style,test,test-integration,build"/> 
    14  
     19   
    1520  <target name="build" if="version" depends="versioncheck,copy-files,minify-js,build-archives,tar"/> 
    1621 
     
    3439    <echo>-----------------------------</echo> 
    3540    <delete dir="${build.src.dir}"/> 
    36     <copy file="${project.basedir}/../../LICENSE" tofile="${build.src.dir}/LICENSE" /> 
     41    <copy file="${stubbles.base.dir}/LICENSE" tofile="${build.src.dir}/LICENSE" /> 
    3742    <append destFile="${build.src.dir}/VERSION">Stubbles version ${version}</append> 
    3843 
     
    4247 
    4348    <mkdir dir="${build.src.dir}/config" /> 
    44     <copy file="${project.basedir}/../../config/xsl-callbacks.ini" tofile="${build.src.dir}/config/xsl-callbacks-dist.ini" /> 
     49    <copy file="${stubbles.base.dir}/config/xsl-callbacks.ini" tofile="${build.src.dir}/config/xsl-callbacks-dist.ini" /> 
    4550     
    4651    <mkdir dir="${build.src.dir}/config/errors" /> 
    47     <copy file="${project.basedir}/../../config/errors/500.html" tofile="${build.src.dir}/config/errors/500-dist.html" /> 
     52    <copy file="${stubbles.base.dir}/config/errors/500.html" tofile="${build.src.dir}/config/errors/500-dist.html" /> 
    4853 
    4954    <mkdir dir="${build.src.dir}/config/php" /> 
    50     <copy file="${project.basedir}/../../config/php/config-dist.php" tofile="${build.src.dir}/config/php/config-dist.php" /> 
     55    <copy file="${stubbles.base.dir}/config/php/config-dist.php" tofile="${build.src.dir}/config/php/config-dist.php" /> 
    5156 
    5257    <mkdir dir="${build.src.dir}/config/xml" /> 
    53     <copy file="${project.basedir}/../../config/xml/config.xml" tofile="${build.src.dir}/config/xml/config-dist.xml" /> 
    54     <copy file="${project.basedir}/../../config/xml/interceptors.xml" tofile="${build.src.dir}/config/xml/interceptors-dist.xml" /> 
    55     <copy file="${project.basedir}/../../config/xml/logging.xml" tofile="${build.src.dir}/config/xml/logging-dist.xml" /> 
    56     <copy file="${project.basedir}/../../config/xml/processors.xml" tofile="${build.src.dir}/config/xml/processors-dist.xml" /> 
    57     <copy file="${project.basedir}/../../config/xml/rdbms.xml" tofile="${build.src.dir}/config/xml/rdbms-dist.xml" /> 
    58     <copy file="${project.basedir}/../../config/xml/json-rpc-service.xml" tofile="${build.src.dir}/config/xml/json-rpc-service-dist.xml" /> 
    59     <copy file="${project.basedir}/../../config/xml/variantmanager.xml" tofile="${build.src.dir}/config/xml/variantmanager-dist.xml" /> 
     58    <copy file="${stubbles.base.dir}/config/xml/config.xml" tofile="${build.src.dir}/config/xml/config-dist.xml" /> 
     59    <copy file="${stubbles.base.dir}/config/xml/interceptors.xml" tofile="${build.src.dir}/config/xml/interceptors-dist.xml" /> 
     60    <copy file="${stubbles.base.dir}/config/xml/logging.xml" tofile="${build.src.dir}/config/xml/logging-dist.xml" /> 
     61    <copy file="${stubbles.base.dir}/config/xml/processors.xml" tofile="${build.src.dir}/config/xml/processors-dist.xml" /> 
     62    <copy file="${stubbles.base.dir}/config/xml/rdbms.xml" tofile="${build.src.dir}/config/xml/rdbms-dist.xml" /> 
     63    <copy file="${stubbles.base.dir}/config/xml/json-rpc-service.xml" tofile="${build.src.dir}/config/xml/json-rpc-service-dist.xml" /> 
     64    <copy file="${stubbles.base.dir}/config/xml/variantmanager.xml" tofile="${build.src.dir}/config/xml/variantmanager-dist.xml" /> 
    6065 
    6166    <mkdir dir="${build.src.dir}/pages" /> 
    6267    <mkdir dir="${build.src.dir}/pages/conf" /> 
    6368    <mkdir dir="${build.src.dir}/pages/skin" /> 
    64     <copy file="${project.basedir}/../../pages/skin/default.xml" tofile="${build.src.dir}/pages/skin/default-dist.xml" /> 
     69    <copy file="${stubbles.base.dir}/pages/skin/default.xml" tofile="${build.src.dir}/pages/skin/default-dist.xml" /> 
    6570    <mkdir dir="${build.src.dir}/pages/txt" /> 
    6671 
    6772    <mkdir dir="${build.src.dir}/docroot" /> 
    68     <copy file="${project.basedir}/../../docroot/.htaccess" tofile="${build.src.dir}/docroot/.htaccess-dist" /> 
     73    <copy file="${stubbles.base.dir}/docroot/.htaccess" tofile="${build.src.dir}/docroot/.htaccess-dist" /> 
    6974    <mkdir dir="${build.src.dir}/docroot/javascript"/> 
    7075    <copy todir="${build.src.dir}/docroot/javascript"> 
    71       <fileset dir="${project.basedir}/../../src/main/javascript"> 
     76      <fileset dir="${stubbles.base.dir}/src/main/javascript"> 
    7277        <include name="**/*.js"/> 
    7378      </fileset> 
     
    7580 
    7681    <mkdir dir="${build.src.dir}/lib" /> 
    77     <copy file="${project.basedir}/../../lib/xjconf.star" tofile="${build.src.dir}/lib/xjconf.star" /> 
     82    <copy file="${stubbles.base.dir}/lib/xjconf.star" tofile="${build.src.dir}/lib/xjconf.star" /> 
    7883 
    7984    <mkdir dir="${build.src.dir}/log" /> 
     
    9297    <mkdir dir="${build.src.dir}/src/main/php/info/phing/types" /> 
    9398    <copy todir="${build.src.dir}/src/main/php/info/phing/tasks"> 
    94       <fileset dir="${project.basedir}/../../src/main/php/info/phing/tasks/"> 
     99      <fileset dir="${stubbles.base.dir}/src/main/php/info/phing/tasks/"> 
    95100        <include name="stubInitTask.php"/> 
    96101        <include name="stubGenerateJsonRpcProxiesTask.php"/> 
     
    99104      </fileset> 
    100105    </copy> 
    101     <copy file="${project.basedir}/../../src/main/resources/phing/build.xml" tofile="${build.src.dir}/build-dist.xml" /> 
    102     <copy file="${project.basedir}/../../src/main/resources/phing/build-stubbles.xml" tofile="${build.src.dir}/build-stubbles.xml" /> 
    103     <copy file="${project.basedir}/../../src/main/resources/phing/processors.xsl" tofile="${build.src.dir}/setup/processors.xsl" /> 
    104     <copy file="${project.basedir}/../../src/main/resources/phing/stubbles.sh" tofile="${build.src.dir}/stubbles.sh"> 
     106    <copy file="${stubbles.base.dir}/src/main/resources/phing/build.xml" tofile="${build.src.dir}/build-dist.xml" /> 
     107    <copy file="${stubbles.base.dir}/src/main/resources/phing/build-stubbles.xml" tofile="${build.src.dir}/build-stubbles.xml" /> 
     108    <copy file="${stubbles.base.dir}/src/main/resources/phing/processors.xsl" tofile="${build.src.dir}/setup/processors.xsl" /> 
     109    <copy file="${stubbles.base.dir}/src/main/resources/phing/stubbles.sh" tofile="${build.src.dir}/stubbles.sh"> 
    105110      <filterchain> 
    106111        <expandproperties /> 
     
    108113    </copy> 
    109114    <chmod file="${build.src.dir}/stubbles.sh" mode="0755"/> 
    110     <copy file="${project.basedir}/../../src/main/resources/phing/stubbles.bat" tofile="${build.src.dir}/stubbles.bat"> 
     115    <copy file="${stubbles.base.dir}/src/main/resources/phing/stubbles.bat" tofile="${build.src.dir}/stubbles.bat"> 
    111116      <filterchain> 
    112117        <expandproperties /> 
     
    122127    <mkdir dir="${build.src.dir}/src/main/php/net/stubbles/examples" /> 
    123128    <copy todir="${build.src.dir}/src/main/php/net/stubbles/examples"> 
    124       <fileset dir="${project.basedir}/../../src/main/php/net/stubbles/examples"> 
     129      <fileset dir="${stubbles.base.dir}/src/main/php/net/stubbles/examples"> 
    125130        <include name="**/*.php"/> 
    126131      </fileset> 
    127132    </copy> 
    128133    <copy todir="${build.src.dir}/examples"> 
    129       <fileset dir="${project.basedir}/../../examples"> 
     134      <fileset dir="${stubbles.base.dir}/examples"> 
    130135        <include name="**/*"/> 
    131136        <exclude name="**/yui/**"/> 
     
    134139      </fileset> 
    135140    </copy> 
    136     <copy file="${project.basedir}/../../examples/config/php/config-dist.php" tofile="${build.src.dir}/examples/config/php/config.php" overwrite="true"/> 
     141    <copy file="${stubbles.base.dir}/examples/config/php/config-dist.php" tofile="${build.src.dir}/examples/config/php/config.php" overwrite="true"/> 
    137142  </target> 
    138143   
     
    142147    <echo>--------------------------------</echo> 
    143148    <minifyJs targetDir="${build.src.dir}/docroot/javascript" 
    144               jsMinPath="${project.basedir}/../../lib/jsmin-1.1.0.php"> 
    145       <fileset dir="${project.basedir}/../../src/main/javascript"> 
     149              jsMinPath="${stubbles.base.dir}/lib/jsmin-1.1.0.php"> 
     150      <fileset dir="${stubbles.base.dir}/src/main/javascript"> 
    146151        <include name="**/*.js"/> 
    147152      </fileset> 
     
    153158    <echo>| Creating star files       |</echo> 
    154159    <echo>-----------------------------</echo> 
    155     <echo message="Base directory  : ${project.basedir}"/> 
     160    <echo message="Base directory  : ${stubbles.base.dir}"/> 
    156161    <echo message="Source directory: ${build.src.dir}"/> 
    157     <php expression="file_get_contents('${project.basedir}/../../src/main/php/net/stubbles/stubClassLoader.php')" returnProperty="stubClassLoader"/> 
     162    <php expression="file_get_contents('${stubbles.base.dir}/src/main/php/net/stubbles/stubClassLoader.php')" returnProperty="stubClassLoader"/> 
    158163    <buildStar buildPath="${build.src.dir}/lib/stubbles.php" 
    159164         version="${version}" 
     
    163168         copyright="Stubbles Development Team" 
    164169         preface="&lt;?php require 'star://' . __FILE__ . '?net.stubbles.star.StarClassRegistry'; ?&gt;${stubClassLoader}" 
    165          baseSrcPath="${project.basedir}/../../src/main"> 
    166       <starDecorator starId="xsl/master.xsl" dir="${project.basedir}" class="MasterXslStarFile" /> 
    167       <fileset dir="${project.basedir}/../../src/main"> 
     170         baseSrcPath="${stubbles.base.dir}/src/main"> 
     171      <starDecorator starId="xsl/master.xsl" dir="." class="MasterXslStarFile" /> 
     172      <fileset dir="${stubbles.base.dir}/src/main"> 
    168173        <include name="**/*.php" /> 
    169174        <include name="**/*.xml" /> 
     
    204209  <target name="test" description="run test suite"> 
    205210    <phingcall target="test-preparation" /> 
    206     <mySimpletest testfile="&quot;${project.basedir}/../../src/test/run.php&quot;" exit="true" /> 
     211    <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/run.php&quot;" exit="true" /> 
    207212    <!-- run two times, this time with the data cached --> 
    208     <mySimpletest testfile="&quot;${project.basedir}/../../src/test/run.php&quot;" exit="true" /> 
     213    <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/run.php&quot;" exit="true" /> 
    209214  </target> 
    210215 
    211216  <target name="test-integration"> 
    212217    <phingcall target="test-preparation" /> 
    213     <mySimpletest testfile="&quot;${project.basedir}/../../src/test/runIntegration.php&quot;" exit="true" /> 
     218    <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/runIntegration.php&quot;" exit="true" /> 
    214219    <!-- run two times, this time with the data cached --> 
    215     <mySimpletest testfile="&quot;${project.basedir}/../../src/test/runIntegration.php&quot;" exit="true" /> 
     220    <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/runIntegration.php&quot;" exit="true" /> 
    216221  </target> 
    217222 
    218223  <target name="test-preparation" description="Some preparations before running the tests."> 
    219     <delete file="${project.basedir}/../../lib/.cache" verbose="true"/> 
     224    <delete file="${stubbles.base.dir}/lib/.cache" verbose="true"/> 
    220225    <delete> 
    221       <fileset dir="${project.basedir}/../../cache"> 
     226      <fileset dir="${stubbles.base.dir}/cache"> 
    222227        <include name="**/*.cache" /> 
    223228      </fileset> 
     
    231236    <echo>----------------------------------</echo> 
    232237    <php expression="exec('pear config-get php_dir');" returnProperty="pearDir"/> 
    233     <property name="codeSniffer.standardsDir" value="${pearDir}/PHP/CodeSniffer/Standards/stubbles"/> 
     238    <property name="codeSniffer.standardsDir" value="${pearDir}/PHP/CodeSniffer/Standards/Stubbles"/> 
    234239    <delete dir="${codeSniffer.standardsDir}" failonerror="true" /> 
    235240    <copy toDir="${codeSniffer.standardsDir}" overwrite="true"> 
    236       <fileset dir="${project.basedir}/../../src/main/php/org/stubbles/codeSniffer/stubbles">  
     241      <fileset dir="${stubbles.base.dir}/src/main/php/org/stubbles/codeSniffer/stubbles">  
    237242        <include name="**/*.php" /> 
    238243      </fileset> 
     
    245250    <echo>----------------------------------</echo> 
    246251    <input propertyname="namespace" promptChar=":">which stubbles namespace should be checked</input> 
    247     <exec command="phpcs --standard=stubbles ${project.basedir}/../../src/main/php/net/stubbles/${namespace}" passthru="true"/> 
     252    <exec command="phpcs --standard=stubbles ${stubbles.base.dir}/src/main/php/net/stubbles/${namespace}" passthru="true"/> 
    248253  </target> 
    249254   
     
    254259    <echo>----------------------------------</echo> 
    255260    <checkStyle failonerror="true"> 
    256       <fileset dir="${project.basedir}/../../src/main/php"> 
     261      <fileset dir="${stubbles.base.dir}/src/main/php"> 
    257262        <include name="**/*.php" /> 
    258263        <exclude name="**/org/simpletest/**" /> 
  • trunk/src/main/php/info/phing/tasks/stubStarWriterTask.php

    r953 r1133  
    1414 * Uses stubbles star classes 
    1515 */ 
    16 require_once '../../config/php/config.php'; 
     16require_once 'config/php/config.php'; 
    1717require stubConfig::getSourcePath() . '/php/net/stubbles/star/StarException.php'; 
    1818require stubConfig::getSourcePath() . '/php/net/stubbles/star/StarFile.php'; 
     
    203203        // reasons the properties of the decorator are not set when it is 
    204204        // added to the task 
     205 
     206        // works now with refactored buildfile 
     207        /* 
    205208        $decorators = array(); 
    206209        foreach ($this->decorators as $decorator) { 
    207210            $decorators[$decorator->getStarId()] = $decorator; 
    208211        } 
     212        */ 
    209213 
    210214        $starArchive = new StarArchive(new StarWriter($this->buildPath));