d9ca6d5ddf8fbf0e90354e765d1e67ddcc225411
[php-sqllint.git] / build.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="php-sqllint" default="phar" basedir=".">
3
4  <property name="version"  value="0.0.1" />
5  <property name="pharfile" value="${phing.dir}/dist/${phing.project.name}-${version}.phar" />
6  <property name="pharfilebz2" value="${phing.dir}/dist/${phing.project.name}-${version}.bz2.phar" />
7  <property name="libdir" value="${phing.dir}/lib"/>
8
9  <fileset id="fs.phar" dir="${phing.dir}">
10   <include name="bin/**"/>
11   <include name="lib/**"/>
12   <include name="src/**"/>
13
14   <include name="README.rst"/>
15
16   <include name="vendor/autoload.php"/>
17   <include name="vendor/composer/*.php"/>
18   <include name="vendor/pear/console_commandline/Console/**"/>
19   <include name="vendor/pear/pear_exception/PEAR/**"/>
20   <include name="vendor/udan11/sql-parser/src/**"/>
21  </fileset>
22
23
24  <typedef name="pearPackageFileSet" classname="phing.types.PearPackageFileSet" />
25
26  <target name="phar" depends="collectdeps"
27          description="Create zip file for release"
28  >
29   <!-- strip the shebang from bin script -->
30   <copy file="${phing.dir}/bin/php-sqllint" tofile="${phing.dir}/bin/phar-php-sqllint.php">
31    <filterchain>
32     <striplinecomments>
33      <comment value="#" />
34     </striplinecomments>
35    </filterchain>
36   </copy>
37
38   <mkdir dir="${phing.dir}/dist"/>
39   <delete file="${pharfile}"/>
40   <pharpackage basedir="${phing.dir}"
41    destfile="${pharfile}"
42    stub="${phing.dir}/src/stub-phar.php"
43    alias="php-sqllint.phar"
44    compression="none"
45   >
46    <fileset refid="fs.phar"/>
47   </pharpackage>
48
49   <pharpackage basedir="${phing.dir}"
50    destfile="${pharfilebz2}"
51    stub="${phing.dir}/src/stub-phar.php"
52    alias="php-sqllint.phar"
53    compression="bzip2"
54   >
55    <fileset refid="fs.phar"/>
56   </pharpackage>
57
58   <exec executable="chmod">
59    <arg value="+x"/>
60    <arg value="${pharfile}"/>
61    <arg value="${pharfilebz2}"/>
62   </exec>
63  </target>
64
65
66  <target name="collectdeps" description="Copy package dependencies to lib/">
67   <exec command="composer install"/>
68   <!--
69   <delete dir="${libdir}"/>
70   <mkdir dir="${libdir}"/>
71
72   <pearPackageFileset id="dep-Console_CommandLine" package="pear.php.net/Console_CommandLine"/>
73   <pearPackageFileset id="dep-PEAR" package="pear.php.net/PEAR">
74    <include name="PEAR/Exception.php"/>
75   </pearPackageFileset>
76
77   <copy todir="${libdir}">
78    <fileset refid="dep-Console_CommandLine"/>
79    <fileset refid="dep-PEAR"/>
80   </copy>
81   -->
82  </target>
83
84
85  <target name="docs" description="render documentation">
86   <rst file="README.rst"/>
87  </target>
88
89 </project>