-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
178 lines (146 loc) · 9.09 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?xml version="1.0" encoding="UTF-8"?>
<project name="vufind" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<property name="apacheconfdir" value="/etc/apache2/conf.d" />
<property name="apachectl" value="/etc/init.d/apache2" />
<property name="vufindurl" value="http://localhost/vufind" />
<property name="vufinddb" value="vufind_test" />
<property name="vufinddbuser" value="vufindtest" />
<property name="vufinddbpass" value="vufindtestpass" />
<property name="mysqlhost" value="localhost" />
<property name="mysqlrootuser" value="root" />
<property name="mysqlrootpass" value="password" />
<property name="marctestfile" value="${project.basedir}/tests/catalog_INCR-TEST_SAMPLE.mrc" />
<property name="version" value="1.3" />
<!-- Main Target -->
<target name="main" description="main target">
<!-- Create dirs -->
<mkdir dir="${builddir}/reports"/>
<mkdir dir="${builddir}/reports/coverage"/>
<!-- PHP API Documentation -->
<phpdoc title="API Documentation"
destdir="${builddir}/apidocs"
sourcecode="yes"
defaultpackagename="VuFind"
output="HTML:Smarty:PHP">
<fileset dir=".">
<include name="harvest/**/*.php" />
<include name="import/**/*.php" />
<include name="util/**/*.php" />
<include name="web/**/*.php" />
<exclude name="web/Crypt/**/*.php" />
<exclude name="web/Horde/**/*.php" />
<exclude name="web/interface/compile/**/*.php" />
<exclude name="web/sys/mobileesp/**/*.php" />
</fileset>
</phpdoc>
<!-- PHP CodeSniffer -->
<exec command="phpcs --standard=PEAR --ignore=${srcdir}/web/images/ie6/iepngfix.php,*/mobileesp/*,*/iWebKit/*,${srcdir}/web/Crypt/*,${srcdir}/web/Horde/*,${srcdir}/web/sys/SIP2.php,*/rc4.js,${srcdir}/web/js/phpserializer.js,*/jquery*.js,*/jquery*.css,*/css/blueprint/*,${srcdir}/web/interface/compile/*,*/yui.flot.js,*/excanvas.min.js --report=checkstyle ${srcdir} > ${builddir}/reports/checkstyle.xml" escape="false" />
<!-- PHPUnit -->
<exec dir="${srcdir}/tests" command="phpunit --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/"/>
</target>
<!-- Install and Activate VuFind -->
<target name="startup" description="install and activate demo">
<!-- set up appropriate read/write permissions for Apache -->
<exec command="chmod -R a+r ${srcdir}" />
<exec command="chmod -R a+x ${srcdir}/.." />
<exec command="chmod -R a+x ${srcdir}" />
<exec command="chmod -R a+w ${srcdir}/web/interface/cache ${srcdir}/web/interface/compile ${srcdir}/web/images/covers" />
<!-- build MySQL database -->
<exec command="mysqladmin -f -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} drop ${vufinddb}" />
<exec command="mysqladmin -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} create ${vufinddb}" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${vufinddb}.* TO '${vufinddbuser}'@'${mysqlhost}' IDENTIFIED BY '${vufinddbpass}' WITH GRANT OPTION"" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -e "FLUSH PRIVILEGES"" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -D ${vufinddb} < ${srcdir}/mysql.sql" checkreturn="true" />
<exec command="cp ${srcdir}/web/conf/vufind.ini ${srcdir}/web/conf/${vufinddb}.ini" />
<exec command="chmod 644 ${srcdir}/web/conf/${vufinddb}.ini" />
<!-- configure VuFind -->
<exec command="sed -e "s!/usr/local/vufind!${srcdir}!" ${srcdir}/web/conf/config.ini | sed -e "s!http://library.myuniversity.edu/vufind!${vufindurl}!" > ${srcdir}/web/conf/config.ini.tmp" />
<exec command="sed -e "s!mysql://root@localhost/vufind!mysql://${vufinddbuser}:${vufinddbpass}@${mysqlhost}/${vufinddb}!" ${srcdir}/web/conf/config.ini.tmp > ${srcdir}/web/conf/config.ini" />
<exec command="rm ${srcdir}/web/conf/config.ini.tmp" />
<!-- activate Apache -->
<exec command="sed -e "s!/usr/local/vufind!${srcdir}!" ${srcdir}/httpd-vufind.conf > ${apacheconfdir}/vufindtest" />
<exec command="chmod 644 ${apacheconfdir}/vufindtest" />
<exec command="${apachectl} restart" />
<!-- import marc test records into vufind index (note: the marc test records have prefix "testsample#") -->
<exec command="find ${srcdir}/tests/Selenium/Bugs -name *.mrc -printf %p," outputProperty="buglist" />
<foreach list="${buglist}${marctestfile}" param="filename" delimiter="," target="importrec" />
<!-- start Solr (use restart in case of old PID files) -->
<exec command="VUFIND_HOME=${srcdir} JETTY_PID=${tmp}/vufindtest.pid JETTY_CONSOLE=/dev/null ${srcdir}/vufind.sh restart" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
<!-- start the X frame buffer and selenium RC server -->
<exec command="VUFIND_HOME=${srcdir} ${srcdir}/tests/auto_test.sh start" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
</target>
<!-- Uninstall and Deactivate VuFind -->
<target name="shutdown" description="deactivate and uninstall demo">
<!-- delete the sample/bugs marc test records from vufind index -->
<exec command="find ${srcdir}/tests/Selenium/Bugs -name *.mrc -printf %p," outputProperty="buglist" />
<foreach list="${buglist}${marctestfile}" param="filename" delimiter="," target="deleterec" />
<!-- remove Apache settings -->
<exec command="rm ${apacheconfdir}/vufindtest" />
<exec command="${apachectl} restart" />
<!-- drop MySQL database -->
<exec command="mysqladmin -f -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} drop ${vufinddb}" />
<exec command="rm ${srcdir}/web/conf/${vufinddb}.ini" />
<!-- stop Solr -->
<exec command="VUFIND_HOME=${srcdir} JETTY_PID=${tmp}/vufindtest.pid ${srcdir}/vufind.sh stop" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
<!-- restore original files -->
<exec command="svn revert -R *" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
<!-- stop the X frame buffer and selenium RC server -->
<exec command="VUFIND_HOME=${srcdir} ${srcdir}/tests/auto_test.sh stop" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
</target>
<!-- Prepare VuFind for distribution -->
<target name="package" description="build VuFind packages for distribution">
<!-- make sure the work area is empty, then rebuild it -->
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="true" />
<mkdir dir="${builddir}/packages" />
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="true" />
<mkdir dir="${builddir}/export" />
<!-- export the source into the temporary directory -->
<exec command="svn export ${srcdir} ${builddir}/export/vufind-${version}" />
<!-- make sure the cache and compile directories exist -->
<mkdir dir="${builddir}/export/vufind-${version}/web/interface/cache" />
<mkdir dir="${builddir}/export/vufind-${version}/web/interface/compile" />
<!-- build the standard tar.gz archive -->
<exec command="tar -C${builddir}/export -c vufind-${version} > ${builddir}/packages/vufind-${version}.tar" />
<exec command="gzip ${builddir}/packages/vufind-${version}.tar" />
<!-- build the DEB package -->
<mkdir dir="${builddir}/export/vufind/usr/local" />
<copy todir="${builddir}/export/vufind/usr/local/vufind">
<fileset dir="${builddir}/export/vufind-${version}">
<include name="**" />
</fileset>
</copy>
<move file="${builddir}/export/vufind/usr/local/vufind/packages/DEBIAN" todir="${builddir}/export/vufind" includeemptydirs="true"/>
<exec command="chmod 0775 ${builddir}/export/vufind/DEBIAN/postinst" />
<exec command="dpkg-deb -b ${builddir}/export/vufind ${builddir}/packages/vufind_${version}.deb" />
<!-- clean up -->
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="true" />
<!-- report success -->
<echo message="Packages successfully generated in ${builddir}/packages" />
</target>
<target name="importrec" description="import each of the bug marc test record">
<if>
<istrue value="${filename}"/> <!-- To ignore the last token, as find command output list has ',' after last filename -->
<then>
<exec command="VUFIND_HOME=${srcdir} ${srcdir}/import-marc.sh ${filename}" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
</then>
</if>
</target>
<target name="deleterec" description="import each of the bug marc test record">
<if>
<istrue value="${filename}"/>
<then>
<exec command="php ${srcdir}/util/deletes.php ${filename}" />
</then>
</if>
</target>
</project>