-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
224 lines (195 loc) · 7.47 KB
/
build.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?xml version="1.0" encoding="UTF-8"?>
<project name="ahfsettings" basedir="." default="schema.translate">
<description>Antenna House Option Setting File.</description>
<!--
Copyright 2016-2023 Antenna House, Inc.
-->
<!-- PROPERTIES -->
<dirname property="ahfsettings.basedir" file="${ant.file.ahfsettings}"/>
<pathconvert property="ahfsettings.basedir.converted" dirsep="/">
<path location="${ahfsettings.basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some Java
programs don't recognise as a drive letter, so translate. -->
<map from="c:" to="/C:"/>
<map from="d:" to="/D:"/>
<map from="e:" to="/E:"/>
</pathconvert>
<pathconvert property="basedir.converted" dirsep="/">
<path location="${basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some Java
programs don't recognise as a drive letter, so translate. -->
<map from="c:" to="/C:"/>
<map from="d:" to="/D:"/>
<map from="e:" to="/E:"/>
</pathconvert>
<!-- Local file of properties determining or describing local
configuration. -->
<property name="build.local.properties"
location="${basedir.converted}/build.local.properties"/>
<property file="${build.local.properties}"/>
<!-- XML file of properties determining or describing local
configuration. -->
<property name="build.properties.xml"
location="${fochek.basedir.converted}/properties.xml"/>
<property file="${build.properties.xml}"/>
<!-- File of properties determining or describing local
configuration. -->
<property name="build.properties"
location="${ahfsettings.basedir.converted}/build.properties"/>
<property file="${build.properties}"/>
<!-- Where to find schema files. -->
<property name="schema.dir" value="${ahfsettings.basedir.converted}/schema" />
<!-- Basename of main (outermost) schema file. -->
<property name="schema.basename" value="ahfsettings" />
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd"/>
<format property="year" pattern="yyyy"/>
</tstamp>
<!-- trang.jar location depends on if run from oXygen or on OS. -->
<condition property="trang.jar" value="${ant.home}/../../lib/trang.jar">
<contains string="${ant.home}" substring="oxygen" casesensitive="false" />
</condition>
<condition property="trang.jar" value="${trang.jar.windows}">
<os family="windows" />
</condition>
<condition property="trang.jar" value="${trang.jar.mac}">
<os family="mac" />
</condition>
<property name="trang.jar" value="${trang.jar.unix}" />
<!-- TARGETS -->
<target name="trang">
<fail message="Could not locate 'trang.jar'.">
<condition>
<not>
<available file="${trang.jar}" />
</not>
</condition>
</fail>
</target>
<target name="-rng.uptodate">
<uptodate property="rng.uptodate">
<srcfiles dir= "${schema.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="*.rng"/>
</uptodate>
</target>
<target name="rng" depends="trang, -rng.uptodate"
unless="rng.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${schema.dir}/${schema.basename}.rnc" />
<arg value="${schema.dir}/${schema.basename}.rng" />
</java>
</target>
<target name="-xsd.uptodate">
<uptodate property="xsd.uptodate">
<srcfiles dir= "${schema.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="*.xsd"/>
</uptodate>
</target>
<target name="xsd" depends="trang, -xsd.uptodate"
unless="xsd.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${schema.dir}/${schema.basename}.rnc" />
<arg value="${schema.dir}/${schema.basename}.xsd" />
</java>
</target>
<target name="-dtd.uptodate">
<uptodate property="dtd.uptodate">
<srcfiles dir= "${schema.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="*.dtd"/>
</uptodate>
</target>
<target name="dtd" depends="trang, -dtd.uptodate"
unless="dtd.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${schema.dir}/${schema.basename}.rnc" />
<arg value="${schema.dir}/${schema.basename}.dtd" />
</java>
</target>
<target name="schema.translate" depends="rng, xsd, dtd" />
<!-- Release targets. -->
<macrodef name="update-copyright">
<attribute name="file" />
<attribute name="flags" default="g" />
<sequential>
<replaceregexp file="@{file}"
flags="@{flags}"
encoding="UTF-8">
<regexp pattern='Copyright ([0-9]+)-[0-9]+' />
<substitution
expression="Copyright \1-${year}"/>
</replaceregexp>
</sequential>
</macrodef>
<target name="add-on.xml.uptodate">
<condition property="add-on.xml.uptodate">
<and>
<uptodate targetfile="${basedir.converted}/add-on.xml">
<srcfiles
dir="${basedir.converted}"
includes="build.properties, add-on.xml.in, ChangeLog.md" />
</uptodate>
<isfalse value="${force}" />
</and>
</condition>
</target>
<target name="add-on.xml" depends="add-on.xml.uptodate"
unless="add-on.xml.uptodate"
description="Update the version information in 'add-on.xml'.">
<update-copyright file="${ahfsettings.basedir.converted}/add-on.xml.in" />
<update-copyright file="${ahfsettings.basedir.converted}/LICENSE.md" />
<copy file="add-on.xml.in" tofile="add-on.xml" />
<replaceregexp file="${ahfsettings.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern="<xt:version>[^<]+</xt:version>" />
<substitution expression="<xt:version>${version}</xt:version>"/>
</replaceregexp>
<replaceregexp file="${ahfsettings.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern='releases/download/[^"]+' />
<substitution
expression="releases/download/v${version}/${ant.project.name}-framework-${version}.zip"/>
</replaceregexp>
<loadfile srcfile="ChangeLog.md" property="changelog" />
<replaceregexp file="${ahfsettings.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern="@@ChangeLog@@" />
<substitution expression="${changelog}"/>
</replaceregexp>
<loadfile srcfile="LICENSE.md" property="license" />
<replaceregexp file="${ahfsettings.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern="@@LICENSE@@" />
<substitution expression="${license}"/>
</replaceregexp>
</target>
<target name="README.md">
<update-copyright file="${ahfsettings.basedir.converted}/README.md" />
</target>
<target name="framework.zip" depends="schema.translate, add-on.xml, README.md"
description="Make a Zip archive of just the oXygen framework.">
<mkdir dir="${ahfsettings.basedir.converted}/releases" />
<update-copyright file="${ahfsettings.basedir.converted}/README.md" />
<zip destfile="${ahfsettings.basedir.converted}/releases/${ant.project.name}-framework-${version}.zip"
basedir="${ahfsettings.basedir.converted}"
excludes="**"
update="true">
<zipfileset dir="."
includes="README.md, ChangeLog.md, developing.md, LICENSE*.md, ahfsettings.framework"
prefix="${ant.project.name}" />
<zipfileset dir="schema"
includes="catalog.xml, *.rng"
prefix="${ant.project.name}/schema" />
<zipfileset dir="schematron"
includes="*.sch"
prefix="${ant.project.name}/schematron" />
<zipfileset dir="template"
includes="*.xml, *.properties"
prefix="${ant.project.name}/template" />
</zip>
</target>
<target name="release" depends="add-on.xml, framework.zip" />
<!-- Utility targets. -->
<target name="echoproperties">
<echoproperties />
</target>
</project>