-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.xml
148 lines (142 loc) · 5.31 KB
/
setup.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: setup.xml 2073 2010-09-18 22:16:24Z djb61 $ -->
<project name="DRFTPD Installer Project Helper" basedir=".">
<property name="build.debug" value="true" />
<property name="build.javac" value="1.7" />
<property name="build.optimize" value="false" />
<property name="build.verbose" value="true" />
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<!-- declare third party tasks -->
<typedef resource="org/java/plugin/tools/ant/jpf-tasks.properties">
<classpath refid="classpath" />
</typedef>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<!-- declare custom tasks -->
<taskdef resource="org/drftpd/tools/ant/drftpdtasks.properties" />
<!-- set plugin build timestamp -->
<tstamp>
<format property="build.plugins.start" pattern="yyyy.MM.dd HH:mm:ss.SSS" />
</tstamp>
<!-- define common macros for build and clean targets -->
<macrodef name="buildplugin">
<sequential>
<jpf-info manifest="${basedir}/plugin.xml"
propertyid="plugin.id"
propertyversion="plugin.version" />
<property name="plugin.home" value="${installdir}/${plugin.family}/${plugin.id}" />
<if>
<equals arg1="${devmode}" arg2="true" />
<then>
<echo>Building ${plugin.id} plug-in to directory ${plugin.home}</echo>
</then>
<else>
<echo>Building ${plugin.id} plug-in to file ${plugin.home}-${plugin.version}.zip</echo>
</else>
</if>
<resourcetask
basedir="${installdir}"
resourcedir="${basedir}/resources" />
<themetask
basedir="${installdir}"
plugindir="${basedir}/src" />
<property name="build.dir" value="${buildroot}/build/${plugin.family}/${plugin.id}" />
<mkdir dir="${build.dir}" />
<copy file="${basedir}/plugin.xml" todir="${build.dir}" />
<replaceregexp file="${build.dir}/plugin.xml"
match="(library\x20id.*?path=")(\.\.\/)(.*?lib\/.*\.jar)"
replace="\1..\/..\/\3"
byline="true" />
<jpf-path
basedir="${buildroot}"
pathid="plugin.classpath"
pluginid="${plugin.id}"
includes="build/core/*/plugin.xml,build/plugins/*/*/plugin.xml"
verbose="${build.verbose}" />
<copy file="${build.dir}/plugin.xml" tofile="${build.dir}/plugin.xml.bak" />
<if>
<equals arg1="${devmode}" arg2="false" />
<then>
<replaceregexp file="${build.dir}/plugin.xml"
match="classes\/"
replace="${plugin.id}-${plugin.version}\.jar"
byline="true" />
</then>
</if>
<property name="compile.dest" value="${build.dir}/classes" />
<mkdir dir="${compile.dest}" />
<javac destdir="${compile.dest}"
srcdir="${basedir}/src"
classpathref="plugin.classpath"
excludes="${compile.excludes}"
source="${build.javac}"
target="${build.javac}"
debug="${build.debug}"
optimize="${build.optimize}"
includeAntRuntime="false" />
<copy todir="${compile.dest}">
<fileset dir="${basedir}/src">
<include name="**/*.properties" />
<exclude name="**/*.*.properties" />
</fileset>
</copy>
<libcopytask />
<replaceregexp file="${build.dir}/plugin.xml"
match="(library\x20id.*?)(\.\.\/){3,}(lib\/.*\.jar)"
replace="\1..\/..\/\3"
byline="true" />
<if>
<equals arg1="${devmode}" arg2="true" />
<then>
<mkdir dir="${plugin.home}/classes" />
<copy todir="${plugin.home}/classes">
<fileset dir="${build.dir}/classes">
<include name="**/*.class" />
<include name="**/*.properties" />
<exclude name="**/*.*.properties" />
</fileset>
</copy>
<copy file="${build.dir}/plugin.xml" todir="${plugin.home}" />
</then>
<else>
<jar destfile="${build.dir}/${plugin.id}-${plugin.version}.jar">
<manifest>
<attribute name="Specification-Title" value="DrFTPd - ${plugin.id}" />
<attribute name="Specification-Version" value="${plugin.version}" />
<attribute name="Specification-Vendor" value="http://www.drftpd.org" />
<attribute name="Implementation-Title" value="${plugin.id}" />
<attribute name="Implementation-Version" value="${plugin.version}" />
<attribute name="Implementation-Vendor" value="http://www.drftpd.org" />
</manifest>
<fileset dir="${build.dir}/classes">
<include name="**/*.class" />
<include name="**/*.properties" />
<exclude name="**/*.*.properties" />
</fileset>
</jar>
<mkdir dir="${installdir}/${plugin.family}" />
<loggingziptask destfile="${installdir}/${plugin.family}/${plugin.id}-${plugin.version}.zip"
basedir="${build.dir}"
includes="*.jar,plugin.xml" />
</else>
</if>
<copy file="${build.dir}/plugin.xml.bak" tofile="${build.dir}/plugin.xml" overwrite="true" />
<delete file="${build.dir}/plugin.xml.bak" />
</sequential>
</macrodef>
<macrodef name="cleanplugin">
<sequential>
<jpf-info manifest="${basedir}/plugin.xml"
propertyid="plugin.id"
propertyversion="plugin.version" />
<property name="plugin.home" value="${installdir}/${plugin.family}/${plugin.id}" />
<echo>Cleaning ${plugin.id} plug-in</echo>
<!-- clean any existing build files -->
<delete dir="${buildroot}/build/${plugin.family}/${plugin.id}" />
<!-- to be safe clean out any existing installed copy also -->
<delete dir="${plugin.home}" />
<delete file="${plugin.home}-${plugin.version}.zip" />
</sequential>
</macrodef>
</project>