| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- This file is part of the DITA Open Toolkit project.
- See the accompanying license.txt file for applicable licenses. -->
- <!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
- <project name="dita.integrator" default="strict">
-
- <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.platform.IntegratorTask">
- <classpath refid="dost.class.path"/>
- </taskdef>
-
- <target name="integrate">
- <condition property="strict" value="false">
- <not>
- <isset property="strict"/>
- </not>
- </condition>
- <integrate ditadir="${dita.dir}" strict="${strict}"/>
- <!-- place property files into a JAR so Ant will find them -->
- <jar destfile="${basedir}/lib/dost-configuration.jar">
- <fileset dir="${basedir}/resources">
- <include name="messages.xml"/>
- <include name="plugins.xml"/>
- </fileset>
- <fileset dir="${basedir}/lib">
- <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">
- <antcall target="integrate">
- <param name="strict" value="false"/>
- </antcall>
- </target>
- <target name="strict" description="Run integration in strict mode">
- <antcall target="integrate">
- <param name="strict" value="true"/>
- </antcall>
- </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">
- <param name="strict" value="true"/>
- </antcall>
- </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">
- <param name="strict" value="true"/>
- </antcall>
- </target>
-
- </project>
|