forked from zikula-modules/Scribite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
155 lines (127 loc) · 7.43 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0" encoding="UTF-8"?>
<project name="Scribite" default="clean">
<!-- invokation
phing -f $WORKSPACE/source/build.xml clean prepare phpcs phpcb phpcpd phpunit pdepend phpmd phpdoc jsdoc 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
# note phpcb must follow phpcs
-->
<!--
BUILD_NUMBER - The current build number, such as "153"
BUILD_ID - The current build id, (YYYY-MM-DD_hh-mm-ss)
JOB_NAME - Name of the project of this build, such as "foo"
BUILD_TAG - String of "hudson-${JOBNAME}-${BUILD_NUMBER}".
WORKSPACE - The absolute path of the workspace.
SVN_REVISION - The revision this build is based on.
-->
<property name="builddir" value="${workspace}/build" />
<property name="sourcedir" value="${workspace}/source" />
<property name="package" value="${job_name}.build${build_number}" />
<property name="exportdir" value="${builddir}/export" />
<property name="archivedir" value="${builddir}/archive" />
<property name="packagepath" value="${exportdir}/${job_name}" />
<property name="checksumpath" value="${archivedir}/${package}-checksums" />
<property name="patchdir" value="${builddir}/patch" />
<property name="tmpdir" value="${builddir}/tmp" />
<property name="ignorepaths" value="lib/vendor/*,javascript/*,lib/legacy" />
<property name="ownjslist" value="javascript/helpers/Zikula.js,javascript/helpers/Zikula.ImageViewer.js" />
<!-- need a second property since phpdoc doesn't respect wildcard patterns -->
<property name="phpdocignorepaths" value="lib/vendor/,javascript/" />
<property name="ignorefiletypes" value="*.css,*.js" />
<target name="clean">
<echo msg="Clean..." />
<delete dir="${builddir}" includeemptydirs="true" />
</target>
<target name="prepare">
<echo msg="Prepare..." />
<mkdir dir="${builddir}" />
<mkdir dir="${builddir}/logs" />
<mkdir dir="${builddir}/coverage" />
<mkdir dir="${builddir}/docs" />
<mkdir dir="${builddir}/phpcb" />
<mkdir dir="${builddir}/archive" />
<mkdir dir="${builddir}/export" />
<mkdir dir="${builddir}/patch" />
<mkdir dir="${builddir}/tmp" />
<mkdir dir="${builddir}/jsdoc" />
</target>
<!-- Build archives -->
<target name="build" depends="prepare">
<echo msg="Exporting for build..." />
<!-- ATTN export urls require manual edit -->
<exec command="cp -a ${workspace}/source/src ${packagepath}" />
<!-- compress JS -->
<!-- foreach list="${ownjslist}" param="filename" target="compressownjs" / -->
<!-- echo msg="Prepare permissions..." / -->
<!-- chmod file="${packagepath}/ztemp/Theme_Config" mode="0777" / -->
<echo msg="Creating archive..." />
<!-- zip's don't play nicely in Phing - using direct command -->
<exec escape="false" command="cd ${exportdir}; zip -D -r ${archivedir}/${package}.zip ." />
<tar destfile="${archivedir}/${package}.tar.gz" compression="gzip">
<fileset dir="${exportdir}/${job_name}">
<include name="**/**" />
</fileset>
</tar>
<echo msg="Files copied and compressed in build directory OK!" />
<phingcall target="build_checksums" />
</target>
<target name="build_delete">
<!-- clean up export dir, this is not needed (unless we are debugging) -->
<!-- delete dir="${packagepath}" includeemptydirs="true" -->
</target>
<target name="build_checksums">
<echo msg="Creating MD5 and SHA1 checksums..." />
<exec escape="false" command="echo -----------------md5sums----------------- > ${checksumpath}.tmp" />
<exec escape="false" command="md5sum ${archivedir}/*.tar.gz ${archivedir}/*.zip >> ${checksumpath}.tmp" />
<exec escape="false" command="echo -----------------sha1sums----------------- >> ${checksumpath}.tmp" />
<exec escape="false" command="sha1sum ${archivedir}/*.tar.gz ${archivedir}/*.zip >> ${checksumpath}.tmp" />
<exec escape="false" command="cat ${checksumpath}.tmp | sed 's!${archivedir}/!!g' > ${checksumpath}.txt" />
<delete file="${checksumpath}.tmp" />
</target>
<!-- PHPDocumentor -->
<target name="phpdoc">
<echo msg="PHPDocumentor..." />
<exec command="phpdoc --directory ${sourcedir}/src/lib/dbobject,${sourcedir}/src/lib/FileSystem" escape="false" />
</target>
<!-- PHP copy/paste analysis -->
<target name="phpcpd">
<echo msg="PHP Copy/Paste..." />
<exec command="phpcpd --log-pmd ${builddir}/logs/phpcpd.xml --suffixes php --exclude ${ignorepaths} ${sourcedir}/src" escape="false" />
</target>
<!-- PHP MD analysis -->
<target name="phpmd">
<echo msg="PHP_MD..." />
<exec command="phpmd ${sourcedir}/src xml codesize --reportfile ${builddir}/logs/pmd.xml --ignore ${ignorepaths}" escape="false" />
</target>
<!-- PHP dependency checker -->
<target name="pdepend">
<!-- PHP dependency checker -->
<echo msg="PHP_Depend..." />
<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" />
</target>
<!-- PHP CodeSniffer -->
<target name="phpcs">
<echo msg="PHP_CodeSniffer..." />
<exec command="phpcs --extensions=php --report=checkstyle --standard=Zikula --ignore=${ignorepaths} ${sourcedir}/src > ${builddir}/logs/phpcs.xml" escape="false" />
</target>
<!-- Unit Tests & coverage analysis -->
<target name="phpunit">
<echo msg="PHPUnit..." />
<exec command="phpunit --log-junit ${builddir}/logs/phpunit.xml --coverage-clover ${builddir}/coverage/clover.xml --coverage-html ${builddir}/coverage/ ${sourcedir}/tests"/>
</target>
<!-- JSDoc -->
<target name="jsdoc">
<echo msg="JSDoc..." />
<exec command="cd /opt/jsdoc-toolkit; /opt/jsdoc-toolkit/jsrun.sh -t=/opt/jsdoc-toolkit/templates/jsdoc --directory=${builddir}/jsdoc ${sourcedir}/src/javascript/helpers"/>
<!-- exec command="cd ${builddir}/jsdoc;/opt/jsdoc-toolkit ${sourcedir}/src/javascript/helpers"/ -->
</target>
<!-- Code Browser -->
<target name="phpcb">
<echo msg="PHP_CodeBrowser on XML for voilations..." />
<exec command="phpcb --log ${builddir}/logs --output ${builddir}/phpcb" />
</target>
<!-- Compress own JS -->
<target name="compressownjs">
<echo msg="YUI_Compressor for JS files..." />
<!-- <exec command="BAREFILENAME=`echo ${filename}|sed 's/.js//g'`; /usr/bin/java -jar /var/lib/hudson/yuicompressor-2.4.2.jar -o ${packagepath}/$BAREFILENAME-min.js ${packagepath}/${filename}" /> -->
<exec command="/usr/bin/java -jar /var/lib/hudson/yuicompressor-2.4.2.jar -o ${packagepath}/${filename}.tmp ${packagepath}/${filename};echo '// Copyright Zikula Foundation 2010 - license GNU/LGPLv3 (or at your option, any later version).' > ${packagepath}/${filename};cat ${packagepath}/${filename}.tmp >> ${packagepath}/${filename};rm -f ${packagepath}/${filename}.tmp" />
</target>
</project>