6bcd68ae6e597cf5c680ea47d6102e91efe5ad02
[surrogator.git] / build.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="surrogator" default="zip" basedir=".">
3   <!--
4     surrogator phing build file.
5     This script should provide a one-stop tool for all administrative
6     tasks around surrogator, like creating a release version,
7     tagging a release
8   -->
9   <property file="build.properties" />
10
11   <property name="version-m"  value="0.1" />
12   <property name="version"    value="0.1.0" />
13   <property name="stability"  value="alpha" />
14   <property name="zipfile"     value="${phing.project.name}-${version}.tar.bz2" />
15   <property name="distfile"    value="dist/${zipfile}" />
16   <property name="sfproject"   value="surrogator" />
17   <property name="sffilepath"  value="s/su/surrogator/" />
18
19   <fileset id="fs.zip" dir=".">
20    <include name="data/surrogator.config.php.dist"/>
21    <include name="raw/.keep"/>
22    <include name="res/**"/>
23    <include name="www/.htaccess"/>
24    <include name="www/avatar.php"/>
25    <include name="surrogator.php"/>
26    <include name="ChangeLog"/>
27    <include name="LICENSE"/>
28    <include name="README.rst"/>
29    <exclude name="**/.gitignore"/>
30   </fileset>
31
32   <target name="zip" depends="check"
33    description="Create zip file for release"
34    >
35     <!--
36       The release file is for end users, so it is safe to
37       remove anything developer-related.
38
39       Test your bz2 with: tar -jtvf surrogator-0.1.0.tar.bz2
40     -->
41     <echo msg="Creating distribution zip for ${phing.project.name} ${version}"/>
42     <delete file="${distfile}" failonerror="false"/>
43     <tar compression="bzip2" destfile="${distfile}"
44          prefix="${phing.project.name}-${version}/"
45     >
46      <fileset refid="fs.zip"/>
47     </tar>
48   </target>
49
50
51   <target name="release" depends="check,zip,deploy-sf"
52    description="Release the version on sourceforge"
53    >
54    <!-- meta-target -->
55   </target>
56
57
58   <!--
59   /home/frs/project/s/su/surrogator/v0.1/
60   /home/frs/project/s/su/surrogator/v0.1/surrogator-v0.1.0.zip
61   /home/frs/project/s/su/surrogator/v0.1/surrogator-v0.1.1.zip
62   https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download
63   -->
64   <target name="deploy-sf" depends="check,zip"
65    description="Upload release to sourceforge"
66    >
67     <delete dir="dist/deploy-sf" /><!-- make empty -->
68     <mkdir dir="dist/deploy-sf" />
69     <mkdir dir="dist/deploy-sf/v${version-m}" />
70     <copy file="${distfile}" tofile="dist/deploy-sf/v${version-m}/${zipfile}"/>
71     <!-- test
72     <exec command="rsync -av dist/deploy-sf/ /tmp/test/" escape="false" />
73     -->
74     <exec
75      command="rsync -av -e ssh dist/deploy-sf/ ${sfuser},${sfproject}@frs.sourceforge.net:/home/frs/project/${sffilepath}/"
76      escape="false" checkreturn="false"
77      />
78     <!-- rsync always returns code 23 on sourceforge releases, so we
79          can't check return values -->
80   </target>
81
82
83   <target name="check"
84    description="Check variables"
85    >
86     <fail unless="version" message="Version not defined!" />
87     <fail unless="sfuser" message="Sourceforge username not defined!" />
88     <fail unless="sfproject" message="Sourceforge project name not defined!" />
89     <fail unless="sffilepath" message="Sourceforge project file path not defined!" />
90
91     <mkdir dir="dist" />
92   </target>
93
94 </project>