~bentokitdevs/retromod/programs

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
<project name="retromod" default="dist" basedir=".">
  <!-- Create the time stamp -->
  <tstamp/>

    <description>
        Retromod 2.0 - Snowy Variant
    </description>
  <!-- set global properties for this build -->
  <property name="platform" value="${os.name}" />

  <property name="build.compiler" value="javac1.6"/>
  <property name="packagepath" value="org/tudorholton/retromod"/>
  <property name="src" location="src/${packagepath}"/>
  <property name="bin" location="bin"/>
  <property name="build" location="build"/>
  <property name="jarname" value="Retromod"/>
  <property name="mainclass" value="Retromod"/>
  <property name="package"  value="org.tudorholton.retromod"/>
  <property name="package.name"  value="retromod-programs"/>
  <property name="package.section"  value="devel"/>
  <property name="classpath"  location="${build}/classes" />
  <property file="build.${platform}.properties"/>
  <property name="version" value="0.2.0"/>
  <property name="package.upstream.version" value="${version}.${DSTAMP}"/>
  <property name="package.maintainer.name" value="Tudor Holton"/>
  <property name="package.maintainer.email" value="tudor@tudorholton.com"/>
  <property name="package.synopsis" value="An web application for a radio sponsorship system."/>
  <property name="package.description" value="Retromod is platform for developing web applications."/>
  <property name="versionsuffix" value=""/>
  <property name="releasetype" value="custom"/>
  <property name="arch" value="x86"/>

  <taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
      <pathelement location="compile_lib/ant-contrib-1.0b3.jar"/>
    </classpath>
  </taskdef>

  <taskdef name="nsis" classname="net.sf.nsisant.Task"> 
      <classpath location="compile_lib/nsisant-1.2.jar"/>
  </taskdef>
  <taskdef name="debian-package" classname="com.googlecode.ant_deb_task.Deb"> 
      <classpath location="compile_lib/ant-deb-0.0.1.jar"/>
  </taskdef>
  <taskdef name="desktopEntry" classname="com.googlecode.ant_deb_task.DesktopEntry">
      <classpath location="compile_lib/ant-deb-0.0.1.jar"/>
  </taskdef>

  <!-- <target name="dist" depends="dist-i386, dist-amd64" description="build all the deb files"/> -->
    
  <target name="dist">
    <switch value="${platform}">
        <case value="Linux">    
          <mkdir dir="${build}"/>
          <mkdir dir="${build}/tarprep"/>
          <copy todir="${build}/tarprep">
              <fileset dir="src"/>
          </copy>
          <copy file="LICENSE.txt" tofile="${build}/tarprep/Retromod-Programs-LICENSE.txt" />
          <tar longfile="gnu" destfile="${build}/${package.name}-${releasetype}-${platform}-x86-0_1-${DSTAMP}.tar" basedir="${build}/tarprep" />
        <tstamp>
            <format property="changelog.date" pattern="EEE, dd MMM yyyy" />
        </tstamp>
        <if>
            <not>
              <equals arg1="${message}" arg2="" />
            </not>
            <then>
                <echo file="docs/changelog" append="yes" message="${changelog.date} ${package.upstream.version} ${message}" />
            </then>
        </if>
       <!-- Check today's date exists in the changelog! -->
       <fail message="Need to create a changelog file.  Use dch --create -c docs/changelog.">
           <condition>            
               <not>
                   <available file="docs/changelog" />
               </not>
           </condition>
       </fail>
       <loadfile srcFile="docs/changelog" property="changelog" />
       <fail message="Need to modify the changelog to include today's date and version!  Need to see ${changelog.date} and ${package.upstream.version}">

           <condition>            
               <or>
                   <not>
                        <contains substring="${changelog.date}" string="${changelog}" />
                   </not>
                   <not>
                        <contains substring="${package.upstream.version}" string="${changelog}" />
                   </not>
               </or>
           </condition>
       </fail>
       <mkdir dir="dist"/>
       <mkdir dir="dist/linux"/>
       <mkdir dir="dist/linux/${releasetype}"/>
       <debian-package
                package="${package.name}"
                todir="dist/linux/${releasetype}"
                section="${package.section}"                    
                depends="retromod"
                suggests="phpmyadmin"
                postinst="installer_files/Linux/postinst"
                prerm="installer_files/Linux/prerm"
                postrm="installer_files/Linux/postrm"
                templates="installer_files/Linux/templates">
            <version upstream="${package.upstream.version}"/>
            <maintainer name="${package.maintainer.name}" email="${package.maintainer.email}"/>
            <description synopsis="${package.synopsis}">${package.description}</description>
            <changelog file="docs/changelog" />
            <tarfileset dir="${build}/tarprep" prefix="usr/share/retromod" />
      </debian-package>
        </case>
        <case value="Windows">    
          <mkdir dir="${build}"/>
          <mkdir dir="${build}/zipprep"/>
          <copy todir="${build}/zipprep">
              <fileset dir="src"/>
          </copy>
          <mkdir dir="dist"/>
          <mkdir dir="dist/windows"/>
          <mkdir dir="dist/windows/${releasetype}"/>
          <copy file="LICENSE.txt" tofile="${build}/zipprep/Retromod-Programs-LICENSE.txt" />
          <zip destfile="dist/windows/${releasetype}/retromod-${releasetype}-${platform}-x86-0_2_0-${DSTAMP}.zip" basedir="${build}/zipprep" />
        </case>
        <default>
            <fail message="I don't yet know how to build an installer for ${platform}" />
        </default>
    </switch>
  </target>

  <target name="zip">
      <mkdir dir="${build}"/>
      <mkdir dir="${build}/zipprep"/>
      <mkdir dir="${build}/zipprep/bin"/>
      <copy todir="${build}/zipprep/bin">
          <fileset dir="bin"/>
      </copy>
      <copy file="${build}/jar/${jarname}.jar" todir="${build}/zipprep" />
      <copy file="LICENSE.txt" tofile="${build}/zipprep/Retromod-Programs-LICENSE.txt" />
      <zip destfile="${build}/Retromod-${releasetype}-${platform}-x86-0_1-${DSTAMP}.zip" basedir="${build}/zipprep" level="9" />
  </target>



  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac debug="true" srcdir="${src}" destdir="${build}/classes"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>