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