Skip to content
Newer
Older
100644 180 lines (150 sloc) 9.69 KB
d32a2ca import
Drak authored Mar 7, 2010
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="zikula" default="clean">
3 <!-- invokation
a958587 Only generate browser based on xml
Drak authored Mar 30, 2010
4 phing -f $WORKSPACE/source/build.xml clean prepare phpcs phpcb phpcpd phpunit pdepend phpmd phpdoc build build_delete -Dworkspace=$WORKSPACE -Djob_name=$JOB_NAME -Dbuild_number=$BUILD_NUMBER -Dbuild_tag=$BUILD_TAG -Dbuild_id=$BUILD_ID -Dsvn_revision=$SVN_REVISION
d32a2ca import
Drak authored Mar 7, 2010
5 # note phpcb must be the last artifact run in the chain
6 -->
7 <!--
8 BUILD_NUMBER - The current build number, such as "153"
9 BUILD_ID - The current build id, (YYYY-MM-DD_hh-mm-ss)
10 JOB_NAME - Name of the project of this build, such as "foo"
11 BUILD_TAG - String of "hudson-${JOBNAME}-${BUILD_NUMBER}".
12 WORKSPACE - The absolute path of the workspace.
13 SVN_REVISION - The revision this build is based on.
14 -->
15 <property name="builddir" value="${workspace}/build" />
16 <property name="sourcedir" value="${workspace}/source" />
17 <property name="package" value="${job_name}.build${build_number}" />
18 <property name="exportdir" value="${builddir}/export" />
19 <property name="archivedir" value="${builddir}/archive" />
20 <property name="packagepath" value="${exportdir}/${job_name}" />
21 <property name="checksumpath" value="${archivedir}/${package}-checksums" />
22 <property name="patchdir" value="${builddir}/patch" />
23 <property name="tmpdir" value="${builddir}/tmp" />
046e471 Update build.xml
Drak authored Jun 20, 2010
24 <property name="ignorepaths" value="lib/vendor/*,javascript/*,system/*,themes/*,install/*,lib/legacy" />
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
25
26 <!-- need a second property since phpdoc doesn't respect wildcard patterns -->
6e332f3 Update build.xml for codesniffing.
Drak authored Jun 20, 2010
27 <property name="phpdocignorepaths" value="lib/vendor/,javascript/,system/" />
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
28 <property name="ignorefiletypes" value="*.css,*.js" />
29
d32a2ca import
Drak authored Mar 7, 2010
30 <target name="clean">
31 <echo msg="Clean..." />
32 <delete dir="${builddir}" includeemptydirs="true" />
33 </target>
34
35 <target name="prepare">
36 <echo msg="Prepare..." />
37 <mkdir dir="${builddir}" />
38 <mkdir dir="${builddir}/logs" />
a1adc75 Fix code coverage report.
Drak authored Mar 28, 2010
39 <mkdir dir="${builddir}/coverage" />
d32a2ca import
Drak authored Mar 7, 2010
40 <mkdir dir="${builddir}/docs" />
41 <mkdir dir="${builddir}/phpcb" />
42 <mkdir dir="${builddir}/archive" />
43 <mkdir dir="${builddir}/export" />
a1adc75 Fix code coverage report.
Drak authored Mar 28, 2010
44 <mkdir dir="${builddir}/patch" />
45 <mkdir dir="${builddir}/tmp" />
d32a2ca import
Drak authored Mar 7, 2010
46 </target>
47
48 <!-- Build archives -->
49 <target name="build" depends="prepare">
50 <echo msg="Exporting for build..." />
51 <!-- ATTN export urls require manual edit -->
52 <exec command="svn export -r${svn_revision} https://code.zikula.org/svn/core/branches/zikula-1.3/src ${packagepath}" />
d0d725b add missing Tour module to build
Drak authored Mar 7, 2010
53 <exec command="svn export --force https://code.zikula.org/svn/tour/trunk/src/Tour ${packagepath}/modules/Tour" />
d32a2ca import
Drak authored Mar 7, 2010
54
dd0186b Experimental compression of JS during build.
Drak authored Jun 28, 2010
55 <!-- compress JS -->
56 <property name="jslist" value="javascript/helpers/Zikula.js" />
57 <foreach list="${jslist}" param="filename" target="compressownjs" />
58
d32a2ca import
Drak authored Mar 7, 2010
59 <echo msg="Prepare permissions..." />
60 <chmod file="${packagepath}/config/config.php" mode="0666" />
61 <chmod file="${packagepath}/ztemp/error_logs" mode="0777" />
62 <chmod file="${packagepath}/ztemp/Renderer_cache" mode="0777" />
63 <chmod file="${packagepath}/ztemp/Renderer_compiled" mode="0777" />
64 <chmod file="${packagepath}/ztemp/Theme_cache" mode="0777" />
65 <chmod file="${packagepath}/ztemp/Theme_compiled" mode="0777" />
66 <chmod file="${packagepath}/ztemp/Theme_Config" mode="0777" />
67
68 <echo msg="Creating archive..." />
69 <!-- zip's don't play nicely in Phing - using direct command -->
70 <exec escape="false" command="cd ${exportdir}; zip -D -r ${archivedir}/${package}.zip ." />
71
72 <tar destfile="${archivedir}/${package}.tar.gz" compression="gzip">
73 <fileset dir="${exportdir}">
74 <include name="${job_name}" />
75 </fileset>
76 </tar>
77 <echo msg="Files copied and compressed in build directory OK!" />
78
79 <!-- ATTN phingcall target="build_patch" / -->
80 <phingcall target="build_checksums" />
52f564d Add build cleanup.
Drak authored Mar 22, 2010
81 </target>
82
7f82a6d Remove depends.
Drak authored Mar 22, 2010
83 <target name="build_delete">
52f564d Add build cleanup.
Drak authored Mar 22, 2010
84 <!-- clean up export dir, this is not needed (unless we are debugging) -->
85 <delete dir="${packagepath}" includeemptydirs="true" />
d32a2ca import
Drak authored Mar 7, 2010
86 </target>
87
88 <target name="build_checksums">
89 <echo msg="Creating MD5 and SHA1 checksums..." />
90 <exec escape="false" command="echo -----------------md5sums----------------- > ${checksumpath}.tmp" />
91 <exec escape="false" command="md5sum ${archivedir}/*.tar.gz ${archivedir}/*.zip >> ${checksumpath}.tmp" />
92
93 <exec escape="false" command="echo -----------------sha1sums----------------- >> ${checksumpath}.tmp" />
94 <exec escape="false" command="sha1sum ${archivedir}/*.tar.gz ${archivedir}/*.zip >> ${checksumpath}.tmp" />
95
96 <exec escape="false" command="cat ${checksumpath}.tmp | sed 's!${archivedir}/!!g' > ${checksumpath}.txt" />
97 <delete file="${checksumpath}.tmp" />
98 </target>
99
100 <target name="build_patch">
101 <echo msg="Making patches...." />
102 <!-- get diffs for releases and save in ${tmpdir}/CHANGES file -->
103 <!-- ATTN urls require manual edit -->
104 <exec escape="false" command="svn diff https://code.zikula.org/svn/core/tags/Zikula-1.3.0 https://code.zikula.org/svn/core/branches/zikula-1.3/src@${svn_revision} --summarize | sort|uniq > ${tmpdir}/CHANGES" />
105
106 <!-- Remove lines that start with space (which means only a property change), or contain paths to deleted files -->
107 <exec escape="false" command="cat ${tmpdir}/CHANGES | sed -e '/^[ D]/d' >${tmpdir}/AM" />
108
109 <!-- List deleted files -->
110 <exec escape="false" command="cat ${tmpdir}/CHANGES | grep -e '^D' >${tmpdir}/DELETED.tmp" />
111
112 <!-- this needs to be the regex escaped of the OLD branch -->
113 <!-- ATTN url requires manual edit -->
d0d725b add missing Tour module to build
Drak authored Mar 7, 2010
114 <property name="patchregex" value="https://code.zikula.org/svn/core/tags/Zikula-1.3.0/" />
d32a2ca import
Drak authored Mar 7, 2010
115
116 <!-- A or M, ignoring svn-property changes (2nd char), strip the svn-path from the remaining lines, store in ${tmpdir}/FILES -->
117 <exec escape="false" command="cat ${tmpdir}/AM | sed -e 's!^[AM]. *${patchregex}!!g' > ${tmpdir}/FILES" />
118 <exec escape="false" command="cat ${tmpdir}/DELETED.tmp | sed -e 's!${patchregex}!!g' > ${tmpdir}/DELETED" />
119
120 <!-- assemble patch -->
121 <exec escape="false" command="cd ${packagepath};for FILE in `cat ${tmpdir}/FILES`;do cp --parents $FILE ${patchdir};done" />
0719f34 Sync patch build process with 1.2
Drak authored Apr 19, 2010
122
123 <!-- install folder is always required -->
124 <exec escape="false" command="svn export --force https://code.zikula.org/svn/core/branches/zikula-1.3/src/install@${svn_revision} ${patchdir}/install" />
d32a2ca import
Drak authored Mar 7, 2010
125
126 <!-- zip's don't play nicely in Phing - using direct command -->
127 <exec escape="false" command="cd ${patchdir}; zip -D -r ${archivedir}/${package}.patch.zip ." />
128 </target>
129
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
130 <!-- PHPDocumentor -->
d32a2ca import
Drak authored Mar 7, 2010
131 <target name="phpdoc">
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
132 <echo msg="PHPDocumentor..." />
b1db00d Update API generator build xml
Drak authored Jun 11, 2010
133 <exec command="phpdoc --directory ${sourcedir}/src/lib/api,${sourcedir}/src/lib/dbobject,${sourcedir}/src/lib/FileSystem,${sourcedir}/src/lib/Form,${sourcedir}/src/lib/i18n,${sourcedir}/src/lib/render,${sourcedir}/src/lib/StreamReader,${sourcedir}/src/lib/templates,${sourcedir}/src/lib/util,${sourcedir}/src/lib/workflow,${sourcedir}/src/lib/Zikula --target ${builddir}/docs" escape="false" />
d32a2ca import
Drak authored Mar 7, 2010
134 </target>
135
136 <!-- PHP copy/paste analysis -->
137 <target name="phpcpd">
138 <echo msg="PHP Copy/Paste..." />
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
139 <exec command="phpcpd --log-pmd ${builddir}/logs/phpcpd.xml --suffixes php --exclude ${ignorepaths} ${sourcedir}/src" escape="false" />
140 </target>
141
142 <!-- PHP MD analysis -->
143 <target name="phpmd">
144 <echo msg="PHP_MD..." />
97930f8 phpmd params dont take = sign
Drak authored Mar 24, 2010
145 <exec command="phpmd ${sourcedir}/src xml codesize --reportfile ${builddir}/logs/pmd.xml --ignore ${ignorepaths}" escape="false" />
d32a2ca import
Drak authored Mar 7, 2010
146 </target>
147
148 <!-- PHP dependency checker -->
149 <target name="pdepend">
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
150 <!-- PHP dependency checker -->
151 <echo msg="PHP_Depend..." />
152 <exec command="pdepend --jdepend-xml=${builddir}/logs/jdepend.xml --jdepend-chart=${builddir}/logs/jdepend.png --phpunit-xml=${builddir}/logs/pdepend_phpunit.xml --overview-pyramid=${builddir}/logs/pdepend_pyramid.png --summary-xml=${builddir}/logs/pdepend_summary.xml --ignore=${ignorepaths} --optimization=best --suffix=php ${sourcedir}/src" escape="false" />
d32a2ca import
Drak authored Mar 7, 2010
153 </target>
154
155 <!-- PHP CodeSniffer -->
156 <target name="phpcs">
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
157 <echo msg="PHP_CodeSniffer..." />
158 <exec command="phpcs --extensions=php --report=checkstyle --standard=Zikula --ignore=${ignorepaths} ${sourcedir}/src > ${builddir}/logs/phpcs.xml" escape="false" />
d32a2ca import
Drak authored Mar 7, 2010
159 </target>
160
161 <!-- Unit Tests & coverage analysis -->
162 <target name="phpunit">
d1f1139 Merge build script from 1.7
Drak authored Mar 24, 2010
163 <echo msg="PHPUnit..." />
05eff4a I'll get this right one day...
Drak authored Mar 29, 2010
164 <exec command="phpunit --log-junit ${builddir}/logs/phpunit.xml --coverage-clover ${builddir}/coverage/clover.xml --coverage-html ${builddir}/coverage/ ${sourcedir}/tests"/>
d32a2ca import
Drak authored Mar 7, 2010
165 </target>
166
167 <!-- Code Browser -->
168 <target name="phpcb">
a958587 Only generate browser based on xml
Drak authored Mar 30, 2010
169 <echo msg="PHP_CodeBrowser on XML for voilations..." />
59f2cca Only generate browser based on xml
Drak authored Mar 30, 2010
170 <exec command="phpcb --log ${builddir}/logs --output ${builddir}/phpcb" />
d32a2ca import
Drak authored Mar 7, 2010
171 </target>
dd0186b Experimental compression of JS during build.
Drak authored Jun 28, 2010
172
173 <!-- Compress own JS -->
174 <target name="compressownjs">
175 <echo msg="YUI_Compressor for JS files..." />
176 <!-- exec command="BAREFILENAME=`echo ${filename}|sed 's/.js//g'`; /usr/bin/jar -jar /var/lib/hudson/yuicompressor-2.4.2.jar -type js -o ${packagepath}/$BAREFILENAME-min.js ${packagepath}/${filename}" / -->
177 <exec command="/usr/bin/jar -jar /var/lib/hudson/yuicompressor-2.4.2.jar -type js -o ${packagepath}/${filename} ${packagepath}/${filename}" />
178 </target>
d32a2ca import
Drak authored Mar 7, 2010
179 </project>
Something went wrong with that request. Please try again.