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

Last change on this file since 1251 was 1251, checked in by Nicklas Nordborg, 13 years ago

The torrent service is now also creating a Bittorrent Client in it's start() method and closing it in the stop() method.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.6 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="external.classpath">
52    <fileset dir="lib">
53      <include name="**/*.jar" />
54    </fileset>
55  </path>
56
57  <path id="classpath">
58    <path refid="external.classpath" />
59    <pathelement location="${build}/external/hpbtc" />
60  </path>
61
62  <target name="init">
63    <mkdir dir="${build}" />
64  </target>
65   
66  <target name="clean">
67    <delete failonerror="false" includeemptydirs="true">
68      <fileset dir="${build}" defaultexcludes="no" />
69      <fileset file="${jar.name}" />
70      <fileset file="lib/torrent/hpbtc.jar" />
71      <fileset file="${tar.name}" />
72    </delete>
73  </target>
74 
75  <target
76    name="package"
77    depends="clean,jar"
78    description="Clean and create binary distribution package"
79    >
80    <tar
81      destfile="${tar.name}"
82      longfile="gnu"
83      compression="gzip"
84      >
85      <tarfileset
86        dir="."
87        prefix="${tar.prefix}"
88        preserveLeadingSlashes="true"
89        includes="${jar.name},README,LICENSE*,torrent.properties,lib/torrent/*"
90      />
91    </tar>
92  </target>
93 
94  <target 
95    name="jar"
96    depends="build,jar.external"
97    description="Creates the extension JAR file"
98    >
99    <jar 
100      jarfile="${jar.name}"
101      manifest="META-INF/MANIFEST.MF"
102      >
103      <fileset dir="${build}/main" />
104      <fileset dir="." includes="META-INF/**" />
105      <fileset dir="." includes="resources/**" />
106    </jar>
107  </target>
108 
109  <target
110    name="jar.external"
111    >
112    <jar
113      jarfile="lib/torrent/hpbtc.jar"
114      >
115      <fileset dir="${build}/external/hpbtc" />
116    </jar>
117  </target>
118 
119  <target 
120    name="build"
121    depends="init,checkjar,build.external"
122    description="Compiles the plugin and put in jar"
123    >
124    <mkdir dir="${build}/main" />
125    <javac 
126      srcdir="${src}/main" 
127      destdir="${build}/main" 
128      debug="true" 
129      classpathref="classpath"
130      encoding="${javac.encoding}" 
131      source="${javac.source}"
132      target="${javac.target}"
133      includeantruntime="false"
134      >
135      <compilerarg value="${javac.arg}" />
136    </javac>
137  </target>
138 
139  <target
140    name="build.external"
141    >
142    <mkdir dir="${build}/external/hpbtc" />
143    <javac 
144      srcdir="${src}/external/hpbtc" 
145      destdir="${build}/external/hpbtc" 
146      debug="true" 
147      classpathref="external.classpath"
148      encoding="${javac.encoding}" 
149      source="${javac.source}"
150      target="${javac.target}"
151      includeantruntime="false"
152      >
153      <!--compilerarg value="${javac.arg}" / -->
154    </javac>
155  </target>
156 
157  <target 
158    name="checkjar"
159    description="Checks that the BASE2Core.jar and BASE2Webclient.jar exists."
160    >
161    <available classname="net.sf.basedb.core.Application" 
162      classpathref="classpath" property="base2core" />
163    <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" 
164      classpathref="classpath" property="base2web" />
165    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
166    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
167    <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo>
168  </target>
169 
170  <target 
171    name="download-lib"
172    description="Download BASE2Core.jar and BASE2Webclient.jar."
173    >
174    <echo>
175-------------------------------------------------------   
176NOTE! You may specifiy a different download location by
177creating the file './build.properties' and
178setting 'depend.jars' to the URL to download from.
179-------------------------------------------------------
180    </echo>
181    <download-lib file="BASE2Core.jar" />
182    <download-lib file="BASE2Webclient.jar" />
183  </target>
184 
185  <macrodef name="download-lib" description="Download BASE core JAR files">
186    <attribute name="file" />
187    <sequential>
188      <get 
189        dest="lib/compile/@{file}" 
190        src="${depend.jars}/@{file}" 
191        usetimestamp="true" 
192        verbose="true"
193        ignoreerrors="true"
194      />
195    </sequential>
196  </macrodef>
197</project>
Note: See TracBrowser for help on using the repository browser.