forked from couchbaselabs/dita-ot-2.1.1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegrator.xml
127 lines (116 loc) · 4.9 KB
/
integrator.xml
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
<?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.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>