build.xml
5.54 KB
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
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="log4php" default="compile">
<property name="svnrepo.url" value="https://svn.apache.org/repos/asf"/>
<property name="svnsite.url" value="${svnrepo.url}/incubator/log4php/site"/>
<available property="svn-available" file="target/site-deploy/.svn"/>
<!-- Use Maven 2 to build or manually place ant-contrib (http://ant-contrib.sf.net) on path -->
<taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" />
<target name="compile-file">
<exec executable="php" failonerror="true">
<arg value="-l"/>
<arg value="${src.php}"/>
</exec>
</target>
<target name="compile">
<foreach target="compile-file" param="src.php">
<path>
<fileset dir="." includes="src/main/php/**/*.php"/>
</path>
</foreach>
</target>
<target name="test-compile">
<foreach target="compile-file" param="src.php">
<path>
<fileset dir="." includes="src/test/php/**/*.php"/>
<fileset dir="." includes="src/examples/php/**/*.php"/>
</path>
</foreach>
</target>
<target name="php-file">
<exec executable="php" failonerror="true" dir="target">
<arg value="-f"/>
<arg value="${src.php}"/>
</exec>
</target>
<target name="test">
<!-- PHPUnit3 must be installed for this to work.
See http://www.phpunit.de -->
<!-- TODO: change dir to "target", needs changes in some tests -->
<mkdir dir="target"/>
<exec executable="PHPUnit" failonerror="true" dir="src/test/php">
<arg value="AllTests"/>
<arg value="AllTests.php"/>
</exec>
<foreach target="php-file" param="src.php">
<path>
<fileset dir="." includes="src/examples/php/**/*.php" excludes="**/server.php"/>
</path>
</foreach>
</target>
<target name="apidocs">
<!-- PHPDoc must be installed for this to work. -->
<mkdir dir="target/site/apidocs"/>
<exec executable="phpdoc" failonerror="true">
<arg value="-d"/>
<arg value="src/main/php"/>
<arg value="-t"/>
<arg value="target/site/apidocs"/>
</exec>
</target>
<target name="fixcrlf">
<fixcrlf srcdir="." includes="**/*.php, **/*.xml, **/*.properties, **/*.ini" tab="remove"/>
</target>
<target name="checkout-site" unless="svn-available">
<exec executable="svn">
<arg value="co"/>
<arg value="${svnsite.url}"/>
<arg value="target/site-deploy"/>
</exec>
</target>
<target name="update-site" if="svn-available">
<exec executable="svn" dir="target/site-deploy" failonerror="true">
<arg value="update"/>
</exec>
</target>
<target name="post-site" depends="checkout-site, update-site"/>
<target name="mime=html">
<exec executable="svn">
<arg value="propset"/>
<arg value="svn:mime-type"/>
<arg value="text/html"/>
<arg value="${src.html}"/>
</exec>
</target>
<target name="mime=css">
<exec executable="svn">
<arg value="propset"/>
<arg value="svn:mime-type"/>
<arg value="text/css"/>
<arg value="${src.css}"/>
</exec>
</target>
<target name="site-deploy">
<!-- Add any new files (and generate innocuous warnings for the existing content) -->
<delete file="target/site-deploy/svn-commit.tmp~"/>
<exec executable="bash" dir="target/site-deploy" failonerror="true">
<arg line='-c "svn add --force *"'/>
</exec>
<foreach target="mime=html" param="src.html">
<path>
<fileset dir="target/site-deploy" includes="**/*.html"/>
</path>
</foreach>
<foreach target="mime=css" param="src.css">
<path>
<fileset dir="target/site-deploy" includes="**/*.css"/>
</path>
</foreach>
<!-- requires that SVN_EDITOR, VISUAL or EDITOR being set to edit commit description -->
<exec executable="svn" dir="target/site-deploy" failonerror="true">
<arg value="commit"/>
</exec>
</target>
</project>