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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
|
<project name="jEditPlugin" default="build">
<!-- {{{ Top-Level build file for jEdit plugins. ====== -->
<!--
Version: $Id: plugin-build.xml 17425 2010-03-04 04:31:01Z vanza $
Requires apache Ant 1.6, including optional tasks, and xerces.
:tabSize=4:indentSize=4:noTabs=true:
:folding=explicit:collapseFolds=2:
To use this file, use the "import" task from ant
on your plugin's build file, like this:
<import file="../build-support/plugin-build.xml" />
The use of the property is to ease the work of the plugin
packagers.
General tips:
- To override properties, either use the several
options for build.properties files, or declare
them in you plugin's build file *before* the
import statement.
- To override paths and selectors, declare them in
your build file *after* the import statement.
Some tasks require the ant-contrib library available from
http://ant-contrib.sourceforge.net. If you have the
library, specify a property named "ant-contrib.jar" with
the location of the library. The tasks that need ant-contrib
are the tasks related to plugin dependencies.
For JUnit support, make sure you have the ant-junit.jar
library in Ant's lib directory. Specify the location of
the junit jar file using the property "junit.jar".
-->
<!-- ===============================================}}} -->
<!-- {{{ Property definitions ========================= -->
<!-- First loads options from the user's optional
build.properties files in the following order:
current dir, parent dir, $HOME/.build.properties
and finally $HOME/build.properties . The defines
several default properties used by the different
targets. -->
<!-- ================================================== -->
<property file="${basedir}/build.properties" />
<property file="${basedir}/../build.properties" />
<property file="${user.home}/.build.properties" />
<property file="${user.home}/build.properties" />
<echo>${java.home}</echo>
<!-- where to find jEdit and plugins -->
<property name="sourceforge.user.name"
value="${user.name}" />
<property name="jedit.install.dir" value="../../jEdit" />
<property name="jedit.user.home" value="${user.home}/.jedit" />
<property name="plugins.srcdir" value=".." />
<property name="install.dir" value=".." />
<!-- some info about the plugin and where to put it -->
<property name="src.dir" value="." />
<property name="jar.file" value="${ant.project.name}.jar" />
<property name="src.zip.file" value="${ant.project.name}.zip" />
<property name="dist.target" value="dist.nojavadoc" />
<!-- where files will go -->
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.docs" value="${build.dir}/docs" />
<property name="build.javadoc" value="${build.docs}/javadoc" />
<property name="build.extras" value="${build.dir}/extras" />
<!-- default compiler flags -->
<property name="compiler.debug" value="off" />
<property name="compiler.debuglevel" value="lines,vars,source" />
<property name="compiler.optimize" value="off" />
<property name="compiler.deprecation" value="off" />
<property name="compiler.verbose" value="off" />
<property name="compiler.nowarn" value="off" />
<property name="compiler.target" value="1.5" />
<property name="compiler.source" value="1.5" />
<property name="compiler.listfiles" value="no" />
<property name="compiler.fork" value="no" />
<property name="compiler.bootclasspath" value="${java.home}/lib/rt.jar"/>
<property name="compiler.extdirs" value="${java.ext.dirs}"/>
<property name="compiler.userargs" value="" />
<!-- default documentation options -->
<property name="docs-proc.target" value="xsltproc" />
<property name="docbookx.dtd" value="../XML/xml/dtds/docbookx.dtd" />
<dirname property="build.support" file="${ant.file.jEditPlugin}" />
<property name="user-doc.xsl" location="${build.support}/users-guide.xsl" />
<property name="user-doc.xml" value="docs/users-guide.xml" />
<property name="user-doc.out" value="users-guide.html" />
<property name="javadoc.title" value="${ant.project.name} API" />
<property name="docbook.xsl.sheet" value="html/onechunk.xsl" />
<pathconvert property="docs.style.sheet"
dirsep="/">
<path location="${docbook.xsl}/${docbook.xsl.sheet}" />
</pathconvert>
<property name="xsltproc.executable" value="xsltproc" />
<!-- default junit options -->
<property name="junit.jar" value="junit.jar" />
<property name="junit.testcase" value="${ant.project.name}TestSuite" />
<property name="junit.printsummary" value="on" />
<property name="junit.haltonfailure" value="off" />
<fail message="The jedit JAR (jedit.jar) is not available in "${jedit.install.dir}"">
<condition>
<not>
<available file="${jedit.install.dir}/jedit.jar"
type="file" />
</not>
</condition>
</fail>
<!-- default class path; try not to override this,
since the intention is to add here anything that
might be needed by all the plugins (such as the
jedit.jar file and any other jar files that
jEdit might use in the future. -->
<path id="default.class.path">
<pathelement location="${jedit.install.dir}/jedit.jar" />
<pathelement location="${junit.jar}" />
</path>
<!-- this is the classpath used by the "compile"
target. Override this one if you need to. You don't
need to reference "default.class.path" here - it's added
automatically to the javac command. -->
<path id="project.class.path" />
<!-- {{{ Load ant-contrib library ===================== -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" onerror="ignore">
<classpath>
<pathelement location="${ant-contrib.jar}"/>
</classpath>
</taskdef>
<!-- ===============================================}}} -->
<!-- ===============================================}}} -->
<!-- {{{ Custom javac task ============================ -->
<presetdef name="jp.javac">
<javac destdir="${build.classes}"
debug="${compiler.debug}"
debuglevel="${compiler.debuglevel}"
optimize="${compiler.optimize}"
deprecation="${compiler.deprecation}"
verbose="${compiler.verbose}"
nowarn="${compiler.nowarn}"
target="${compiler.target}"
source="${compiler.source}"
listfiles="${compiler.listfiles}"
fork="${compiler.fork}"
bootclasspath="${compiler.bootclasspath}"
extdirs="${compiler.extdirs}"
>
<src location="${src.dir}" />
<compilerarg line="${compiler.userargs}" />
<classpath refid="default.class.path" />
<classpath refid="project.class.path" />
</javac>
</presetdef>
<!-- }}} ============================================== -->
<!-- {{{ Compilation and building ===================== -->
<!-- This selector defines the files that will be
compiled by the "compile" target. Define here which
files under ${src.dir} will be compiled when the
"compile" task is called. -->
<selector id="compileFiles">
<filename name="**/*.java" />
</selector>
<!-- This selector defines extra files to be included
in the plugin's JAR file. The context of the
selector is the plugin's directory (${basedir}),
so it will not work for files outside the plugin
directory. For those cases, use the "build.prepare"
target. By default, it's empty. -->
<selector id="packageFiles">
<size value="0" when="less" />
</selector>
<!-- This selector defines the doc source files
The context of the selector is the plugin's directory (${basedir}),
so it will not work for files outside the plugin
directory. For those cases, use the "build.prepare"
target. By default, docs/users-guide.xml is selected. -->
<selector id="docSrcFiles">
<filename name="docs/users-guide.xml" />
</selector>
<!-- This selector defines other files that should be packaged
in the plugin's jar file; by default it contains actions.xml,
dockables.xml, services.xml, any files ending in ".props",
"LICENSE" and "README". The context is "${basedir}". Override
it if your plugin needs special treatment for these files. -->
<selector id="extraFiles">
<and>
<or>
<filename name="**/actions.xml" />
<filename name="**/browser.actions.xml" />
<filename name="**/dockables.xml" />
<filename name="**/services.xml" />
<filename name="**/*.props" />
<filename name="**/LICENSE" />
<filename name="**/README" />
</or>
</and>
</selector>
<!-- {{{ Target: compile ============================== -->
<!-- Compiles all the ".java" files present in the
directory pointed by the "src.dir" property
defined above. Classes are put in the directory
designated in the "build.classes" property.
The following properties control the behavior of
the compiler (relates to options to the javac
ant task, defaults in parethesis):
compiler.debug: the debug option (off)
compiler.debuglevel: the debug level (lines,source)
compiler.optimize: the optimize option (off)
compiler.deprecation: deprecation option (off)
compiler.verbose: the verbose option (off)
compiler.nowarn: the nowarn option (off)
compiler.target: the target option (1.5)
compiler.source: the source option (1.5)
compiler.listfiles: the listfiles option (no) -->
<target name="compile"
description="Compile the plugin's classes">
<mkdir dir="${build.classes}" />
<jp.javac>
<selector refid="compileFiles" />
</jp.javac>
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: clean ================================ -->
<!-- Removes the directory defined in the "build"
property, the "docbook-wrapper.xsl" file and the
file defined by the property "jar.file" in the
directory defined by "install.dir". -->
<target name="clean" description="Cleans project directories">
<delete dir="${build.dir}" quiet="true" />
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: build ================================ -->
<!-- This target build the plugin JAR file. It
depends on two other targets: "compile", defined
above, and "build.prepare", which is empty in
this file but can be overriden by the plugin's
build file.
This target does the following after that:
* Copies all files defined by the extraFiles selector
to the staging area.
* Copies all files defined by the packageFiles selector
to the staging area.
* Creates a JAR with the name defined in
"jar.file" in the directory defined by
"install.dir". This JAR will contain the
contents of the directories defined by
"build.classes", "build.docs" and "build.extras"
If you need to have any other files added to the
JAR, override the "build.prepare" target and use
it to copy files to one of those three
directories, or redefine the "extraFiles"
selector. -->
<target name="build"
depends="build.prepare,compile"
description="Builds the plugin JAR file (no docs)">
<mkdir dir="${build.classes}" />
<mkdir dir="${build.docs}" />
<delete dir="${build.extras}" failonerror="false" />
<mkdir dir="${build.extras}" />
<mkdir dir="${install.dir}" />
<copy todir="${build.extras}" includeEmptyDirs="false">
<fileset dir="${basedir}">
<selector refid="extraFiles" />
</fileset>
</copy>
<copy todir="${build.extras}" includeEmptyDirs="false">
<fileset dir="${basedir}">
<selector refid="packageFiles" />
</fileset>
</copy>
<jar jarfile="${install.dir}/${jar.file}">
<fileset dir="${build.classes}" />
<fileset dir="${build.docs}" />
<fileset dir="${build.extras}" />
</jar>
<antcall target="build.post" />
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: build.prepare ======================== -->
<!-- This implementation does nothing. See the
"build" target for details. -->
<target name="build.prepare" />
<!-- ===============================================}}} -->
<!-- {{{ Target: build.post =========================== -->
<!-- Called after the build process is finished.
Plugins can use this to copy extra jar files the
plugin needs to ${install.dir}.
By default does nothing. -->
<target name="build.post" />
<!-- ===============================================}}} -->
<!-- {{{ Target: dist.nojavadoc ======================= -->
<!-- Meta-task that builds the user documentation and
builds the plugin JAR file, but not the javadoc. -->
<target name="dist.nojavadoc" depends="userdocs,build" />
<!-- =============================================== }}} -->
<!-- {{{ Target: dist.complete ======================== -->
<!-- Meta-task that builds the user documentation,
javadoc documentation and builds the plugin JAR
file. -->
<target name="dist.complete" depends="docs,build" />
<!-- ===============================================}}} -->
<!-- {{{ Target: dist ================================= -->
<!-- This task calls the target defined in the
property "dist.target" to build the plugin and
package it for distribution. Before proceeding,
it cleans the build directory. -->
<target name="dist" depends="clean" description="Builds JAR file, with docs">
<antcall target="${dist.target}" />
</target>
<!-- =============================================== }}} -->
<!-- {{{ Target: dist.source ========================== -->
<!-- Creates a ZIP file of the plugin's source. The
name of the file is defined in the property
"src.zip.file" and will be created in the
directory defined by "install.dir". -->
<target name="dist.source">
<delete file="${install.dir}/${src.zip.file}" quiet="true" />
<zip destfile="${install.dir}/${src.zip.file}">
<fileset dir="${src.dir}">
<include name="**/*.*" />
<exclude name="${build.dir}/**" />
</fileset>
</zip>
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: package ============================== -->
<!-- Convenience target that calls both "docs" and
"build" to create the plugin jar file. -->
<target name="package" depends="docs,build" />
<!-- =============================================== }}} -->
<!-- =============================================== }}} -->
<!-- {{{ Documentation ================================ -->
<!-- {{{ Target: docs ================================= -->
<!-- Meta-task that calls javadoc and userdocs. -->
<target name="docs"
depends="javadoc,userdocs"
description="Build the User's Guide and Javadoc documentation" />
<!-- =============================================== }}} -->
<!-- {{{ Target: userdocs ============================= -->
<target name="userdocs"
description="Builds the user's guide.">
<mkdir dir="${build.docs}" />
<copy todir="${build.docs}" includeEmptyDirs="false">
<fileset dir="${basedir}">
<selector refid="docSrcFiles" />
</fileset>
</copy>
<copy tofile="${build.docs}/users-guide.xsl"
flatten="true"
file="${user-doc.xsl}">
<filterset>
<filter token="docs.style.sheet"
value="${docs.style.sheet}" />
</filterset>
</copy>
<antcall target="docs-${docs-proc.target}" />
<antcall target="error-catalog" />
<delete file="${build.docs}/users-guide.xsl" />
<delete>
<fileset dir="${build.docs}">
<selector refid="docSrcFiles" />
</fileset>
</delete>
</target>
<!-- =============================================== }}} -->
<target name="upload.docs" depends="javadoc, userdocs"
description="upload documentation to plugins.jedit.org site" >
<exec dir="${build.docs}" executable="rsync">
<arg line="-avz ./ ${sourceforge.user.name}@plugins.jedit.org:/home/groups/j/je/jedit-plugins/htdocs/plugindoc/${ant.project.name}" />
</exec>
</target>
<!-- {{{ Target: javadoc ============================== -->
<!-- Builds the javadoc documentation for the plugin,
placing it under "build.javadoc". Your plugin
build file *must* define a property called
named "javadoc.packagenames" to be used as the
"packagenames" option of ant's javadoc task.
This property is not defined in this file and
execition will probably fail if it's not defined.
The title of the documentation is defined in the
"javadoc.title" property. -->
<target name="javadoc"
description="Generates javadoc sourcecode documentation"
if="javadoc.packagenames">
<mkdir dir="${build.javadoc}" />
<javadoc sourcepath="${src.dir}"
destdir="${build.javadoc}"
locale="en"
packagenames="${javadoc.packagenames}"
windowtitle="${javadoc.title}">
<classpath refid="default.class.path" />
<classpath refid="project.class.path" />
</javadoc>
</target>
<!-- =============================================== }}} -->
<!-- {{{ Target: docs-xsltproc ======================== -->
<!-- Generate docs with xsltproc tool from
www.xmlsoft.org. This task creates a temporary
file called "docbook.catalog" containing a
reference to the Docbook DTD defined in the
property "docbookx.dtd" above. The style sheet
used is defined by the property "user-doc.xsl",
and defaults to "docbook-wrapper.xsl". The XML
document to be processed is defined by the
"user-doc.xml" property, and defaults to
"docs/users-guide.xml". The output is defined in
the "user-doc.out" property. -->
<target name="docs-xsltproc" description="Generate user documentation in html format with xsltproc" if="docbook.catalog">
<exec executable="${xsltproc.executable}" dir="${build.docs}" failonerror="true">
<arg value="--output" />
<arg value="${user-doc.out}" />
<arg value="--catalogs" />
<arg value="users-guide.xsl" />
<arg value="${user-doc.xml}" />
<env key="SGML_CATALOG_FILES"
file="${docbook.catalog}" />
</exec>
</target>
<target name="error-catalog" unless="docbook.catalog" >
<echo message="docbook.catalog not set" />
</target>
<!-- ===============================================}}} -->
<target name="docs-none"
description="no xslt step - HTML docs" />
<!-- {{{ Target: docs-xalan =========================== -->
<!-- Generate docs with Xalan tool from
xml.apache.org . Same properties as the
"docs-xsltproc" target apply here. -->
<target name="docs-xalan"
if="docbookx.dtd"
description="Generate user documentation in html format with xalan (not working)">
<xslt basedir="."
destdir="${build.docs}"
style="${build.docs}/users-guide.xsl"
includes="${user-doc.xml}">
<xmlcatalog>
<dtd publicId="-//OASIS//DTD DocBook XML V4.2//EN"
location="${docbookx.dtd}" />
</xmlcatalog>
</xslt>
</target>
<!-- ===============================================}}} -->
<!-- =============================================== }}} -->
<!-- {{{ Unit testing ================================= -->
<!-- {{{ Target: test ================================= -->
<!-- Meta-task that calls the defined test target. -->
<target name="test"
description="Runs the plugin's unit tests.">
<antcall target="${unit.test.target}" />
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: test-junit============================ -->
<!-- Executes a jUnit test case defined by the plugin's
build file. The classpath for the test will be the
${build.class} directory, the ${junit.jar} file and
the default.class.path and project.class.path path
structures.
-->
<target name="test-junit"
description="Runs the plugin's jUnit tests."
if="junit.testcase,junit.jar">
<junit printsummary="${junit.printsummary}"
haltonfailure="${junit.haltonfailure}">
<classpath>
<pathelement location="${junit.jar}" />
<pathelement location="${build.classes}" />
<path refid="default.class.path" />
<path refid="project.class.path" />
</classpath>
<test name="${junit.testcase}" />
</junit>
</target>
<!-- ===============================================}}} -->
<!-- ===============================================}}} -->
<!--{{{ Dependencies ================================= -->
<!-- {{{ Target: build.dependencies =================== -->
<target name="build.dependencies"
description="Builds the needed plugins from the available source code."
if="plugin.dependencies,ant-contrib.jar">
<foreach list="${plugin.dependencies}"
target="build.other"
param="plugin.name"
delimiter=","
trim="true" />
</target>
<!-- ===============================================}}} -->
<!-- {{{ Target: build.other=========================== -->
<!-- Builds a plugin from the code available in its
directory under "plugins.srcdir". This will call
the "build" target of that plugin's build file.
Expects the "plugin.name" parameter with the name
of the plugin's directory. -->
<target name="build.other">
<fail message="Can't find plugin: ${plugin.name}">
<condition>
<not>
<available file="${plugins.srcdir}/${plugin.name}/build.xml" />
</not>
</condition>
</fail>
<ant antfile="${plugins.srcdir}/${plugin.name}/build.xml"
target="build"
inheritAll="false"
inheritRefs="false" />
</target>
<!-- ===============================================}}} -->
<!-- ================================================== }}}-->
</project>
|