| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- This file is part of the DITA Open Toolkit project.
- Copyright 2006 IBM Corporation
- See the accompanying LICENSE file for applicable license.
- -->
- <project name="dita.integrator" default="integrate">
-
- <dirname property="ant.file.dita.integrator.dir" file="${ant.file.dita.integrator}"/>
-
- <!-- First try to initialize ${dita.dir} using the special
- property passed by Ant's import task. -->
- <condition property="dita.dir" value="${ant.file.dita.integrator.dir}">
- <and>
- <isset property="ant.file.dita.integrator"/>
- <not>
- <isset property="dita.dir"/>
- </not>
- </and>
- </condition>
-
- <!-- Try to initialize ${dita.dir} again if it was not set. -->
- <!-- Deprecated since 1.8 -->
- <condition property="dita.dir" value="${basedir}">
- <not>
- <isset property="dita.dir"/>
- </not>
- </condition>
-
- <path id="dost.class.path">
- <pathelement location="${dita.dir}/lib/dost.jar"/>
- <pathelement location="${dita.dir}/lib/dost-configuration.jar"/>
- <pathelement location="${dita.dir}/lib/commons-io-2.4.jar"/>
- </path>
-
- <taskdef name="integrate" classname="org.dita.dost.ant.IntegratorTask">
- <classpath refid="dost.class.path"/>
- </taskdef>
-
- <target name="integrate">
- <integrate ditadir="${dita.dir}" />
- <!-- place property files into a JAR so Ant will find them -->
- <jar destfile="${basedir}/lib/dost-configuration.jar">
- <fileset dir="${basedir}/config">
- <include name="messages.xml"/>
- <include name="messages_*.properties"/>
- <include name="plugins.xml"/>
- <include name="log4j.properties"/>
- <include name="configuration.properties"/>
- <include name="CatalogManager.properties"/>
- <include name="org.dita.dost.platform/plugin.properties"/>
- </fileset>
- </jar>
- </target>
-
- <target name="lax" description="Run integration in lax mode">
- <echo>WARN: The lax integration mode has been removed, using strict mode</echo>
- <antcall target="integrate"/>
- </target>
- <target name="strict" description="Run integration in strict mode">
- <antcall target="integrate"/>
- </target>
- <target name="install" description="Install plug-in" depends="install.init, install.local, install.download">
- <pathconvert property="temp.plugin.file">
- <first>
- <fileset dir="${dita.temp.dir}">
- <include name="**/plugin.xml"/>
- </fileset>
- </first>
- </pathconvert>
- <dirname property="temp.plugin.dir" file="${temp.plugin.file}"/>
- <xmlproperty file="${temp.plugin.file}" collapseAttributes="true"/>
- <available property="plugin.exists" file="${dita.dir}/plugins/${plugin.id}"/>
- <antcall target="install.move"/>
- <delete dir="${dita.temp.dir}"/>
- <fail if="plugin.exists">Plug-in ${dita.dir}/plugins/${plugin.id} already exists.</fail>
- </target>
- <target name="install.move" unless="plugin.exists">
- <move todir="${dita.dir}/plugins/${plugin.id}">
- <fileset dir="${temp.plugin.dir}"/>
- </move>
- <antcall target="integrate"/>
- </target>
- <target name="install.init">
- <fail unless="plugin.file"/>
- <available file="${plugin.file}" property="install.file.exists"/>
- <tstamp>
- <format property="current.date" pattern="yyyyMMddHHmmssSSS"/>
- </tstamp>
- <property name="dita.temp.dir" location="${dita.dir}/temp/temp${current.date}" />
- <mkdir dir="${dita.temp.dir}"/>
- </target>
- <target name="install.local" if="install.file.exists">
- <unzip src="${plugin.file}" dest="${dita.temp.dir}"/>
- </target>
- <target name="install.download" unless="install.file.exists">
- <tempfile property="install.download.file.abs" destdir="${dita.temp.dir}" suffix=".zip"/>
- <basename property="install.download.file" file="${install.download.file.abs}"/>
- <get src="${plugin.file}" dest="${dita.temp.dir}/${install.download.file}" ignoreerrors="false" verbose="on"/>
- <unzip src="${dita.temp.dir}/${install.download.file}" dest="${dita.temp.dir}"/>
- <delete file="${dita.temp.dir}/${install.download.file}"/>
- </target>
-
- <target name="uninstall" description="Uninstall plug-in">
- <fail unless="plugin.id"/>
- <available property="plugin.exists" file="${dita.dir}/plugins/${plugin.id}"/>
- <fail unless="plugin.exists">Plug-in ${dita.dir}/plugins/${plugin.id} doesn't exist.</fail>
- <antcall target="uninstall.delete"/>
- </target>
- <target name="uninstall.delete" if="plugin.exists">
- <delete dir="${dita.dir}/plugins/${plugin.id}"/>
- <antcall target="integrate"/>
- </target>
-
- </project>
|