Ticket #235: build.xml

File build.xml, 7.0 kB (added by Oleg Marchuk <kingoleg@mail.ru>, 4 months ago)
Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <project name="BTE" default="all" basedir=".">
4         <property file="./build.properties" />
5
6         <property name="3rdParty.home" value="${project.home}/../3rdParty" />
7
8         <target name="all" description="Default target" depends="">
9         </target>
10
11         <target name="checkout" description="Checkout last updates from repository">
12                 <svncheckout
13                         username="${project.repository.user}"
14                         password="${project.repository.pass}"
15                         nocache="true"
16                         repositoryurl="${project.repository.url}"
17                         todir="${project.home}"/>
18         </target>
19
20         <target name="update" description="Update project from repository">
21                 <phing phingfile="${project.home}/../diy-telme/build.xml" target="update" dir="${project.home}/../diy-telme">
22                         <property name="project.home" value="${project.home}/../diy-telme"/>
23                 </phing>
24
25                 <svnupdate
26                         username="${project.repository.user}"
27                         password="${project.repository.pass}"
28                         todir="${3rdParty.home}"/>
29
30                 <svnupdate
31                         username="${project.repository.user}"
32                         password="${project.repository.pass}"
33                         todir="${project.home}"/>
34         </target>
35
36         <target name="clean" description="Clean build directory">
37                 <delete dir="${project.build.dir}" includeemptydirs="true" verbose="false" failonerror="false" />
38         </target>
39
40         <target name="init" description="Making build directory" depends="clean">
41                 <mkdir dir="${project.build.dir}" />
42         </target>
43
44         <target name="schema" description="Convert DBDesigner schema to propel schema">
45                 <property name="schema.file" value="${project.home}/schema.xml" />
46
47                 <available property="schema.file.exists" file="${schema.file}" />
48
49                 <if>
50                         <equals arg2="true" arg1="${schema.file.exists}" />
51                         <then>
52                                 <echo msg="Copy old schema.xml..." />
53                                 <move overwrite="true" tofile="${schema.file}~" file="${schema.file}" />
54                         </then>
55                 </if>
56
57                 <xslt overwrite="true"
58                         tofile="${schema.file}"
59                         file="${dbd4.schema.file}"
60                         style="${dbd2propel.file}">
61                         <param name="db-name" value="${propel.database.name}" />
62                 </xslt>
63         </target>
64
65         <target name="om" description="Generate propel model">
66                 <!-- TODO call target -->
67                 <exec command="propel-gen ." dir="${project.home}" checkreturn="true" />
68         </target>
69
70         <target name="propel-convert-conf" description="Regenerate Propel conf file">
71                 <!-- TODO call target -->
72                 <exec command="propel-gen . convert-conf" dir="${project.home}" checkreturn="true" />
73         </target>
74
75         <target name="apidoc" description="Generate API documentation" depends="init, om">
76
77                 <phpdoc title="API Documentation"
78                         destdir="${project.build.dir}/docs/apidocs"
79                         output="HTML:frames:default"
80                         defaultPackageName="${project.name}"
81                         sourcecode="no">
82                         <fileset dir="${project.home}/classes">
83                                 <include name="**/*.php" />
84                         </fileset>
85                         <projdocfileset dir="${project.home}">
86                                 <include name="files.txt" />
87                                 <include name="install.txt" />
88                         </projdocfileset>
89                 </phpdoc>
90         </target>
91
92         <target name="test" description="Test" depends="init, om">
93                 <includepath classpath="${propel.php.dir}" />
94                 <includepath classpath="${pear.home}/propel"/>
95
96                 <mkdir dir="${project.build.dir}/reports" />
97                 <mkdir dir="${project.build.dir}/reports/tests" />
98
99                 <phpunit2 haltonfailure="true" haltonerror="true">
100                         <formatter todir="${project.build.dir}/reports" type="xml"/>
101                         <batchtest>
102                                 <fileset dir="tests">
103                                         <include name="**/*Test*.php"/>
104                                 </fileset>
105                         </batchtest>
106                 </phpunit2>
107
108                 <phpunit2report infile="${project.build.dir}/reports/testsuites.xml" format="frames" todir="${project.build.dir}/reports/tests" styledir="${pear.home}/data/phing/etc"/>
109         </target>
110
111         <target name="static" description="Aggregate static contents">
112                 <!-- This is the statical contents build target -->
113                
114                 <mkdir dir="${project.home}/static/build"/>
115                 <mkdir dir="${project.home}/static/build/${project.static.version}"/>
116                 <mkdir dir="${project.home}/static/build/${project.static.version}/js"/>
117                 <mkdir dir="${project.home}/static/build/${project.static.version}/js/lang"/>
118                 <mkdir dir="${project.home}/static/build/${project.static.version}/js/component"/>
119                 <mkdir dir="${project.home}/static/build/${project.static.version}/css"/>
120                
121
122                 <exec command="misc/yuicompressor.sh '${yui.compressor.command}' ${project.home}/static/js/lib ${project.home}/static/build/${project.static.version}/js/core.js -merge" />
123                 <exec command="misc/yuicompressor.sh '${yui.compressor.command}' ${project.home}/static/js/component ${project.home}/static/build/${project.static.version}/js/component" />
124                 <exec command="misc/yuicompressor.sh '${yui.compressor.command}' ${project.home}/static/js/lang ${project.home}/static/build/${project.static.version}/js/lang" />     
125                 <exec command="misc/yuicompressor.sh '${yui.compressor.command}' ${project.home}/static/css/main ${project.home}/static/build/${project.static.version}/css/main.css -merge" />
126
127         </target>
128        
129        
130        
131         <target name="build" description="Build project in build directory" depends="init, update, test">
132                 <echo>Build project '${project.name}' into ${project.build.dir}</echo>
133
134                 <copy todir="${project.build.dir}">
135                         <fileset dir="${project.home}">
136                                 <include name="build.properties" />
137                                 <include name="build.xml" />
138                                 <include name="classes/**/*" />
139                                 <include name="runtime-conf.xml" />
140                                 <include name="schema-transformed.xml" />
141                                 <include name="schema.xml" />
142                                 <include name="*.txt" />
143                                 <exclude name="**/.svn/*" />
144                                 <exclude name="**/.svn" />
145                         </fileset>
146                 </copy>
147                 <!-- TODO propel-gen . convert-conf     -->
148         </target>
149
150         <target name="dist" description="Make distributive" depends="init">
151                 <svnlastrevision
152                         workingcopy="${project.home}"
153                         propertyname="project.revision"/>
154                 <echo>Project '${project.name}' last vertion is ${project.revision}</echo>
155
156                 <phingcall target="build">
157                         <property name="project.build.dir" value="${project.build.dir}/${project.revision}/" />
158                 </phingcall>
159
160                 <phingcall target="dist-3rdParty">
161                         <property name="project.build.dir" value="${project.build.dir}/${project.revision}/" />
162                 </phingcall>
163
164                 <tar destfile="${project.build.dir}/${project.name}-${project.revision}.tar.gz" compression="gzip">
165                         <fileset dir="${project.build.dir}/${project.revision}">
166                                 <include name="**/**" />
167                         </fileset>
168                 </tar>
169         </target>
170
171         <target name="dist-3rdParty" description="Make distributive for 3rdParties">
172                 <svnlastrevision
173                         workingcopy="${3rdParty.home}"
174                         propertyname="3rdParty.revision"/>
175                 <echo>3rdParty last vertion is ${3rdParty.revision}</echo>
176
177                 <tar destfile="${project.build.dir}/3rdParty-${3rdParty.revision}.tar.gz" compression="gzip">
178                         <fileset dir="${3rdParty.home}">
179                                 <include name="**/**" />
180                         </fileset>
181                 </tar>
182
183         </target>
184
185         <target name="log" description="Clear logs">
186                 <delete>
187                         <fileset dir="${project.home}">
188                                 <include name="*.log" />
189                         </fileset>
190                 </delete>
191                 <touch file="propel.log" />
192                 <touch file="diy.log" />
193                 <chmod mode="0666">
194                         <fileset dir="${project.home}">
195                                 <include name="*.log" />
196                         </fileset>
197                 </chmod>
198         </target>
199        
200         <target name="dep" description="Check system dependencies">
201                 <exec command="php ${project.home}/misc/dependencies.php" passthru="yes" checkreturn="true"/>
202         </target>
203
204         <!-- TODO create app -->
205 </project>