root/tags/3.0.7/build.xml

Revision 1460, 16.9 kB (checked in by wei, 2 years ago)

add unified chm build (quickstart + API + classdocs + wiki)

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