-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-plugin.xml
316 lines (276 loc) · 13.5 KB
/
build-plugin.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<project name="AntelopePlugin" default="dist" basedir=".">
<description>
This build file creates Antelope as a jEdit plugin.
</description>
<!-- ========================================================================
Set properties: These first few properties can/should be overridden in
either build.props or on the command line. The default values may or may
not work.
========================================================================= -->
<!-- read build.props to override properties set below -->
<property file="../build.properties" />
<property file="build.props"/>
<!-- default location of jedit.jar -->
<property name="jedit.install.dir" value="../.."/>
<!-- default location of the finished plugin -->
<property name="install.dir" value=".." />
<!-- version number -->
<property name="build.num" value="3.2"/>
<!-- ========================================================================
Set properties: These properties should not need to be changed.
========================================================================= -->
<!-- source code directory, this is where the .java files live -->
<property name="src.dir" location="src" />
<!-- build directory, all files contained in the src directory are copied
to this directory for processing (tag substitution, mostly) -->
<property name="prep.dir" location="prep"/>
<!-- configuration directory, this is where the configuration files for the
plugin are placed for pre-processing prior to getting jarred. -->
<property name="config.dir" location="${prep.dir}/config" />
<!-- documentation directory, this is where the plugin documentation
files live. Files in this directory will be distributed with the plugin -->
<property name="doc.dir" location="${prep.dir}/docs" />
<!-- the directory for the compiled classes. Files in this directory will be
included in the finished jar file. -->
<property name="classes.dir" location="classes" />
<!-- where to put the finished distribution file -->
<property name="dist.dir" location="dist"/>
<!-- ========================================================================
Target: dist
this target does several things:
first, it creates a jar file in the prep directory. This is a finished
jar file suitable for dropping into jEdit.
second, it copies the jar file to $install.dir
third, it zips the jar file and installation docs into $dist.dir
========================================================================= -->
<target name="dist"
description="Compiles, jars, puts the jar in the jEdit jars directory."
depends="init, compile, prep_files, copy_resources">
<!-- depends="init, compile, docs-xalan, prep_files, copy_resources"> -->
<!-- make the jar file. jEdit standards require just the name of the
plugin, e.g. Antelope.jar. put it in $prep.dir -->
<tstamp/>
<jar jarfile="${prep.dir}/${ant.project.name}.jar">
<manifest>
<attribute name="AppName" value="${ant.project.name}" />
<attribute name="AppVersion" value="${build.num}" />
<attribute name="Author" value="Dale Anson" />
<attribute name="Created-By" value="${user.name}"/>
<attribute name="Created-On" value="${TODAY}"/>
</manifest>
<fileset dir="${classes.dir}">
<include name="**/*" />
<include name="**/ise/antelope/launcher/**/*"/>
<include name="**/ise/antelope/tasks/**/*"/>
<exclude name="**/com/**/*"/>
<exclude name="**/common/builder/**/*"/>
<exclude name="**/common/dependency/**/*"/>
<exclude name="**/testcases/**/*"/>
</fileset>
<fileset dir="${doc.dir}">
<include name="**/*" />
</fileset>
<fileset dir="${config.dir}">
<include name="**/*" />
</fileset>
</jar>
<!-- copy the jar to the right place per jEdit standards -->
<copy file="${prep.dir}/${ant.project.name}.jar" todir="${install.dir}"/>
<!-- zip the jar and installation instructions and put the zip file in
the $dist directory -->
<!--
<zip destfile="${dist.dir}/${ant.project.name}Plugin_${build.num}.zip">
<zipfileset prefix="${ant.project.name}Plugin_${build.num}" dir="${prep.dir}">
<include name="${ant.project.name}.jar"/>
</zipfileset>
<zipfileset prefix="${ant.project.name}Plugin_${build.num}" dir="${prep.dir}/docs">
<include name="license.txt"/>
<include name="plugin_readme.txt"/>
<include name="ChangeLog.txt"/>
</zipfileset>
</zip>
-->
</target>
<!-- ========================================================================
Target: set classpath
========================================================================= -->
<target name="setClasspath">
<path id="classpathref">
<!-- include classes directory -->
<pathelement location="${classes.dir}" />
<!-- include standard classpath, need ant jars -->
<pathelement path="${java.class.path}"/>
<!-- include jedit.jar and dependent plugins -->
<pathelement location="${jedit.install.dir}/jedit.jar" />
<fileset dir="${install.dir}">
<include name="**/Console*.jar"/>
<include name="**/ErrorList*.jar"/>
</fileset>
</path>
</target>
<!-- ========================================================================
Target: clean
deletes all files from the build directory
========================================================================= -->
<target name="clean" description="Delete all files from the classes directory.">
<delete>
<fileset dir="${classes.dir}" includes="**/*" />
<fileset dir="${prep.dir}">
<include name="**/*"/>
<exclude name="docs/**/*"/>
</fileset>
</delete>
</target>
<!-- ========================================================================
Target: compile
========================================================================= -->
<target name="compile"
description="Compile"
depends="init,setClasspath">
<javac deprecation="on"
debug="on"
nowarn="on"
destdir="${classes.dir}"
srcdir="${src.dir}"
source="1.6"
target="1.6">
<classpath refid="classpathref" />
<exclude name="testcases/**/*"/>
<exclude name="**/app/**/*"/>
<!-- this next bit is excluded until it is good -->
<exclude name="**/common/gui/*"/>
<exclude name="**/common/builder/*"/>
<exclude name="**/common/dependency/*"/>
<exclude name="**/com/wutka/**"/>
</javac>
</target>
<!-- ========================================================================
Target: docs-xalan
Generate docs from docbook format xml files with Xalan. This uses the
files in ${src.dir}/docs and puts the finished files in ${prep.dir}/docs.
The files are NOT ready for distribution until after prep_files is ran.
========================================================================= -->
<target name="docs-xalan"
description="Generate user documentation in hmtl format with xalan"
depends="init,setClasspath,prep_files">
<fail unless="docbook.xsl" message="Please set docbook.xsl property."/>
<delete>
<fileset dir="${doc.dir}" includes="manual/**/*" />
</delete>
<copy todir="${doc.dir}/manual">
<fileset dir="${src.dir}/docs/manual" includes="**/*.gif" />
<fileset dir="${src.dir}/docs/manual" includes="**/*.css" />
</copy>
<property name="docbook-wrapper" location="${doc.dir}/docbook-wrapper.xsl"/>
<delete file="${docbook-wrapper}" />
<echo file="${docbook-wrapper}"
message="<xsl:stylesheet"/>
<echo file="${docbook-wrapper}" append="true"
message=" xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"/>
<echo file="${docbook-wrapper}" append="true"
message=" version='1.0'>"/>
<echo file="${docbook-wrapper}" append="true"
message="<xsl:import href='${docbook.xsl}/html/chunk.xsl'/>"/>
<echo file="${docbook-wrapper}" append="true"
message="</xsl:stylesheet>"/>
<!--
<xslt basedir="${src.dir}/docs/manual"
style="${docbook-wrapper}"
destdir="${doc.dir}/manual"
includes="userguide.xml">
<param name="html.stylesheet" expression="./style.css"/>
</xslt>
-->
<xslt basedir="${src.dir}/docs/manual"
destdir="${doc.dir}/manual"
includes="userguide.xml"
extension=".html"
style="${docbook-wrapper}"/>
<replace dir="${doc.dir}/manual" encoding="ISO-8859-1">
<replacefilter token="@buildnum@" value="${build.num}"/>
<replacefilter token="@tstamp@" value="${TODAY}" />
<replacefilter token="@style@"
value="<STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>" />
</replace>
</target>
<!-- ========================================================================
Target: copy_resources
========================================================================= -->
<target name="copy_resources">
<copy todir="${classes.dir}/images">
<fileset dir="${src.dir}/images" includes="**/*" />
</copy>
<copy todir="${classes.dir}/ise/antelope/tasks">
<fileset dir="${src.dir}/ise/antelope/tasks" includes="antelope.taskdefs"/>
<fileset dir="${src.dir}/ise/antelope/tasks" includes="antlib.xml"/>
</copy>
<copy todir="${classes.dir}/ise/antelope/common" file="${src.dir}/ise/antelope/common/version.txt"/>
</target>
<!-- ========================================================================
Target: prep_files
prepares certain files for distribution by doing string replacement.
Assumes that the configuration files and documentation files are ready.
========================================================================= -->
<target name="prep_files"
description="Prepare files for distribution.">
<echo>preparing files ${config.dir} ${build.num}</echo>
<!-- clean out the config directory -->
<delete>
<fileset dir="${config.dir}" includes="**/*"/>
</delete>
<!-- copy the src files to deployment directory -->
<copy todir="${prep.dir}" overwrite="yes">
<fileset dir="${src.dir}">
<include name="config/**/*"/>
<include name="docs/*.txt"/>
<include name="docs/about.html"/>
</fileset>
<fileset dir="${src.dir}/images">
<include name="antelope.jpg"/>
</fileset>
</copy>
<!-- insert the build number into the documentation and configuration
files -->
<tstamp/>
<replace dir="${prep.dir}" encoding="ISO-8859-1">
<replacefilter token="@buildnum@" value="${build.num}"/>
<replacefilter token="@tstamp@" value="${TODAY}" />
<replacefilter token="@style@"
value="<STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>" />
</replace>
<!-- insert the build number into the version file -->
<property name="version.txt" location="${src.dir}/ise/antelope/common/version.txt"/>
<delete file="${version.txt}"/>
<echo file="${version.txt}" message="VERSION=${build.num}${line.separator}"/>
<echo file="${version.txt}" message="DATE=${TODAY}" append="true"/>
</target>
<!-- ========================================================================
Target: init
this target creates the directories needed for this project and
only needs to be done once.
========================================================================= -->
<target name="init"
description="Create directory structure."
unless="init.done">
<fail unless="jedit.install.dir" message="Please set jedit.install.dir property."/>
<available file="${jedit.install.dir}/jedit.jar" property="jedit.available"/>
<fail unless="jedit.available" message="jedit.jar not found, please set in properties."/>
<mkdir dir="${src.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${prep.dir}"/>
<mkdir dir="${doc.dir}" />
<mkdir dir="${config.dir}" />
<mkdir dir="${dist.dir}"/>
<property name="init.done" value="true"/>
</target>
<target name="test input">
<input
message="All data is going to be deleted from DB continue (y/n)?"
validargs="y,n"
addproperty="do.delete" />
<condition property="do.abort">
<equals arg1="n" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Build aborted by user.</fail>
</target>
</project>