root/tags/3.0.2/build.xml

Revision 1215, 16.3 kB (checked in by xue, 2 years ago)

Added Dreamweaver extension generator.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3  PRADO 3.0 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
17  <!-- generates ${prado.version} and ${prado.revision} -->
18  <prado-version-check />
19
20  <!-- these are required external commands -->
21  <property name="php" value="php" /> <!-- PHP parser -->
22  <property name="hhc" value="hhc" /> <!-- compile phpdoc into CHM -->
23  <property name="pdflatex" value="pdflatex" />  <!-- generates PDF from LaTex -->
24  <property name="zip" value="zip" />  <!-- zip compression -->
25
26  <property name="pkgname" value="${phing.project.name}-${prado.version}.r${prado.revision}"/>
27
28  <property name="build.base.dir" value="build"/>
29  <property name="build.dist.dir" value="${build.base.dir}/dist"/>
30  <property name="build.src.dir" value="${build.base.dir}/${pkgname}"/>
31  <property name="build.doc.dir" value="${build.base.dir}/docs"/>
32  <property name="build.pear.dir" value="${build.base.dir}/pear"/>
33  <property name="build.web.dir" value="${build.base.dir}/web"/>
34  <property name="build.test.dir" value="${build.base.dir}/test-reports"/>
35  <property name="build.coverage.dir" value="${build.base.dir}/code-coverage"/>
36  <property name="build.snapshot.dir" value="${build.base.dir}/snapshot"/>
37
38  <!--
39      All Source Files in framework
40  -->
41  <fileset dir="." id="framework">
42    <exclude name="**/.svn"/>
43    <exclude name="**/*.bak"/>
44    <exclude name="**/*~"/>
45    <include name="framework/**/*"/>
46  </fileset>
47
48  <!--
49      Surrounding files
50  -->
51  <fileset dir="." id="misc">
52    <exclude name="**/.svn"/>
53    <exclude name="**/*.bak"/>
54    <exclude name="**/*~"/>
55    <include name="COPYRIGHT"/>
56    <include name="HISTORY"/>
57    <include name="UPGRADE"/>
58    <include name="index.html"/>
59    <include name="requirements/*"/>
60  </fileset>
61
62  <!--
63      Documentation
64  -->
65  <fileset dir="." id="docs">
66    <exclude name="**/.svn"/>
67    <exclude name="**/*.bak"/>
68    <exclude name="**/*~"/>
69    <include name="docs/**/*"/>
70  </fileset>
71
72  <!--
73      Demos
74  -->
75  <fileset dir="." id="demos">
76    <exclude name="**/.svn"/>
77    <exclude name="**/*.bak"/>
78    <exclude name="**/*~"/>
79    <exclude name="**/runtime/*"/>
80    <exclude name="**/assets/*"/>
81    <exclude name="**/runtime/*/**"/>
82    <exclude name="**/assets/*/**"/>
83    <exclude name="demos/blog/protected/Data/Blog.db" />
84    <include name="demos/**/*"/>
85  </fileset>
86
87  <!--
88      Writable files and directories
89  -->
90  <fileset dir="." id="writables">
91    <include name="${build.src.dir}/demos/**/runtime" />
92    <include name="${build.src.dir}/demos/**/assets" />
93    <include name="${build.src.dir}/demos/blog/protected/Data" />
94  </fileset>
95
96  <target name="help">
97    <echo>
98
99    Welcome to use PRADO build script!
100    ----------------------------------
101    You may use the following command format to build a target:
102
103              phing   &lt;target name&gt;
104
105    where &lt;target name&gt; can be one of the following:
106   
107    For all PRADO developers:
108    - test    : run unit tests (results are under /build/test-reports);
109    - js      : generate Javascript distribution files;
110   
111    For PRADO release manager:
112    - dist    : create release files;
113    - build   : prepare a directory for distribution;
114    - clean   : clean up the build directory;
115    - rebuild : clean first and then build;
116    - docs    : generate documentation;
117    - pear    : generate PEAR packages;
118    - snapshot: generate nightly snapshot;
119    </echo>
120  </target>
121
122  <target name="build" depends="js" description="Building standard PRADO package v${prado.version}.${prado.revision}">
123    <echo>Building pradolite.php...</echo>
124    <delete file="framework/pradolite.php"/>
125    <exec command="${php} build.php" dir="buildscripts/phpbuilder" passthru="true"/>
126   
127    <echo>Copying files to build directory...</echo>
128    <copy todir="${build.src.dir}">
129      <fileset refid="demos"/>
130      <fileset refid="docs"/>
131      <fileset refid="framework"/>
132      <fileset refid="misc"/>
133    </copy>
134   
135    <copy file="buildscripts/classtree/DWExtensionReadme.txt" tofile="${build.src.dir}/editors/Dreamweaver/readme.txt" />
136   
137    <echo>Changing file permissions...</echo>
138    <chmod mode="0777">
139      <fileset refid="writables" />
140    </chmod>
141   
142    <echo>Building quickstart demo search indices...</echo>
143    <prado-quickstart-index todir="${build.src.dir}/demos/quickstart/protected/index/quickstart" />
144  </target>
145
146  <target name="clean">
147    <echo>Cleaning up the mess</echo>
148    <delete dir="${build.base.dir}"/>
149  </target>
150
151  <target name="rebuild" depends="clean,build" />
152
153  <target name="docs">
154    <echo>Building quickstart.pdf...</echo>
155    <delete>
156      <fileset dir=".">
157        <include name="buildscripts/texbuilder/*.aux" />
158      </fileset>
159    </delete>
160    <exec command="${php} build.php" dir="buildscripts/texbuilder" passthru="true"/>
161    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder" passthru="true"/>
162    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder" passthru="true"/>
163    <exec command="${pdflatex} quickstart.tex -interaction=nonstopmode -max-print-line=120" dir="buildscripts/texbuilder" passthru="true"/>
164    <move file="buildscripts/texbuilder/quickstart.pdf" todir="${build.doc.dir}"/>
165
166    <echo>Building API manuals...</echo>
167    <delete dir="${build.doc.dir}/manual"/>
168    <mkdir dir="${build.doc.dir}/manual" />
169    <prado-doc phpdoc="${php} buildscripts/PhpDocumentor/phpdoc"
170               title="PRADO v${prado.version} API Manual"
171               destdir="${build.doc.dir}/manual"
172               sourcepath="framework"
173               ignorelist="*pradolite.php,*3rdParty/*,*Javascripts/*,*I18N/core/*"
174               output="HTML:frames:default,CHM:default:default,HTML:Smarty:PradoSoft" />
175    <!-- generate CHM file -->
176    <if>
177      <equals arg1="${prado.winbuild}" arg2="true"/>
178      <then>
179        <exec command="${hhc} ${build.doc.dir}/manual/CHMdefaultConverter/phpdoc.hhp" />
180      </then>
181    </if>
182   
183    <echo>Indexing API manuals...</echo>
184    <prado-api-index docdir="${build.doc.dir}/manual/HTMLSmartyConverter" todir="${build.doc.dir}/manual/HTMLSmartyConverter" />
185    <copy file="buildscripts/index/search.php" todir="${build.doc.dir}/manual/HTMLSmartyConverter" />
186  </target>
187
188  <target name="dist" depends="rebuild,docs">
189    <echo>Moving doc files to build...</echo>
190    <mkdir dir="${build.dist.dir}" />
191    <move file="${build.doc.dir}/quickstart.pdf" todir="${build.src.dir}/docs" />
192    <move todir="${build.src.dir}/docs/manual">
193      <fileset dir="${build.doc.dir}/manual/HTMLframesConverter">
194        <include name="**/**" />
195      </fileset>
196    </move>
197    <if>
198      <equals arg1="${prado.winbuild}" arg2="true"/>
199      <then>
200        <move file="${build.doc.dir}/manual/CHMdefaultConverter/documentation.chm" tofile="${build.src.dir}/docs/manual.chm" />
201      </then>
202    </if>
203   
204    <echo>Generating compressed distribution files...</echo>
205    <if>
206      <equals arg1="${prado.winbuild}" arg2="false"/>
207      <then>
208        <exec command="tar czvf ${pkgname}.tar.gz ${pkgname}" dir="${build.base.dir}"/>
209        <move file="${build.base.dir}/${pkgname}.tar.gz" todir="${build.dist.dir}" />
210      </then>
211    </if>
212    <exec command="zip ${pkgname}.zip -r ${pkgname}" dir="${build.base.dir}" />
213    <move file="${build.base.dir}/${pkgname}.zip" todir="${build.dist.dir}" />
214
215        <echo>Generating files for pradosoft.com...</echo>   
216    <echo>Compiling class docs...</echo>
217    <exec command="${php} build.php" dir="buildscripts/classtree" passthru="true"/>
218    <move file="buildscripts/classtree/classes.data" todir="${build.web.dir}/protected/Data" />
219   
220    <echo>Moving HTML docs to Web folder...</echo>
221    <mkdir dir="${build.web.dir}" />
222    <move todir="${build.web.dir}/docs/manual">
223      <fileset dir="${build.doc.dir}/manual/HTMLSmartyConverter">
224        <include name="**/**" />
225      </fileset>
226    </move>
227   
228    <echo>
229   
230
231                   Distribution Not Completed Yet!!!
232                   
233The following steps need to be manually performed in order to complete
234the PRADO distribution:
235
2361. Package DreamWeaver extension by running DW extension manager with
237   buildscripts/classtree/PRADO.mxi and saving the generated file as
238   "${build.src.dir}/editors/Dreamweaver/PRADO.mxp"
239   
2402. If building on Linux, the CHM doc file needs to be generated by compiling
241   "${build.doc.dir}/manual/CHMdefaultConverter/phpdoc.hhp"
242   and saving the generated file as
243   "${build.src.dir}/docs/manual.chm"
244
2453. Use winzip (on Windows) and gzip (on Linux) to generate the compressed
246   release files of the direcotry
247   "${build.src.dir}".
248
249    </echo>
250  </target>
251
252  <target name="js" description="Compiling Javascript distribution files">
253    <delete file="framework/Web/Javascripts/js/*.js" />
254    <exec command="${php} build.php" dir="buildscripts/jsbuilder" passthru="true"/>
255  </target>
256
257  <target name="test" description="Running unit tests">
258    <delete dir="${build.test.dir}"/>
259    <mkdir dir="${build.test.dir}"/>
260    <prado-test codecoverage="false" haltonfailure="false" haltonerror="false" printsummary="true">
261      <batchtest>
262        <fileset dir="tests/unit">
263              <include name="**/*Test.php"/>
264        </fileset>
265      </batchtest>
266      <formatter type="xml" todir="${build.test.dir}" outfile="unit-tests.xml"/>
267    </prado-test>
268    <phpunit2report infile="${build.test.dir}/unit-tests.xml" format="frames" styledir="buildscripts/phing/style" todir="${build.test.dir}"/>
269  </target>
270
271  <target name="snapshot" depends="rebuild"> 
272    <echo>Generating compressed distribution files...</echo>
273    <if>
274      <equals arg1="${prado.winbuild}" arg2="false"/>
275      <then>
276        <exec command="tar czvf ${pkgname}.tar.gz ${pkgname}" dir="${build.base.dir}"/>
277        <move file="${build.base.dir}/${pkgname}.tar.gz" todir="${build.dist.dir}" />
278      </then>
279    </if>
280    <exec command="zip ${pkgname}.zip -r ${pkgname}" dir="${build.base.dir}" />
281    <move file="${build.base.dir}/${pkgname}.zip" tofile="${build.snapshot.dir}/prado-latest.zip" />
282    <copy file="${build.src.dir}/HISTORY" tofile="${build.snapshot.dir}/changelog-latest.txt" />
283  </target>
284 
285<!--
286  <taskdef name="phplint" classname="PhpLintTask" classpath="buildscripts/phing/tasks"/>
287  <taskdef name="xmllint" classname="XmlLintTask" classpath="buildscripts/phing/tasks"/>
288  <taskdef name="analyze" classname="ZendCodeAnalyzerTask" classpath="buildscripts/phing/tasks"/>
289  <taskdef name="pear-package" classname="BuildPradoPEARPackageTask" classpath="buildscripts/phing/tasks"/>
290
291  <target name="pear" depends="" description="Creating PEAR package">
292    <mkdir dir="${build.pear.dir}" />
293    <prado-pear pkgdir="${build.pear.dir}"
294                channel="pear.php.net"
295                version="${prado.version}"
296                state="stable"
297                category="framework"
298                package="prado"
299                summary="PRADO is a ...."
300                pkgdescription="detailed description..."
301                notes="www.pradosoft.com"
302                license="BSD"
303                />
304  </target>
305  <target name="test" description="Run unit tests">
306    <echo>Preparing directory structure</echo>
307    <delete dir="${reports.dir}"/>
308    <mkdir dir="${reports.dir}"/>
309    <delete dir="${reports.unit.dir}"/>
310    <delete dir="${reports.codecoverage.dir}"/>
311    <mkdir dir="${reports.unit.dir}"/>
312
313    <if>
314      <equals arg1="${codecoverage}" arg2="true"/>
315      <then>
316        <mkdir dir="${reports.codecoverage.dir}"/>
317        <echo>Preparing Code Coverage Database</echo>
318        <coverage-setup database="${reports.codecoverage.dir}/coverage.db">
319          <fileset dir="${src.dir}">
320            <include name="**/*.php"/>
321            <exclude name="Web/Javascripts/js/clientscripts.php"/>
322            <exclude name="Data/TCache.php"/>
323            <exclude name="DataAccess/**/*.php"/>
324            <exclude name="I18N/core/Gettext/MO.php"/>
325            <exclude name="I18N/core/Gettext/PO.php"/>
326            <exclude name="I18N/core/util.php"/>
327            <exclude name="I18N/TGlobalization.php"/>
328            <exclude name="I18N/TGlobalizationAutoDetect.php"/>
329            <exclude name="Security/TUserManager.php"/>
330            <exclude name="Security/TMembershipManager.php"/>
331            <exclude name="core.php"/>
332            <exclude name="3rdParty/**/*.php"/>
333            <exclude name="pradolite.php"/>
334            <exclude name="prado.php"/>
335          </fileset>
336        </coverage-setup>
337      </then>
338    </if>
339
340    <echo>Running Unit Tests</echo>
341    <phpunit2 codecoverage="${codecoverage}" haltonfailure="false" haltonerror="false" printsummary="true">
342      <batchtest>
343        <fileset dir="${tests.dir}">
344          <include name="**/*Test.php"/>
345        </fileset>
346      </batchtest>
347      <formatter type="xml" todir="${reports.dir}" outfile="logfile.xml"/>
348    </phpunit2>
349
350    <echo>Creating Unit Test Report</echo>
351    <phpunit2report infile="${reports.dir}/logfile.xml" format="frames" styledir="${reports.style.dir}" todir="${reports.unit.dir}"/>
352
353    <if>
354      <equals arg1="${codecoverage}" arg2="true"/>
355      <then>
356        <echo>Creating Code Coverage Report</echo>
357        <coverage-report outfile="${reports.dir}/coverage.xml" geshipath="${reports.geshi.dir}" geshilanguagespath="${reports.geshi.dir}/geshi">
358          <report todir="${reports.codecoverage.dir}" styledir="${reports.style.dir}"/>
359        </coverage-report>
360      </then>
361    </if>
362  </target>
363
364  <target name="lint" description="Check syntax of PHP source files">
365    <phplint>
366      <fileset refid="src"/>
367    </phplint>
368  </target>
369
370  <target name="lint-demos" description="Check syntax of demo files and configuration files">
371    <echo>Validate application configuration</echo>
372    <xmllint schema="${application.xsd}">
373      <fileset dir="demos">
374        <exclude name="**/.svn"/>
375        <include name="**/application.xml"/>
376      </fileset>
377    </xmllint>
378    <echo>Validate page configuration</echo>
379    <xmllint schema="${config.xsd}">
380      <fileset dir="demos">
381        <exclude name="**/.svn"/>
382        <include name="**/config.xml"/>
383      </fileset>
384    </xmllint>
385    <phplint>
386      <fileset dir="demos">
387        <exclude name="**/.svn"/>
388        <include name="**/*.php"/>
389      </fileset>
390    </phplint>
391  </target>
392  <target name="build-pear-package">
393    <echo>Preparing files for PEAR package...</echo>
394    <delete dir="${build.pear.dir}"/>
395    <mkdir dir="${build.pear.dir}"/>
396    <copy todir="${build.pear.dir}">
397      <fileset refid="framework"/>
398      <fileset dir="${build.base.dir}">
399        <include name="${prado.lite}"/>
400      </fileset>
401    </copy>
402   
403    <echo>Creating package.xml...</echo>
404    <pear-package dir="${build.pear.dir}" destFile="${build.base.dir}/pear/package.xml" version="${version}" state="${pear.state}" notes="${notes}">
405      <fileset refid="framework"/>
406      <fileset dir="${build.base.dir}">
407        <include name="${prado.lite}"/>
408      </fileset>
409    </pear-package>
410  </target>
411  <target name="dist-pear" depends="build-pear-package" description="Create PRADO PEAR package">
412    <delete file="${dist.pearfile}"/>
413    <mkdir dir="${dist.base.dir}"/>
414    <exec command="pear package" dir="${build.pear.dir}" passthru="true"/>
415    <move file="${build.pear.dir}/prado3-${version}.tgz" tofile="${dist.pearfile}"/>
416  </target>
417  <target name="analyze" description="Analyze PHP source files with Zend Code Analyzer">
418    <analyze analyzerPath="${zca}" disable="var-ref-notmodified,var-use-before-def,var-arg-unused,if-if-else">
419      <fileset refid="src"/>
420    </analyze>
421  </target>
422
423  <target name="install" description="Install PEAR package locally">
424    <exec command="sudo pear install ${dist.pearfile}" dir="." passthru="true"/>
425  </target>
426 
427  <target name="uninstall" description="Uninstall PEAR package locally">
428    <exec command="sudo pear uninstall pear.pradosoft.com/prado3" dir="." passthru="true"/>   
429  </target>
430--> 
431</project>
Note: See TracBrowser for help on using the browser.