integrator.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2006 IBM Corporation
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <project name="dita.integrator" default="integrate">
  8. <dirname property="ant.file.dita.integrator.dir" file="${ant.file.dita.integrator}"/>
  9. <!-- First try to initialize ${dita.dir} using the special
  10. property passed by Ant's import task. -->
  11. <condition property="dita.dir" value="${ant.file.dita.integrator.dir}">
  12. <and>
  13. <isset property="ant.file.dita.integrator"/>
  14. <not>
  15. <isset property="dita.dir"/>
  16. </not>
  17. </and>
  18. </condition>
  19. <!-- Try to initialize ${dita.dir} again if it was not set. -->
  20. <!-- Deprecated since 1.8 -->
  21. <condition property="dita.dir" value="${basedir}">
  22. <not>
  23. <isset property="dita.dir"/>
  24. </not>
  25. </condition>
  26. <path id="dost.class.path">
  27. <pathelement location="${dita.dir}/lib/dost.jar"/>
  28. <pathelement location="${dita.dir}/lib/dost-configuration.jar"/>
  29. <pathelement location="${dita.dir}/lib/commons-io-2.4.jar"/>
  30. </path>
  31. <taskdef name="integrate" classname="org.dita.dost.ant.IntegratorTask">
  32. <classpath refid="dost.class.path"/>
  33. </taskdef>
  34. <target name="integrate">
  35. <integrate ditadir="${dita.dir}" />
  36. <!-- place property files into a JAR so Ant will find them -->
  37. <jar destfile="${basedir}/lib/dost-configuration.jar">
  38. <fileset dir="${basedir}/config">
  39. <include name="messages.xml"/>
  40. <include name="messages_*.properties"/>
  41. <include name="plugins.xml"/>
  42. <include name="log4j.properties"/>
  43. <include name="configuration.properties"/>
  44. <include name="CatalogManager.properties"/>
  45. <include name="org.dita.dost.platform/plugin.properties"/>
  46. </fileset>
  47. </jar>
  48. </target>
  49. <target name="lax" description="Run integration in lax mode">
  50. <echo>WARN: The lax integration mode has been removed, using strict mode</echo>
  51. <antcall target="integrate"/>
  52. </target>
  53. <target name="strict" description="Run integration in strict mode">
  54. <antcall target="integrate"/>
  55. </target>
  56. <target name="install" description="Install plug-in" depends="install.init, install.local, install.download">
  57. <pathconvert property="temp.plugin.file">
  58. <first>
  59. <fileset dir="${dita.temp.dir}">
  60. <include name="**/plugin.xml"/>
  61. </fileset>
  62. </first>
  63. </pathconvert>
  64. <dirname property="temp.plugin.dir" file="${temp.plugin.file}"/>
  65. <xmlproperty file="${temp.plugin.file}" collapseAttributes="true"/>
  66. <available property="plugin.exists" file="${dita.dir}/plugins/${plugin.id}"/>
  67. <antcall target="install.move"/>
  68. <delete dir="${dita.temp.dir}"/>
  69. <fail if="plugin.exists">Plug-in ${dita.dir}/plugins/${plugin.id} already exists.</fail>
  70. </target>
  71. <target name="install.move" unless="plugin.exists">
  72. <move todir="${dita.dir}/plugins/${plugin.id}">
  73. <fileset dir="${temp.plugin.dir}"/>
  74. </move>
  75. <antcall target="integrate"/>
  76. </target>
  77. <target name="install.init">
  78. <fail unless="plugin.file"/>
  79. <available file="${plugin.file}" property="install.file.exists"/>
  80. <tstamp>
  81. <format property="current.date" pattern="yyyyMMddHHmmssSSS"/>
  82. </tstamp>
  83. <property name="dita.temp.dir" location="${dita.dir}/temp/temp${current.date}" />
  84. <mkdir dir="${dita.temp.dir}"/>
  85. </target>
  86. <target name="install.local" if="install.file.exists">
  87. <unzip src="${plugin.file}" dest="${dita.temp.dir}"/>
  88. </target>
  89. <target name="install.download" unless="install.file.exists">
  90. <tempfile property="install.download.file.abs" destdir="${dita.temp.dir}" suffix=".zip"/>
  91. <basename property="install.download.file" file="${install.download.file.abs}"/>
  92. <get src="${plugin.file}" dest="${dita.temp.dir}/${install.download.file}" ignoreerrors="false" verbose="on"/>
  93. <unzip src="${dita.temp.dir}/${install.download.file}" dest="${dita.temp.dir}"/>
  94. <delete file="${dita.temp.dir}/${install.download.file}"/>
  95. </target>
  96. <target name="uninstall" description="Uninstall plug-in">
  97. <fail unless="plugin.id"/>
  98. <available property="plugin.exists" file="${dita.dir}/plugins/${plugin.id}"/>
  99. <fail unless="plugin.exists">Plug-in ${dita.dir}/plugins/${plugin.id} doesn't exist.</fail>
  100. <antcall target="uninstall.delete"/>
  101. </target>
  102. <target name="uninstall.delete" if="plugin.exists">
  103. <delete dir="${dita.dir}/plugins/${plugin.id}"/>
  104. <antcall target="integrate"/>
  105. </target>
  106. </project>