source: extensions/net.sf.basedb.torrent/trunk/build.xml @ 1245

Last change on this file since 1245 was 1245, checked in by Nicklas Nordborg, 12 years ago

Setting up initial directory structure, build file, readme, etc.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3  $Id $
4
5  Copyright (C) 2010 Nicklas Nordborg
6
7  This file is part of Bittorent download service for BASE.
8  Available at http://baseplugins.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330,
23  Boston, MA  02111-1307, USA.
24-->
25<project 
26  name="BittorentService" 
27  default="jar" 
28  basedir=".">
29
30  <!--create this file if you need to override values from properties below -->
31  <property file="build.properties" />
32 
33  <!-- variables used -->
34  <property name="name" value="base-torrent" />
35  <property name="version" value="0.2pre" />
36  <property name="src" location="src" description="Location of source files" />
37  <property name="build" location="build" description="Location of compiled files" />
38  <property name="jar.name" value="${name}.jar" 
39    description="Name of JAR file with the extensions." />
40  <property name="tar.prefix" value="${name}-${version}" 
41    description="Prefix of .tar.gz file for download." />
42  <property name="tar.name" value="${tar.prefix}.tar.gz" 
43    description="Full name of .tar.gz file for download." />
44  <property name="javac.arg" value="-Xlint:unchecked" />
45  <property name="javac.source" value="1.5" />
46  <property name="javac.target" value="1.5" />
47  <property name="javac.encoding" value="UTF-8" />
48  <property name="depend.jars" value="http://base2.thep.lu.se/base/jars/2.16.0" />
49
50  <!-- set up classpath for compiling -->
51  <path id="classpath">
52    <fileset dir="lib">
53      <include name="**/*.jar" />
54    </fileset>
55  </path>
56
57  <target name="init">
58    <mkdir dir="${build}" />
59  </target>
60   
61  <target name="clean">
62    <delete failonerror="false" includeemptydirs="true">
63      <fileset dir="${build}" defaultexcludes="no" />
64      <fileset file="${jar.name}" />
65      <fileset file="lib/torrent/hpbtc.jar" />
66      <fileset file="${tar.name}" />
67    </delete>
68  </target>
69 
70  <target
71    name="package"
72    depends="clean,jar"
73    description="Clean and create binary distribution package"
74    >
75    <tar
76      destfile="${tar.name}"
77      longfile="gnu"
78      compression="gzip"
79      >
80      <tarfileset
81        dir="."
82        prefix="${tar.prefix}"
83        preserveLeadingSlashes="true"
84        includes="${jar.name},README,LICENSE*,lib/torrent/*"
85      />
86    </tar>
87  </target>
88 
89  <target 
90    name="jar"
91    depends="build,jar.external"
92    description="Creates the extension JAR file"
93    >
94    <jar 
95      jarfile="${jar.name}"
96      manifest="META-INF/MANIFEST.MF"
97      >
98      <fileset dir="${build}/main" />
99      <fileset dir="." includes="META-INF/**" />
100      <fileset dir="." includes="resources/**" />
101    </jar>
102  </target>
103 
104  <target
105    name="jar.external"
106    >
107    <jar
108      jarfile="lib/torrent/hpbtc.jar"
109      >
110      <fileset dir="${build}/external/hpbtc" />
111    </jar>
112  </target>
113 
114  <target 
115    name="build"
116    depends="init,checkjar,build.external"
117    description="Compiles the plugin and put in jar"
118    >
119    <mkdir dir="${build}/main" />
120    <javac 
121      srcdir="${src}/main" 
122      destdir="${build}/main" 
123      debug="true" 
124      classpathref="classpath"
125      encoding="${javac.encoding}" 
126      source="${javac.source}"
127      target="${javac.target}"
128      includeantruntime="false"
129      >
130      <compilerarg value="${javac.arg}" />
131    </javac>
132  </target>
133 
134  <target
135    name="build.external"
136    >
137    <mkdir dir="${build}/external/hpbtc" />
138    <javac 
139      srcdir="${src}/external/hpbtc" 
140      destdir="${build}/external/hpbtc" 
141      debug="true" 
142      classpathref="classpath"
143      encoding="${javac.encoding}" 
144      source="${javac.source}"
145      target="${javac.target}"
146      includeantruntime="false"
147      >
148      <compilerarg value="${javac.arg}" />
149    </javac>
150  </target>
151 
152  <target 
153    name="checkjar"
154    description="Checks that the BASE2Core.jar and BASE2Webclient.jar exists."
155    >
156    <available classname="net.sf.basedb.core.Application" 
157      classpathref="classpath" property="base2core" />
158    <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" 
159      classpathref="classpath" property="base2web" />
160    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
161    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
162    <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo>
163  </target>
164 
165  <target 
166    name="download-lib"
167    description="Download BASE2Core.jar and BASE2Webclient.jar."
168    >
169    <echo>
170-------------------------------------------------------   
171NOTE! You may specifiy a different download location by
172creating the file './build.properties' and
173setting 'depend.jars' to the URL to download from.
174-------------------------------------------------------
175    </echo>
176    <download-lib file="BASE2Core.jar" />
177    <download-lib file="BASE2Webclient.jar" />
178  </target>
179 
180  <macrodef name="download-lib" description="Download BASE core JAR files">
181    <attribute name="file" />
182    <sequential>
183      <get 
184        dest="lib/compile/@{file}" 
185        src="${depend.jars}/@{file}" 
186        usetimestamp="true" 
187        verbose="true"
188        ignoreerrors="true"
189      />
190    </sequential>
191  </macrodef>
192</project>
Note: See TracBrowser for help on using the repository browser.