PageRenderTime 161ms CodeModel.GetById 140ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/build-support/trunk/plugin-build.xml

#
XML | 805 lines | 430 code | 93 blank | 282 comment | 0 complexity | ba4e8fa0219d36b9331b781519cf40df MD5 | raw file
  1<project name="jEditPlugin" default="build"
  2         xmlns:ivy="antlib:org.apache.ivy.ant"
  3         xmlns:jedit="antlib:org.jedit.ant"
  4         >
  5
  6    <!-- {{{ Top-Level build file for jEdit plugins. ====== -->
  7    <!--
  8        Version: $Id: plugin-build.xml 21305 2012-03-10 15:04:20Z kpouer $
  9        Requires apache Ant 1.6, including optional tasks, and xerces.
 10
 11        To use this file, use the "import" task from ant
 12        on your plugin's build file, like this:
 13
 14        <import file="../build-support/plugin-build.xml" />
 15
 16        The use of the property is to ease the work of the plugin
 17        packagers.
 18
 19        General tips:
 20        - To override properties, either use the several
 21          options for build.properties files, or declare
 22          them in you plugin's build file *before* the
 23          import statement.
 24        - To override paths and selectors, declare them in
 25          your build file *after* the import statement.
 26
 27        Some tasks require the ant-contrib library available from
 28        http://ant-contrib.sourceforge.net. If you have the
 29        library, specify a property named "ant-contrib.jar" with
 30        the location of the library. The tasks that need ant-contrib
 31        are the tasks related to plugin dependencies.
 32
 33        For JUnit support, make sure you have the ant-junit.jar
 34        library in Ant's lib directory. Specify the location of
 35        the junit jar file using the property "junit.jar".
 36    -->
 37    <!-- ===============================================}}} -->
 38
 39    <import file="build-helper.xml" />
 40
 41    <!-- {{{ Property definitions ========================= -->
 42    <!-- First loads options from the user's optional
 43         build.properties files in the following order:
 44         current dir, parent dir, $HOME/.build.properties
 45         and finally $HOME/build.properties . The defines
 46         several default properties used by the different
 47         targets.                                           -->
 48    <!-- ================================================== -->
 49
 50    <property file="${basedir}/build.properties" />
 51    <property file="${basedir}/../build.properties" />
 52    <property file="${user.home}/.build.properties" />
 53    <property file="${user.home}/build.properties" />
 54    <!-- <echo>plugin-build java.home=${java.home}</echo> -->
 55    <!-- where to find jEdit and plugins    -->
 56    <property name="sourceforge.user.name"
 57    value="${user.name}" />
 58    <property name="jedit.install.dir"  value="../../jEdit" />
 59    <property name="jedit.user.home"    value="${user.home}/.jedit" />
 60    <property name="plugins.srcdir"     value=".." />
 61    <property name="install.dir"        value=".." />
 62
 63    <!-- some info about the plugin and where to put it -->
 64    <property name="src.dir"        value="." />
 65    <property name="jar.file"       value="${ant.project.name}.jar" />
 66    <property name="src.zip.file"   value="${ant.project.name}.zip" />
 67    <property name="dist.target"    value="dist.nojavadoc" />
 68
 69    <!-- where files will go    -->
 70    <property name="build.dir"      value="build" />
 71    <property name="build.classes"  value="${build.dir}/classes" />
 72    <property name="build.docs"     value="${build.dir}/docs" />
 73    <property name="build.javadoc"  value="${build.docs}/javadoc" />
 74    <property name="build.extras"   value="${build.dir}/extras" />
 75    <property name="build.lib"      value="${build.dir}/lib" />
 76
 77    <!-- default compiler flags -->
 78    <property name="compiler.debug"         value="off" />
 79    <property name="compiler.debuglevel"    value="lines,vars,source" />
 80    <property name="compiler.optimize"      value="off" />
 81    <property name="compiler.deprecation"   value="off" />
 82    <property name="compiler.verbose"       value="off" />
 83    <property name="compiler.nowarn"        value="off" />
 84    <property name="compiler.target"        value="1.6" />
 85    <property name="compiler.source"        value="1.6" />
 86    <property name="compiler.listfiles"     value="no" />
 87    <property name="compiler.fork"          value="no" />
 88    <property name="compiler.bootclasspath" value="${java.home}/lib/rt.jar"/>
 89    <property name="compiler.extdirs"       value="${java.ext.dirs}"/>
 90    <property name="compiler.userargs"      value="" />
 91
 92    <!-- default documentation options  -->
 93    <property name="docs-proc.target"       value="xsltproc" />
 94    <property name="docbookx.dtd"           value="../XML/xml/dtds/docbookx.dtd" />
 95    <dirname property="build.support"       file="${ant.file.jEditPlugin}" />
 96    <property name="user-doc.xsl"           location="${build.support}/users-guide.xsl" />
 97    <property name="user-doc.xml"           value="docs/users-guide.xml" />
 98    <property name="user-doc.out"           value="users-guide.html" />
 99    <property name="javadoc.title"          value="${ant.project.name} API" />
100    <property name="docbook.xsl.sheet"      value="html/onechunk.xsl" />
101    <pathconvert property="docs.style.sheet"
102                 dirsep="/">
103        <path location="${docbook.xsl}/${docbook.xsl.sheet}" />
104    </pathconvert>
105
106    <property name="xsltproc.executable"    value="xsltproc" />
107
108    <!-- default junit options -->
109    <property name="junit.jar"              value="junit.jar" />
110    <property name="junit.testcase"         value="${ant.project.name}TestSuite" />
111    <property name="junit.printsummary"     value="on" />
112    <property name="junit.haltonfailure"    value="off" />
113
114    <fail message="The jedit JAR (jedit.jar) is not available in &quot;${jedit.install.dir}&quot;">
115        <condition>
116            <not>
117                <available file="${jedit.install.dir}/jedit.jar"
118                           type="file" />
119            </not>
120        </condition>
121    </fail>
122
123    <!-- default class path; try not to override this,
124         since the intention is to add here anything that
125         might be needed by all the plugins (such as the
126         jedit.jar file and any other jar files that
127         jEdit might use in the future.                     -->
128    <path id="default.class.path">
129        <pathelement location="${jedit.install.dir}/jedit.jar" />
130        <pathelement location="${junit.jar}" />
131        <fileset dir="${build.dir}">
132            <include name="lib/*.jar"/>
133        </fileset>
134    </path>
135
136    <!-- this is the classpath used by the "compile"
137         target. Override this one if you need to. You don't
138         need to reference "default.class.path" here - it's added
139         automatically to the javac command.                -->
140    <path id="project.class.path" />
141
142    <!-- jedit tasks properties -->
143    <property name="jedit.classes" value="${build.support}/build/classes" />
144    <property name="jedit.src" value="${build.support}/java-src" />
145    <uptodate targetfile="${build.support}/build/doc/index.html"
146              property="jedit.tasks.javadoc.uptodate" >
147        <srcfiles dir="${jedit.src}" />
148    </uptodate>
149
150    <!-- {{{ Load ant-contrib library ===================== -->
151    <taskdef resource="net/sf/antcontrib/antcontrib.properties" onerror="ignore">
152        <classpath>
153            <pathelement location="${ant-contrib.jar}"/>
154        </classpath>
155    </taskdef>
156    <!-- ===============================================}}} -->
157
158    <!-- ===============================================}}} -->
159
160    <!-- {{{ Custom javac task ============================ -->
161    <presetdef name="jp.javac">
162        <javac destdir="${build.classes}"
163                debug="${compiler.debug}"
164                debuglevel="${compiler.debuglevel}"
165                optimize="${compiler.optimize}"
166                deprecation="${compiler.deprecation}"
167                verbose="${compiler.verbose}"
168                nowarn="${compiler.nowarn}"
169                target="${compiler.target}"
170                source="${compiler.source}"
171                listfiles="${compiler.listfiles}"
172                fork="${compiler.fork}"
173                bootclasspath="${compiler.bootclasspath}"
174                extdirs="${compiler.extdirs}"
175                >
176            <src location="${src.dir}" />
177	    <compilerarg line="${compiler.userargs}" />
178            <classpath refid="default.class.path" />
179            <classpath refid="project.class.path" />
180        </javac>
181    </presetdef>
182    <!-- }}} ============================================== -->
183
184    <!-- {{{ Compilation and building ===================== -->
185
186    <!-- This selector defines the files that will be
187         compiled by the "compile" target. Define here which
188         files under ${src.dir} will be compiled when the
189         "compile" task is called.                          -->
190    <selector id="compileFiles">
191        <filename name="**/*.java" />
192    </selector>
193
194    <!-- This selector defines extra files to be included
195         in the plugin's JAR file. The context of the
196         selector is the plugin's directory (${basedir}),
197         so it will not work for files outside the plugin
198         directory. For those cases, use the "build.prepare"
199         target. By default, it's empty.                    -->
200    <selector id="packageFiles">
201        <size value="0" when="less" />
202    </selector>
203
204    <!-- This selector defines the doc source files
205         The context of the selector is the plugin's directory (${basedir}),
206         so it will not work for files outside the plugin
207         directory. For those cases, use the "build.prepare"
208         target. By default, docs/users-guide.xml is selected.                    -->
209    <selector id="docSrcFiles">
210        <filename name="docs/users-guide.xml" />
211    </selector>
212
213    <!-- This selector defines other files that should be packaged
214         in the plugin's jar file; by default it contains actions.xml,
215         dockables.xml, services.xml, any files ending in ".props",
216         "LICENSE" and "README". The context is "${basedir}". Override
217         it if your plugin needs special treatment for these files. -->
218    <selector id="extraFiles">
219        <and>
220            <or>
221                <filename name="**/actions.xml" />
222                <filename name="**/browser.actions.xml" />
223                <filename name="**/dockables.xml" />
224                <filename name="**/services.xml" />
225                <filename name="**/*.props" />
226                <filename name="**/LICENSE" />
227                <filename name="**/README" />
228            </or>
229        </and>
230    </selector>
231
232    <!--{{{ Ivy setttings =============================== -->
233
234    <!-- This overloads defaults from build-helper.xml
235         to have ivy.jar in the same place as jedit builder has.
236         Otherwise ivy would be put in ${build.support}/lib/ivy -->
237    <property name="ivy.install.version" value="2.2.0" />
238    <condition property="ivy.home" value="${env.IVY_HOME}">
239      <isset property="env.IVY_HOME" />
240    </condition>
241    <property name="ivy.home" value="${user.home}/.ivy2" />
242    <property name="ivy.jar.dir" value="${ivy.home}/lib" />
243    <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
244    <property name="ivy.settings.file" value="${build.support}/ivysettings.xml" />
245
246    <!--}}}-->
247
248    <!-- {{{ Target: resolve ============================== -->
249    <target name="check-ivy-xml" >
250        <available file="ivy.xml" type="file" property="ivy.xml.present" />
251    </target>
252    <target name="resolve" description="Retrieve dependencies"
253        depends="check-ivy-xml" if="ivy.xml.present">
254        <echo>ivy.xml present, retrieving dependencies</echo>
255        <!-- lib.dir is probably already set, but to be sure -->
256        <property name="lib.dir" value="${build.support}/lib" />
257        <get-ivy />
258        <ivy:retrieve pattern="${build.lib}/[artifact].[ext]"
259                      log="download-only" />
260    </target>
261    <!-- ===============================================}}} -->
262
263    <!-- {{{ Target: compile ============================== -->
264    <!-- Compiles all the ".java" files present in the
265         directory pointed by the "src.dir" property
266         defined above. Classes are put in the directory
267         designated in the "build.classes" property.
268         The following properties control the behavior of
269         the compiler (relates to options to the javac
270         ant task, defaults in parethesis):
271         compiler.debug: the debug option (off)
272         compiler.debuglevel: the debug level (lines,source)
273         compiler.optimize: the optimize option (off)
274         compiler.deprecation: deprecation option (off)
275         compiler.verbose: the verbose option (off)
276         compiler.nowarn: the nowarn option (off)
277         compiler.target: the target option (1.5)
278         compiler.source: the source option (1.5)
279         compiler.listfiles: the listfiles option (no)      -->
280    <target name="compile"
281            description="Compile the plugin's classes" depends="resolve">
282
283        <mkdir dir="${build.classes}" />
284        <jp.javac>
285            <selector refid="compileFiles" />
286        </jp.javac>
287
288    </target>
289    <!-- ===============================================}}} -->
290
291    <!-- {{{ Target: clean ================================ -->
292    <!-- Removes the directory defined in the "build"
293         property, the "docbook-wrapper.xsl" file and the
294         file defined by the property "jar.file" in the
295         directory defined by "install.dir".                -->
296    <target name="clean" description="Cleans project directories">
297        <delete dir="${build.dir}" quiet="true" />
298    </target>
299    <!-- ===============================================}}} -->
300
301    <!-- {{{ Target: build ================================ -->
302    <!-- This target build the plugin JAR file. It
303         depends on two other targets: "compile", defined
304         above, and "build.prepare", which is empty in
305         this file but can be overriden by the plugin's
306         build file.
307         This target does the following after that:
308         * Copies all files defined by the extraFiles selector
309           to the staging area.
310         * Copies all files defined by the packageFiles selector
311           to the staging area.
312         * Creates a JAR with the name defined in
313           "jar.file" in the directory defined by
314           "install.dir". This JAR will contain the
315           contents of the directories defined by
316           "build.classes", "build.docs" and "build.extras"
317         If you need to have any other files added to the
318         JAR, override the "build.prepare" target and use
319         it to copy files to one of those three
320         directories, or redefine the "extraFiles"
321         selector.                                          -->
322
323    <target name="build"
324          depends="build.prepare,compile"
325          description="Builds the plugin JAR file (no docs)">
326
327        <mkdir dir="${build.classes}" />
328        <mkdir dir="${build.docs}" />
329        <delete dir="${build.extras}" failonerror="false" />
330        <mkdir dir="${build.extras}" />
331        <mkdir dir="${install.dir}" />
332
333        <copy todir="${build.extras}" includeEmptyDirs="false">
334            <fileset dir="${basedir}">
335                <selector refid="extraFiles" />
336            </fileset>
337        </copy>
338
339        <copy todir="${build.extras}" includeEmptyDirs="false">
340            <fileset dir="${basedir}">
341                <selector refid="packageFiles" />
342            </fileset>
343        </copy>
344
345        <jar jarfile="${install.dir}/${jar.file}">
346            <fileset dir="${build.classes}" />
347            <fileset dir="${build.docs}" />
348            <fileset dir="${build.extras}" />
349        </jar>
350
351        <antcall target="build.post" />
352
353    </target>
354    <!-- ===============================================}}} -->
355
356    <!-- {{{ Target: build.prepare ======================== -->
357    <!-- This implementation does nothing. See the
358         "build" target for details.                        -->
359    <target name="build.prepare" />
360    <!-- ===============================================}}} -->
361
362    <!-- {{{ Target: build.post =========================== -->
363    <!-- Called after the build process is finished.
364         Plugins can use this to copy extra jar files the
365         plugin needs to ${install.dir}.
366         By default does nothing.                           -->
367    <target name="build.post" />
368    <!-- ===============================================}}} -->
369
370    <!-- {{{ Target: dist.nojavadoc ======================= -->
371    <!-- Meta-task that builds the user documentation and
372         builds the plugin JAR file, but not the javadoc.   -->
373    <target name="dist.nojavadoc"  depends="userdocs,build" />
374    <!-- =============================================== }}} -->
375
376    <!-- {{{ Target: dist.complete ======================== -->
377    <!-- Meta-task that builds the user documentation,
378         javadoc documentation and builds the plugin JAR
379         file.                                              -->
380    <target name="dist.complete" depends="docs,build" />
381    <!-- ===============================================}}} -->
382
383    <!-- {{{ Target: dist ================================= -->
384    <!-- This task calls the target defined in the
385         property "dist.target" to build the plugin and
386         package it for distribution. Before proceeding,
387         it cleans the build directory.                     -->
388    <target name="dist" depends="clean" description="Builds JAR file, with docs">
389        <antcall target="${dist.target}" />
390    </target>
391    <!-- =============================================== }}} -->
392
393    <!-- {{{ Target: dist.source ========================== -->
394    <!-- Creates a ZIP file of the plugin's source. The
395         name of the file is defined in the property
396         "src.zip.file" and will be created in the
397         directory defined by "install.dir".                -->
398    <target name="dist.source">
399        <delete file="${install.dir}/${src.zip.file}" quiet="true" />
400        <zip destfile="${install.dir}/${src.zip.file}">
401            <fileset dir="${src.dir}">
402                <include name="**/*.*" />
403                <exclude name="${build.dir}/**" />
404            </fileset>
405        </zip>
406    </target>
407    <!-- ===============================================}}} -->
408
409    <!-- {{{ Target: package ============================== -->
410    <!-- Convenience target that calls both "docs" and
411         "build" to create the plugin jar file.             -->
412    <target name="package" depends="docs,build" />
413    <!-- =============================================== }}} -->
414
415    <!-- =============================================== }}} -->
416
417    <!-- {{{ Documentation ================================ -->
418
419    <!-- {{{ Target: docs ================================= -->
420    <!-- Meta-task that calls javadoc and userdocs.         -->
421    <target name="docs"
422            depends="javadoc,userdocs"
423            description="Build the User's Guide and Javadoc documentation" />
424    <!-- =============================================== }}} -->
425
426    <!-- {{{ Target: userdocs ============================= -->
427    <target name="userdocs"
428            description="Builds the user's guide.">
429        <mkdir dir="${build.docs}" />
430        <copy todir="${build.docs}" includeEmptyDirs="false">
431            <fileset dir="${basedir}">
432                <selector refid="docSrcFiles" />
433            </fileset>
434        </copy>
435        <copy tofile="${build.docs}/users-guide.xsl"
436              flatten="true"
437              file="${user-doc.xsl}">
438            <filterset>
439                <filter token="docs.style.sheet"
440                        value="${docs.style.sheet}" />
441            </filterset>
442        </copy>
443        <antcall target="docs-${docs-proc.target}" />
444        <delete file="${build.docs}/users-guide.xsl" />
445        <delete>
446            <fileset dir="${build.docs}">
447                <selector refid="docSrcFiles" />
448            </fileset>
449        </delete>
450    </target>
451
452    <!-- =============================================== }}} -->
453
454    <target name="upload.docs" depends="javadoc, userdocs"
455    description="upload documentation to plugins.jedit.org site" >
456        <exec dir="${build.docs}" executable="rsync">
457      <arg line="-avz ./ ${sourceforge.user.name},jedit@shell.sourceforge.net:/home/project-web/jedit-plugins/htdocs/plugindoc/${ant.project.name}" />
458    </exec>
459    </target>
460
461
462    <!-- {{{ Target: javadoc ============================== -->
463    <!-- Builds the javadoc documentation for the plugin,
464         placing it under "build.javadoc". Your plugin
465         build file *must* define a property called
466         named "javadoc.packagenames" to be used as the
467         "packagenames" option of ant's javadoc task.
468         This property is not defined in this file and
469         execition will probably fail if it's not defined.
470         The title of the documentation is defined in the
471         "javadoc.title" property.                          -->
472    <target name="javadoc"
473            description="Generates javadoc sourcecode documentation"
474            if="javadoc.packagenames">
475        <mkdir dir="${build.javadoc}" />
476        <javadoc sourcepath="${src.dir}"
477                    destdir="${build.javadoc}"
478                    locale="en"
479                    packagenames="${javadoc.packagenames}"
480                    windowtitle="${javadoc.title}">
481            <classpath refid="default.class.path" />
482            <classpath refid="project.class.path" />
483        </javadoc>
484    </target>
485    <!-- =============================================== }}} -->
486
487    <!-- {{{ Target: docs-xsltproc ======================== -->
488    <!-- Generate docs with xsltproc tool from
489         www.xmlsoft.org. This task creates a temporary
490         file called "docbook.catalog" containing a
491         reference to the Docbook DTD defined in the
492         property "docbookx.dtd" above. The style sheet
493         used is defined by the property "user-doc.xsl",
494         and defaults to "docbook-wrapper.xsl". The XML
495         document to be processed is defined by the
496         "user-doc.xml" property, and defaults to
497         "docs/users-guide.xml". The output is defined in
498         the "user-doc.out" property. Don't call this target directly
499         as the prerequisites are set in userdocs target.                  -->
500    <target name="docs-xsltproc" description="Generate user documentation in html format with xsltproc">
501        <check-dir-var var="docbook.xsl" />
502        <check-file-var var="docbook.catalog" />
503        <exec executable="${xsltproc.executable}" dir="${build.docs}" failonerror="true">
504            <arg value="--output" />
505            <arg value="${user-doc.out}" />
506            <arg value="--catalogs" />
507            <arg value="users-guide.xsl" />
508            <arg value="${user-doc.xml}" />
509            <env key="SGML_CATALOG_FILES"
510                 file="${docbook.catalog}" />
511        </exec>
512    </target>
513
514    <!-- ===============================================}}} -->
515
516    <target name="docs-none"
517        description="no xslt step - HTML docs" />
518
519    <!-- {{{ Target: docs-xalan =========================== -->
520    <!-- Generate docs with Xalan tool from
521         xml.apache.org . Same properties as the
522         "docs-xsltproc" target apply here.                 -->
523    <target name="docs-xalan"
524            description="Generate user documentation in html format with xalan (not working)">
525        <fail message="Please set the &quot;docbookx.dtd&quot; in build.properties"
526              unless="docbookx.dtd" />
527        <fail message="Please set &quot;docbook.xsl&quot; in build.properties"
528              unless="docbook.xsl" />
529
530        <xslt basedir="."
531              destdir="${build.docs}"
532              style="${build.docs}/users-guide.xsl"
533              includes="${user-doc.xml}">
534            <xmlcatalog>
535                <dtd publicId="-//OASIS//DTD DocBook XML V4.2//EN"
536                     location="${docbookx.dtd}" />
537            </xmlcatalog>
538        </xslt>
539    </target>
540    <!-- ===============================================}}} -->
541
542    <!-- =============================================== }}} -->
543
544    <!-- {{{ Unit testing ================================= -->
545
546    <!-- {{{ Target: test ================================= -->
547    <!-- Meta-task that calls the defined test target.      -->
548    <target name="test"
549            description="Runs the plugin's unit tests.">
550        <antcall target="${unit.test.target}" />
551    </target>
552    <!-- ===============================================}}} -->
553
554    <!-- {{{ Target: test-junit============================ -->
555    <!-- Executes a jUnit test case defined by the plugin's
556         build file. The classpath for the test will be the
557         ${build.class} directory, the ${junit.jar} file and
558         the default.class.path and project.class.path path
559         structures.
560         -->
561    <target name="test-junit"
562            description="Runs the plugin's jUnit tests."
563            if="junit.testcase,junit.jar">
564
565        <junit printsummary="${junit.printsummary}"
566                haltonfailure="${junit.haltonfailure}">
567
568            <classpath>
569                <pathelement location="${junit.jar}" />
570                <pathelement location="${build.classes}" />
571                <path refid="default.class.path" />
572                <path refid="project.class.path" />
573            </classpath>
574
575            <test name="${junit.testcase}" />
576        </junit>
577
578    </target>
579    <!-- ===============================================}}} -->
580
581    <!-- ===============================================}}} -->
582
583    <!-- {{{ Dependencies ================================= -->
584
585
586    <!-- {{{ Target: build.dependencies =================== -->
587    <target name="build.dependencies"
588            description="Builds the needed plugins from the available source code."
589            if="plugin.dependencies,ant-contrib.jar">
590        <foreach list="${plugin.dependencies}"
591                    target="build.other"
592                    param="plugin.name"
593                    delimiter=","
594                    trim="true" />
595    </target>
596    <!-- ===============================================}}} -->
597
598    <!-- {{{ Target: build.other=========================== -->
599    <!-- Builds a plugin from the code available in its
600         directory under "plugins.srcdir". This will call
601         the "build" target of that plugin's build file.
602         Expects the "plugin.name" parameter with the name
603         of the plugin's directory.                         -->
604    <target name="build.other">
605        <fail message="Can't find plugin: ${plugin.name}">
606            <condition>
607                <not>
608                    <available file="${plugins.srcdir}/${plugin.name}/build.xml" />
609                </not>
610            </condition>
611        </fail>
612        <ant antfile="${plugins.srcdir}/${plugin.name}/build.xml"
613                target="build"
614                inheritAll="false"
615                inheritRefs="false" />
616    </target>
617    <!-- ===============================================}}} -->
618
619    <!-- ================================================== }}}-->
620
621    <!-- {{{ Common targets =============================== -->
622
623    <!-- {{{ Target: clean-build-support ================== -->
624    <!-- Removes recreatable files from build.support directory -->
625    <target name="clean-build-support">
626        <delete dir="${build.support}/build" quiet="true" />
627        <delete dir="${build.support}/lib" quiet="true" />
628    </target>
629    <!-- ===============================================}}} -->
630
631    <!-- {{{ def-jedit-tasks target ======================= -->
632
633    <target name="def-jedit-tasks"
634            depends="get-lib-ivy, jedit-tasks-javadoc" >
635        <mkdir dir="${jedit.classes}" />
636        <copy todir="${jedit.classes}">
637            <fileset dir="${jedit.src}" includes="**/antlib.xml" />
638        </copy>
639        <javac srcdir="${jedit.src}" destdir="${jedit.classes}"
640               debug="true" classpathref="ivy.jar.path" >
641            <compilerarg value="-Xlint:deprecation,unchecked"/>
642        </javac>
643        <taskdef resource="org/jedit/ant/antlib.xml"
644                 uri="antlib:org.jedit.ant"
645                 classpath="${jedit.classes}"
646                 classpathref="ivy.jar.path"
647                 />
648    </target>
649
650    <!-- ===============================================}}} -->
651
652    <!-- {{{ jedit-tasks-javadoc target =================== -->
653
654    <target name="jedit-tasks-javadoc"
655            depends="get-lib-ivy"
656            unless="${jedit.tasks.javadoc.uptodate}" >
657        <javadoc sourcepath="${jedit.src}"
658                 destdir="${build.support}/build/doc">
659            <classpath refid="ivy.jar.path" />
660            <classpath>
661                <pathelement path="${java.class.path}" />
662            </classpath>
663        </javadoc>
664    </target>
665
666    <!-- ===============================================}}} -->
667
668    <!-- ================================================== }}}-->
669
670    <!-- {{{ Plugin release targets ======================= -->
671
672    <!-- {{{ get-plugin-info target======================== -->
673    <!--
674         Parses files from src.dir using selectors compileFiles and extraFiles
675         and produces plugin information. Details in jedit tasks doc.
676    -->
677<target name="get-plugin-info" depends="def-jedit-tasks" >
678    <local name="src.fileset" />
679    <local name="extras.fileset" />
680    <jedit:get-plugin-info>
681        <jedit:plugininfo id="cur.plugin.info">
682            <fsSrc dir="${src.dir}" >
683                <selector refid="compileFiles" />
684            </fsSrc>
685            <fsExtras dir="${basedir}" >
686                <selector refid="extraFiles" />
687            </fsExtras>
688        </jedit:plugininfo>
689    </jedit:get-plugin-info>
690
691    <!--<dump-prop-ref refid="src.fileset" />-->
692    <!--<dump-prop-ref refid="plugin.props.set" />-->
693    <echo>Plugin properties discovered:</echo>
694    <echo>plugin.class.name: ${plugin.class.name}</echo>
695    <echo>plugin.dep.count: ${plugin.dep.count}</echo>
696    <fail>Property plugin.jedit.version.full not set.
697          Getting plugin properties failed.
698        <condition>
699            <not><isset property="plugin.jedit.version.full" /></not>
700        </condition>
701    </fail>
702</target>
703<!-- }}} ================================================== -->
704
705    <!-- {{{ gen-plugin-deps-ivy-file target ============== -->
706<!-- Generates an ivy.xml file specified by property plugin.deps.ivy.file
707     based on plugin.deps.ivy.template. -->
708<target name="gen-plugin-deps-ivy-file"
709        depends="get-plugin-info"
710        unless="plugin.deps.present" >
711    <local name="dir" />
712    <check-file-var var="plugin.deps.ivy.template" />
713    <dirname file="${plugin.deps.ivy.file}" property="dir" />
714    <mkdir dir="${dir}" />
715    <jedit:gen-plugin-deps-ivy-file
716        template="${plugin.deps.ivy.template}"
717        outFile="${plugin.deps.ivy.file}" >
718        <jedit:plugininfo refid="cur.plugin.info" />
719    </jedit:gen-plugin-deps-ivy-file>
720</target>
721<!-- }}} ================================================== -->
722
723    <!-- {{{ check-plugin-deps-dir target ================= -->
724<!-- Checks whether the directory exists. If it exists, then
725     presence of all plugin dependencies is assumed.
726     To force re-downloading remove the ${lib.dir}/plugin-deps directory
727     -->
728<target name="check-plugin-deps-dir" >
729    <mkdir dir="${build.lib}" />
730    <property name="plugin.deps.dir" value="${build.lib}/plugin-deps" />
731    <condition property="plugin.deps.present">
732      <available file="${plugin.deps.dir}" type="dir" />
733    </condition>
734</target>
735<!-- }}} ================================================== -->
736
737    <!-- {{{ check-plugin-deps-rec-dir target ============= -->
738<!-- Sets up the property and the directory for plugin dependencies. -->
739    <target name="check-plugin-deps-rec-dir" >
740        <mkdir dir="${build.lib}" />
741        <property name="plugin.deps.rec.dir"
742                  value="${build.lib}/plugin-deps-rec" />
743        <condition property="plugin.deps.rec.present">
744            <available file="${plugin.deps.rec.dir}" type="dir" />
745        </condition>
746    </target>
747<!-- }}} ================================================== -->
748
749    <!-- {{{ download-plugin-deps target ================== -->
750    <!-- Downloads plugins being plugin dependencies, but only those
751         directly specified in properties files.
752         This is done only once, as the existence
753         of the directory blocks the target. May be used for plugin
754         building. For running - recursive dependencies are required. -->
755    <target name="download-plugin-deps"
756            depends="check-plugin-deps-dir, get-lib-ivy, def-jedit-tasks"
757            unless="plugin.deps.present">
758        <property name="plugin.deps.ivy.template"
759                  value="${build.support}/ivy.plugin.deps.template.xml" />
760        <property name="plugin.deps.ivy.file"
761                  value="${basedir}/build/ivy.plugin.deps.xml" />
762        <check-file-var var="plugin.deps.ivy.template" />
763        <antcall target="gen-plugin-deps-ivy-file"
764                 inheritrefs="true" />
765        <ivy:retrieve file="${plugin.deps.ivy.file}"
766                      pattern="${plugin.deps.dir}/[artifact].zip"
767                      log="download-only" />
768        <!-- Usually ivy creates the directory, but some plugins just
769             don't have any plugin dependencies specified. To make
770             subsequent targets safe, the directory must be created now. -->
771        <mkdir dir="${plugin.deps.dir}" />
772        <unzip dest="${plugin.deps.dir}">
773            <fileset dir="${plugin.deps.dir}" includes="*.zip" />
774        </unzip>
775        <delete>
776            <fileset dir="${plugin.deps.dir}" includes="*.zip" />
777        </delete>
778    </target>
779    <!-- }}} ================================================== -->
780
781    <!-- {{{ download-plugin-deps-rec target ================== -->
782    <!-- Unlike non-recursive download - this is not blocked by the
783         existance of the directory.                            -->
784    <target name="download-plugin-deps-rec"
785            depends="check-plugin-deps-rec-dir, get-lib-ivy, def-jedit-tasks,
786                     get-plugin-info" >
787        <property name="plugin.deps.ivy.template"
788                  value="${build.support}/ivy.plugin.deps.template.xml" />
789        <check-file-var var="plugin.deps.ivy.template" />
790        <jedit:download-plugin-deps-rec
791            todir="${plugin.deps.rec.dir}"
792            ivyfilesdir="${build.dir}"
793            template="${plugin.deps.ivy.template}" >
794            <jedit:plugininfo refid="cur.plugin.info" />
795        </jedit:download-plugin-deps-rec>
796
797    </target>
798    <!-- }}} ================================================== -->
799
800    <!-- ================================================== }}}-->
801
802</project>
803
804<!--    :tabSize=4:indentSize=4:noTabs=true:
805        :folding=explicit:collapseFolds=2:    -->