root/trunk/build.xml

Revision 2333, 26.1 kB (checked in by wei, 11 months ago)

update prado-dao build.

  • Property svn:keywords set to Id
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3  PRADO 3.1 build file - Copyright (C) 2006 PradoSoft
4
5  Requirements
6  ============
7  xdebug >= 2.0.0beta4
8-->
9<project name="prado" basedir="." default="help">
10  <taskdef name="prado-version-check" classname="PradoVersionTask" classpath="buildscripts/phing/tasks"/>
11  <taskdef name="prado-doc" classname="PradoDocTask" classpath="buildscripts/phing/tasks"/>
12<!--  <taskdef name="prado-pear" classname="PradoPearTask" classpath="buildscripts/phing/tasks"/>-->
13  <taskdef name="prado-quickstart-index" classname="QuickstartIndexTask" classpath="buildscripts/phing/tasks"/>
14  <taskdef name="prado-api-index" classname="ManualIndexTask" classpath="buildscripts/phing/tasks"/>
15<!--  <taskdef name="prado-test" classname="PradoTestTask" classpath="buildscripts/phing/tasks"/>-->
16  <taskdef name="compact-package" classname="PradoPackageTask" classpath="buildscripts/phing/tasks"/>
17  <taskdef name="prado-quickstart-docs" classname="PradoQuickStartDocs" classpath="buildscripts/phing/tasks" />
18
19  <!-- generates ${prado.version} and ${prado.revision} -->
20  <prado-version-check />
21
22  <!-- these are required external commands -->
23  <property name="php" value="php" /> <!-- PHP parser -->
24  <property name="hhc" value="hhc" /> <!-- compile phpdoc into CHM -->
25  <property name="pdflatex" value="pdflatex" />  <!-- generates PDF from LaTex -->
26  <property name="zip" value="zip" />  <!-- zip compression -->
27
28  <property name="pkgname" value="${phing.project.name}-${prado.version}.r${prado.revision}"/>
29
30  <property name="compact-strip-comments" value="false" />
31
32  <property name="build.base.dir" value="build"/>
33  <property name="build.dist.dir" value="${build.base.dir}/dist"/>
34  <property name="build.src.dir" value="${build.base.dir}/${pkgname}"/>
35  <property name="build.doc.dir" value="${build.base.dir}/docs"/>
36  <property name="build.pear.dir" value="${build.base.dir}/pear"/>
37  <property name="build.web.dir" value="${build.base.dir}/web"/>
38  <property name="build.test.dir" value="${build.base.dir}/test-reports"/>
39  <property name="build.coverage.dir" value="${build.base.dir}/code-coverage"/>
40  <property name="build.snapshot.dir" value="${build.base.dir}/snapshot"/>
41  <property name="build.compact.dir" value="${build.base.dir}/${pkgname}/compact" />
42
43  <!--
44      All Source Files in framework
45  -->
46  <fileset dir="." id="framework">
47    <exclude name="**/.svn"/>
48    <exclude name="**/*.bak"/>
49    <exclude name="**/*~"/>
50    <exclude name="**/pradolite.php" /><!-- will be generated -->
51    <exclude name="**/prado-cli.php" /><!-- will be copied later -->
52    <include name="framework/**/*"/>
53  </fileset>
54
55  <!--
56      Surrounding files
57  -->
58  <fileset dir="." id="misc">
59    <exclude name="**/.svn"/>
60    <exclude name="**/*.bak"/>
61    <exclude name="**/*~"/>
62    <include name="COPYRIGHT"/>
63    <include name="HISTORY"/>
64    <include name="UPGRADE"/>
65    <include name="index.html"/>
66    <include name="requirements/*"/>
67  </fileset>
68
69  <!--
70      Documentation ????
71  -->
72  <fileset dir="." id="docs">
73    <exclude name="**/.svn"/>
74    <exclude name="**/*.bak"/>
75    <exclude name="**/*~"/>
76    <exclude name="**/latex" />
77    <exclude name="**/sqlmap_tut.pdf" />
78    <include name="docs/specs/*"/>
79    <include name="docs/sqlmap/sqlmap.pdf" />
80  </fileset>
81
82  <!--
83      Demos
84  -->
85  <fileset dir="." id="demos">
86    <exclude name="**/.svn"/>
87    <exclude name="**/*.bak"/>
88    <exclude name="**/*~"/>
89    <exclude name="**/runtime/*"/>
90    <exclude name="**/assets/*"/>
91    <exclude name="**/runtime/*/**"/>
92    <exclude name="**/assets/*/**"/>
93    <exclude name="demos/blog/protected/Data/Blog.db" />
94    <include name="demos/address-book/**/*"/>
95    <include name="demos/blog/**/*"/>
96    <include name="demos/blog-tutorial/**/*"/>
97    <include name="demos/chat/**/*"/>
98    <include name="demos/composer/**/*"/>
99    <include name="demos/currency-converter/**/*"/>
100    <include name="demos/helloworld/**/*"/>
101    <include name="demos/northwind-db/**/*"/>
102    <include name="demos/personal/**/*"/>
103    <include name="demos/quickstart/**/*"/>
104    <include name="demos/soap/**/*"/>
105    <include name="demos/sqlmap/**/*"/>
106    <include name="demos/time-tracker/**/*"/>
107  </fileset>
108
109  <!--
110                Test tools
111        -->
112  <fileset dir="." id="test-tools">
113    <include name="tests/test_tools/**/*"/>
114  </fileset>
115
116  <!--
117      Writable files and directories
118  -->
119  <fileset dir="." id="writables">
120    <include name="${build.src.dir}/demos/**/runtime" />
121    <include name="${build.src.dir}/demos/**/assets" />
122    <include name="${build.src.dir}/demos/blog/protected/Data" />
123  </fileset>
124
125  <target name="help">
126    <echo>
127
128    Welcome to use PRADO build script!
129    ----------------------------------
130    You may use the following command format to build a target:
131
132              phing   &lt;target name&gt;
133
134    where &lt;target name&gt; can be one of the following:
135
136    For all PRADO developers:
137    - test    : run unit tests (results are under /build/test-reports);
138
139    For PRADO release manager:
140    - dist    : create release files;
141    - build   : prepare a directory for distribution;
142    - clean   : clean up the build directory;
143    - rebuild : clean first and then build;
144    - docs    : generate documentation;
145    - pear    : generate PEAR packages;
146    - snapshot: generate nightly snapshot;
147    </echo>
148  </target>
149
150<!-- bulid compact prado package definitions -->
151
152  <target name="compact-collections" description="Collections">
153    <mkdir dir="${build.compact.dir}" />
154        <mkdir dir="${build.compact.dir}/docs" />
155        <mkdir dir="${build.compact.dir}/prado-dao" />
156    <compact-package output="${build.compact.dir}/prado-dao/collections.php" strip="${compact-strip-comments}">
157      <filelist dir="framework" files="PradoBase.php,TComponent.php,Exceptions/TException.php,interfaces.php" />
158      <filelist dir="framework/Collections" files="TList.php,TMap.php,TAttributeCollection.php,TPagedList.php,TPagedDataSource.php" />
159    </compact-package>
160    <delete file="${build.compact.dir}/prado-dao/messages.txt" />
161    <copy file="framework/Exceptions/messages/messages.txt" tofile="${build.compact.dir}/prado-dao/messages.txt" />
162    <copy file="COPYRIGHT" tofile="${build.compact.dir}/COPYRIGHT" />
163    <copy file="HISTORY" tofile="${build.compact.dir}/HISTORY" />
164    <delete file="${build.compact.dir}/readme.txt" />
165    <append destFile="${build.compact.dir}/readme.txt">PRADO Framework for PHP 5, version ${prado.version}. See docs/ directory for documentation.</append>
166
167        <prado-quickstart-docs output="${build.compact.dir}/docs"
168                pages="Advanced/Collections.page,Fundamentals/Components.page"/>
169  </target>
170
171  <target name="compact-db" description="Database" depends="compact-collections">
172    <compact-package output="${build.compact.dir}/prado-dao/db.php"  strip="${compact-strip-comments}">
173      <filelist dir="framework/Data"
174        files="TDbConnection.php, TDbCommand.php, TDbDataReader.php, TDbTransaction.php"/>
175      <filelist dir="framework/Data/Common"
176        files="TDbTableInfo.php, TDbTableColumn.php, TDbCommandBuilder.php, TDbMetaData.php" />
177    </compact-package>
178        <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/DAO.page" />
179  </target>
180
181  <target name="compact-db-sqlite" description="Sqlite Database" depends="compact-db">
182    <compact-package output="${build.compact.dir}/prado-dao/db-sqlite.php"  strip="${compact-strip-comments}">
183      <filelist dir="framework/Data/Common/Sqlite"
184        files="TSqliteCommandBuilder.php,TSqliteMetaData.php,TSqliteTableColumn.php,TSqliteTableInfo.php" />
185    </compact-package>
186  </target>
187
188  <target name="compact-db-mysql" description="Mysql Database" depends="compact-db">
189    <compact-package output="${build.compact.dir}/prado-dao/db-mysql.php"  strip="${compact-strip-comments}">
190      <filelist dir="framework/Data/Common/Mysql"
191        files="TMysqlCommandBuilder.php,TMysqlMetaData.php,TMysqlTableColumn.php,TMysqlTableInfo.php" />
192    </compact-package>
193  </target>
194
195  <target name="compact-db-pgsql" description="Pgsql Database" depends="compact-db">
196    <compact-package output="${build.compact.dir}/prado-dao/db-pgsql.php" strip="${compact-strip-comments}">
197      <filelist dir="framework/Data/Common/Pgsql"
198        files="TPgsqlCommandBuilder.php,TPgsqlMetaData.php,TPgsqlTableColumn.php,TPgsqlTableInfo.php" />
199    </compact-package>
200  </target>
201
202  <target name="compact-db-mssql" description="Mssql Database" depends="compact-db">
203    <compact-package output="${build.compact.dir}/prado-dao/db-mssql.php" strip="${compact-strip-comments}">
204      <filelist dir="framework/Data/Common/Mssql"
205        files="TMssqlCommandBuilder.php,TMssqlMetaData.php,TMssqlTableColumn.php,TMssqlTableInfo.php" />
206    </compact-package>
207  </target>
208
209  <!-- all the db common classes and drivers -->
210  <target name="compact-db-all" depends="compact-db-sqlite,compact-db-mysql,compact-db-pgsql,compact-db-mssql" />
211
212  <target name="compact-table-gateway" description="Package Active Record" depends="compact-db-all">
213    <compact-package output="${build.compact.dir}/prado-dao/table-gateway.php" strip="${compact-strip-comments}">
214      <filelist dir="framework/Data/DataGateway"
215        files="TDataGatewayCommand.php, TSqlCriteria.php, TTableGateway.php"/>
216    </compact-package>
217  </target>
218
219  <target name="compact-active-record" description="Package Active Record" depends="compact-table-gateway">
220    <compact-package output="${build.compact.dir}/prado-dao/active-record.php" strip="${compact-strip-comments}">
221      <filelist dir="framework/Data/ActiveRecord"
222        files="TActiveRecord.php,TActiveRecordManager.php,Exceptions/TActiveRecordException.php,TActiveRecordCriteria.php,TActiveRecordGateway.php" />
223      <filelist dir="framework/Data/ActiveRecord/Relations"
224        files="TActiveRecordRelation.php,TActiveRecordRelationContext.php,TActiveRecordHasOne.php,TActiveRecordHasManyAssociation.php,TActiveRecordHasMany.php,TActiveRecordBelongsTo.php" />
225    </compact-package>
226    <append file="framework/Data/ActiveRecord/Exceptions/messages.txt"
227      destfile="${build.compact.dir}/prado-dao/messages.txt" />
228        <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/ActiveRecord.page" />
229  </target>
230
231  <target name="compact-sqlmap" description="Package SqlMap" depends="compact-db-all">
232    <compact-package output="${build.compact.dir}/prado-dao/sqlmap.php" strip="${compact-strip-comments}">
233      <filelist dir="framework/Data/SqlMap" files="TSqlMapManager.php,TSqlMapGateway.php" />
234      <filelist dir="framework/Data/SqlMap/DataMapper"
235        files="TSqlMapException.php,TSqlMapTypeHandlerRegistry.php,TSqlMapCache.php,TPropertyAccess.php,TLazyLoadList.php,TSqlMapPagedList.php"/>
236      <filelist dir="framework/Data/SqlMap/Configuration"
237        files="TSqlMapStatement.php,TDiscriminator.php,TInlineParameterMapParser.php,TParameterMap.php,TParameterProperty.php,TResultMap.php,TResultProperty.php,TSimpleDynamicParser.php,TSqlMapCacheModel.php,TSqlMapXmlConfiguration.php" />
238      <filelist dir="framework/Data/SqlMap/Statements"
239        files="IMappedStatement.php,TMappedStatement.php,TCachingStatement.php,TUpdateMappedStatement.php,TDeleteMappedStatement.php,TInsertMappedStatement.php,TPreparedCommand.php,TPreparedStatement.php,TPreparedStatementFactory.php,TSelectMappedStatement.php,TSimpleDynamicSql.php,TStaticSql.php"/>
240    </compact-package>
241    <append file="framework/Data/SqlMap/DataMapper/messages.txt"
242      destfile="${build.compact.dir}/prado-dao/messages.txt" />
243        <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/SqlMap.page" />
244  </target>
245
246  <target name="compact-northwind" description="Northwind example">
247        <copy todir="${build.compact.dir}/examples">
248          <fileset dir="demos/northwind-db/protected/" >
249                <include name="database/**/*"/>
250                <include name="data/**/*"/>
251          </fileset>
252        </copy>
253    <delete file="${build.compact.dir}/examples/example.php" />
254        <append destfile="${build.compact.dir}/examples/example.php"><![CDATA[<?php
255
256include('../prado-dao/collections.php');
257include('../prado-dao/db.php');
258include('../prado-dao/db-sqlite.php');
259include('../prado-dao/table-gateway.php');
260include('../prado-dao/active-record.php');
261include('../prado-dao/sqlmap.php');
262
263$sqlite_dir = './data';
264$sqlite_db = $sqlite_dir.'/Northwind.db';
265if(!is_file($sqlite_db))
266        die("Unable to find database file $sqlite_db");
267if(!is_writable($sqlite_dir))
268        die("Please make sure that the directory $sqlite_dir is writable by PHP process.");
269if(!is_writable($sqlite_db))
270        die("Please make sure that the sqlite database file $sqlite_db is writable by PHP process.");
271
272//add directory "database" for autoload
273$class_dir = realpath(dirname(__FILE__).'/database');
274set_include_path(get_include_path().PATH_SEPARATOR.$class_dir);
275spl_autoload_register(array('PradoBase', 'autoload'));
276//other forms of auto load may be used.
277
278$conn = new TDbConnection("sqlite:$sqlite_db");
279//set default database connection
280TActiveRecordManager::getInstance()->setDbConnection($conn);
281
282//start playing
283
284foreach(Employee::finder()->findAll() as $employee)
285        var_dump($employee->LastName);
286
287//fetch all regions and its territories.
288foreach(Region::finder()->withTerritories()->findAll() as $region)
289{
290        var_dump($region->RegionDescription);
291        foreach($region->Territories as $territory)
292                var_dump($territory->TerritoryDescription);
293}
294
295//sqlmap example
296$manager = new TSqlMapManager($conn);
297$manager->configureXml('./database/sqlmap.xml');
298$sqlmap = $manager->getSqlMapGateway();
299
300var_dump($sqlmap->queryForList('products-with-price', 50));
301
302//similar query, but not identical
303//Product::finder()->withCategory()->findAll('UnitPrice < ?', 50)
304
305?>]]></append>
306  </target>
307  <target name="compact-dao" description="All packages" depends="compact-active-record,compact-sqlmap,compact-northwind" />
308
309<!-- end compact packaging -->
310
311  <target name="build" description="Building standard PRADO package v${prado.version}.${prado.revision}">
312    <echo>Building pradolite.php...</echo>
313    <delete file="framework/pradolite.php"/>
314    <exec command="${php} build.php" dir="buildscripts/phpbuilder" passthru="true"/>
315
316    <echo>Copying files to build directory...</echo>
317    <copy todir="${build.src.dir}">
318      <fileset refid="demos"/>
319      <fileset refid="docs"/>
320      <fileset refid="framework"/>
321      <fileset refid="misc"/>
322          <fileset refid="test-tools" />
323    </copy>
324
325    <copy file="buildscripts/classtree/DWExtensionReadme.txt" tofile="${build.src.dir}/editors/Dreamweaver/readme.txt" />
326    <copy file="framework/pradolite.php" tofile="${build.src.dir}/framework/pradolite.php" />
327    <copy file="framework/prado-cli.php" tofile="${build.src.dir}/framework/prado-cli.php" />
328
329    <echo>Changing file permissions...</echo>
330    <chmod mode="0777">
331      <fileset refid="writables" />
332    </chmod>
333
334    <echo>Building quickstart demo search indices...</echo>
335    <prado-quickstart-index todir="${build.src.dir}/demos/quickstart/protected/index/quickstart" />
336  </target>
337
338  <target name="clean">
339    <echo>Cleaning up the mess</echo>
340    <delete dir="${build.base.dir}"/>
341  </target>
342
343  <target name="rebuild" depends="clean,build" />
344
345  <target name="docs" depends="build">
346        <echo>Build PDF + CHM + HTML Docs, it may take about 30 mins</echo>
347
348        <echo>Building quickstart.pdf...</echo>
349    <delete>
350      <fileset dir=".">
351        <include name="buildscripts/texbuilder/quickstart/*.aux" />
352      </fileset>
353    </delete>
354    <exec command="${php} build.php" dir="buildscripts/texbuilder/quickstart" passthru="true"/>
355    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder/quickstart" passthru="true"/>
356    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder/quickstart" passthru="true"/>
357    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder/quickstart" passthru="true"/>
358    <move file="buildscripts/texbuilder/quickstart/quickstart.pdf" todir="${build.doc.dir}"/>
359
360        <echo>Building API manuals...</echo>
361    <delete dir="${build.doc.dir}/manual"/>
362    <mkdir dir="${build.doc.dir}/manual" />
363    <prado-doc phpdoc="${php} buildscripts/PhpDocumentor/phpdoc"
364               title="PRADO v${prado.version} API Manual"
365               destdir="${build.doc.dir}/manual"
366               sourcepath="${build.src.dir}/framework"
367               ignorelist="*pradolite.php,*prado-cli.php,*3rdParty/*,*Javascripts/*,*I18N/core/*"
368               output="HTML:frames:default,CHM:default:default,HTML:Smarty:PradoSoft" />
369
370    <echo>Indexing API manuals...</echo>
371    <prado-api-index docdir="${build.doc.dir}/manual/HTMLSmartyConverter" todir="${build.doc.dir}/manual/HTMLSmartyConverter" />
372
373    <copy file="buildscripts/index/search.php" todir="${build.doc.dir}/manual/HTMLSmartyConverter" />
374
375        <exec command="${php} build.php" dir="buildscripts/classtree" passthru="true"/>
376
377        <echo>Generating CHM Content (Quickstart + ClassDocs)</echo>
378        <exec command="${php} build.php" dir="buildscripts/chmbuilder" passthru="true"/>
379        <!-- done on project website
380        <echo>Generating CHM Content (WIKI)</echo>
381        <exec command="${php} build.php" dir="buildscripts/wikibuilder" passthru="true"/>
382        -->
383    <if>
384      <equals arg1="${prado.winbuild}" arg2="true"/>
385      <then>
386        <exec command="${hhc} ${build.doc.dir}/prado3_manual.hhp" />
387      </then>
388    </if>
389  </target>
390
391  <target name="dist" depends="rebuild,docs">
392    <echo>Moving doc files to build...</echo>
393    <mkdir dir="${build.dist.dir}" />
394    <move file="${build.doc.dir}/quickstart.pdf" todir="${build.src.dir}/docs" />
395    <move todir="${build.src.dir}/docs/manual">
396      <fileset dir="${build.doc.dir}/manual/HTMLframesConverter">
397        <include name="**/**" />
398      </fileset>
399    </move>
400    <if>
401      <equals arg1="${prado.winbuild}" arg2="true"/>
402      <then>
403        <move file="${build.doc.dir}/prado3_manual.chm" tofile="${build.src.dir}/docs/prado3_manual.chm" />
404      </then>
405    </if>
406
407    <echo>Generating compressed distribution files...</echo>
408    <if>
409      <equals arg1="${prado.winbuild}" arg2="false"/>
410      <then>
411        <exec command="tar czvf ${pkgname}.tar.gz ${pkgname}" dir="${build.base.dir}"/>
412        <move file="${build.base.dir}/${pkgname}.tar.gz" todir="${build.dist.dir}" />
413      </then>
414    </if>
415
416    <!--
417    <exec command="zip ${pkgname}.zip -r ${pkgname}" dir="${build.base.dir}" />
418    <move file="${build.base.dir}/${pkgname}.zip" todir="${build.dist.dir}" />
419    -->
420
421        <echo>Generating files for pradosoft.com...</echo>
422    <echo>Compiling class docs...</echo>
423    <exec command="${php} build.php" dir="buildscripts/classtree" passthru="true"/>
424    <move file="buildscripts/classtree/classes.data" todir="${build.web.dir}/protected/Data" />
425
426    <echo>Moving HTML docs to Web folder...</echo>
427    <mkdir dir="${build.web.dir}" />
428    <move todir="${build.web.dir}/docs/manual">
429      <fileset dir="${build.doc.dir}/manual/HTMLSmartyConverter">
430        <include name="**/**" />
431      </fileset>
432    </move>
433
434    <echo>
435
436
437                   Distribution Not Completed Yet!!!
438
439The following steps need to be manually performed in order to complete
440the PRADO distribution:
441
4421. Package DreamWeaver extension by running DW extension manager with
443   buildscripts/classtree/PRADO.mxi and saving the generated file as
444   "${build.src.dir}/editors/Dreamweaver/PRADO.mxp"
445
4462. Use winzip (on Windows) and gzip (on Linux) to generate the compressed
447   release files of the direcotry
448   "${build.src.dir}".
449
450    </echo>
451  </target>
452
453  <target name="test" description="Running unit tests">
454    <delete dir="${build.test.dir}"/>
455    <mkdir dir="${build.test.dir}"/>
456    <prado-test codecoverage="false" haltonfailure="false" haltonerror="false" printsummary="true">
457      <batchtest>
458        <fileset dir="tests/unit">
459              <include name="**/*Test.php"/>
460        </fileset>
461      </batchtest>
462      <formatter type="xml" todir="${build.test.dir}" outfile="unit-tests.xml"/>
463    </prado-test>
464    <phpunit2report infile="${build.test.dir}/unit-tests.xml" format="frames" styledir="buildscripts/phing/style" todir="${build.test.dir}"/>
465  </target>
466
467  <target name="snapshot" depends="rebuild">
468    <echo>Generating compressed distribution files...</echo>
469    <if>
470      <equals arg1="${prado.winbuild}" arg2="false"/>
471      <then>
472        <exec command="tar czvf ${pkgname}.tar.gz ${pkgname}" dir="${build.base.dir}"/>
473        <move file="${build.base.dir}/${pkgname}.tar.gz" todir="${build.dist.dir}" />
474      </then>
475    </if>
476    <exec command="zip ${pkgname}.zip -r ${pkgname}" dir="${build.base.dir}" />
477    <move file="${build.base.dir}/${pkgname}.zip" tofile="${build.snapshot.dir}/prado-latest.zip" />
478    <copy file="${build.src.dir}/HISTORY" tofile="${build.snapshot.dir}/changelog-latest.txt" />
479  </target>
480
481<!--
482  <taskdef name="phplint" classname="PhpLintTask" classpath="buildscripts/phing/tasks"/>
483  <taskdef name="xmllint" classname="XmlLintTask" classpath="buildscripts/phing/tasks"/>
484  <taskdef name="analyze" classname="ZendCodeAnalyzerTask" classpath="buildscripts/phing/tasks"/>
485  <taskdef name="pear-package" classname="BuildPradoPEARPackageTask" classpath="buildscripts/phing/tasks"/>
486
487  <target name="pear" depends="" description="Creating PEAR package">
488    <mkdir dir="${build.pear.dir}" />
489    <prado-pear pkgdir="${build.pear.dir}"
490                channel="pear.php.net"
491                version="${prado.version}"
492                state="stable"
493                category="framework"
494                package="prado"
495                summary="PRADO is a ...."
496                pkgdescription="detailed description..."
497                notes="www.pradosoft.com"
498                license="BSD"
499                />
500  </target>
501  <target name="test" description="Run unit tests">
502    <echo>Preparing directory structure</echo>
503    <delete dir="${reports.dir}"/>
504    <mkdir dir="${reports.dir}"/>
505    <delete dir="${reports.unit.dir}"/>
506    <delete dir="${reports.codecoverage.dir}"/>
507
508    <if>
509      <equals arg1="${codecoverage}" arg2="true"/>
510      <then>
511        <mkdir dir="${reports.codecoverage.dir}"/>
512        <echo>Preparing Code Coverage Database</echo>
513        <coverage-setup database="${reports.codecoverage.dir}/coverage.db">
514          <fileset dir="${src.dir}">
515            <include name="**/*.php"/>
516            <exclude name="Web/Javascripts/js/clientscripts.php"/>
517            <exclude name="Data/TCache.php"/>
518            <exclude name="DataAccess/**/*.php"/>
519            <exclude name="I18N/core/Gettext/MO.php"/>
520            <exclude name="I18N/core/Gettext/PO.php"/>
521            <exclude name="I18N/core/util.php"/>
522            <exclude name="I18N/TGlobalization.php"/>
523            <exclude name="I18N/TGlobalizationAutoDetect.php"/>
524            <exclude name="Security/TUserManager.php"/>
525            <exclude name="Security/TMembershipManager.php"/>
526            <exclude name="core.php"/>
527            <exclude name="3rdParty/**/*.php"/>
528            <exclude name="pradolite.php"/>
529            <exclude name="prado.php"/>
530          </fileset>
531        </coverage-setup>
532      </then>
533    </if>
534
535    <echo>Running Unit Tests</echo>
536    <phpunit2 codecoverage="${codecoverage}" haltonfailure="false" haltonerror="false" printsummary="true">
537      <batchtest>
538        <fileset dir="${tests.dir}">
539          <include name="**/*Test.php"/>
540        </fileset>
541      </batchtest>
542      <formatter type="xml" todir="${reports.dir}" outfile="logfile.xml"/>
543    </phpunit2>
544
545    <echo>Creating Unit Test Report</echo>
546         <mkdir dir="${reports.unit.dir}"/>
547     <phpunit2report infile="${reports.dir}/logfile.xml" format="frames" styledir="${reports.style.dir}" todir="${reports.unit.dir}"/>
548
549    <if>
550      <equals arg1="${codecoverage}" arg2="true"/>
551      <then>
552        <echo>Creating Code Coverage Report</echo>
553        <coverage-report outfile="${reports.dir}/coverage.xml" geshipath="${reports.geshi.dir}" geshilanguagespath="${reports.geshi.dir}/geshi">
554          <report todir="${reports.codecoverage.dir}" styledir="${reports.style.dir}"/>
555        </coverage-report>
556      </then>
557    </if>
558  </target>
559
560  <target name="lint" description="Check syntax of PHP source files">
561    <phplint>
562      <fileset refid="src"/>
563    </phplint>
564  </target>
565
566  <target name="lint-demos" description="Check syntax of demo files and configuration files">
567    <echo>Validate application configuration</echo>
568    <xmllint schema="${application.xsd}">
569      <fileset dir="demos">
570        <exclude name="**/.svn"/>
571        <include name="**/application.xml"/>
572      </fileset>
573    </xmllint>
574    <echo>Validate page configuration</echo>
575    <xmllint schema="${config.xsd}">
576      <fileset dir="demos">
577        <exclude name="**/.svn"/>
578        <include name="**/config.xml"/>
579      </fileset>
580    </xmllint>
581    <phplint>
582      <fileset dir="demos">
583        <exclude name="**/.svn"/>
584        <include name="**/*.php"/>
585      </fileset>
586    </phplint>
587  </target>
588  <target name="build-pear-package">
589    <echo>Preparing files for PEAR package...</echo>
590    <delete dir="${build.pear.dir}"/>
591    <mkdir dir="${build.pear.dir}"/>
592    <copy todir="${build.pear.dir}">
593      <fileset refid="framework"/>
594      <fileset dir="${build.base.dir}">
595        <include name="${prado.lite}"/>
596      </fileset>
597    </copy>
598
599    <echo>Creating package.xml...</echo>
600    <pear-package dir="${build.pear.dir}" destFile="${build.base.dir}/pear/package.xml" version="${version}" state="${pear.state}" notes="${notes}">
601      <fileset refid="framework"/>
602      <fileset dir="${build.base.dir}">
603        <include name="${prado.lite}"/>
604      </fileset>
605    </pear-package>
606  </target>
607  <target name="dist-pear" depends="build-pear-package" description="Create PRADO PEAR package">
608    <delete file="${dist.pearfile}"/>
609    <mkdir dir="${dist.base.dir}"/>
610    <exec command="pear package" dir="${build.pear.dir}" passthru="true"/>
611    <move file="${build.pear.dir}/prado3-${version}.tgz" tofile="${dist.pearfile}"/>
612  </target>
613  <target name="analyze" description="Analyze PHP source files with Zend Code Analyzer">
614    <analyze analyzerPath="${zca}" disable="var-ref-notmodified,var-use-before-def,var-arg-unused,if-if-else">
615      <fileset refid="src"/>
616    </analyze>
617  </target>
618
619  <target name="install" description="Install PEAR package locally">
620    <exec command="sudo pear install ${dist.pearfile}" dir="." passthru="true"/>
621  </target>
622
623  <target name="uninstall" description="Uninstall PEAR package locally">
624    <exec command="sudo pear uninstall pear.pradosoft.com/prado3" dir="." passthru="true"/>
625  </target>
626-->
627</project>
Note: See TracBrowser for help on using the browser.