-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
214 lines (198 loc) · 8.41 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="SMuFL-Browser" basedir=".">
<!-- import default properties from file -->
<property file="local.build.properties"/>
<property file="build.properties"/>
<!-- main targets -->
<target name="rebuild" depends="clean,xar"/>
<target name="clean-all" depends="clean">
<description>Delete the whole build directory with all temporary files and eXist packages</description>
<delete dir="${build.dir}"/>
<delete dir="node_modules"/>
<ant antfile="tools/otf2png/build.xml" inheritall="false" target="clean"/>
</target>
<target name="clean">
<description>Delete all temporary files except eXist packages with the extension .xar</description>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.dir}" includes="**/*" excludes="*.xar" defaultexcludes="false"/>
</delete>
<delete dir="${tmp.dir}" failonerror="false"/>
<delete dir="${dist.dir}" failonerror="false"/>
<delete file="expath-pkg.xml" failonerror="false"/>
</target>
<target name="init" depends="set-paths-for-external-programs">
<mkdir dir="${build.dir}"/>
<mkdir dir="${tmp.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="set-paths-for-external-programs">
<description>Set paths for external programs (i.e. Yarn)</description>
<condition property="yarn.executable" value="${yarn.executable.windows}" else="yarn">
<os family="windows"/>
</condition>
</target>
<target name="yarn" depends="init">
<description>Update javascript libraries via yarn</description>
<exec executable="${yarn.executable}" failonerror="yes">
<arg value="install"/>
</exec>
</target>
<!-- deprecated -->
<!--<target name="json2xml" depends="yarn">
<description>Transforms SMuFL metadata files from json to xml</description>
<!-/- xmlsh is needed for json2xml transformation -/->
<echo>Transforming classes.json</echo>
<exec executable="${xmlsh.home}/${xmlsh.cmdpath}" dir="node_modules/smufl/metadata" output="${tmp.dir}/classes.xml" error="${tmp.dir}/json2xml.classes.error">
<arg value="-c"/>
<arg line="'json2xml classes.json'"/>
<env key="XMLSH" value="${xmlsh.home}"/>
</exec>
<echo>Transforming ranges.json</echo>
<exec executable="${xmlsh.home}/${xmlsh.cmdpath}" dir="node_modules/smufl/metadata" output="${tmp.dir}/ranges.xml" error="${tmp.dir}/json2xml.ranges.error">
<arg value="-c"/>
<arg line="'json2xml ranges.json'"/>
<env key="XMLSH" value="${xmlsh.home}"/>
</exec>
<echo>Transforming glyphnames.json</echo>
<exec executable="${xmlsh.home}/${xmlsh.cmdpath}" dir="node_modules/smufl/metadata" output="${tmp.dir}/glyphnames.xml" error="${tmp.dir}/json2xml.glyphnames.error">
<arg value="-c"/>
<arg line="'json2xml glyphnames.json'"/>
<env key="XMLSH" value="${xmlsh.home}"/>
</exec>
</target>-->
<!-- deprecated -->
<!--<target name="download-smufl-metadata" depends="init">
<description>Download SMuFL metadata from the official website</description>
<get src="${smufl.metadata}" dest="${tmp.dir}/metadata.zip" skipexisting="yes"/>
<unzip src="${tmp.dir}/metadata.zip" dest="${tmp.dir}"/>
</target>-->
<!-- deprecated -->
<!--<target name="download-smufl-font" depends="init">
<description>Download Bravura font from the official website</description>
<get src="${smufl.font}" dest="${tmp.dir}/bravura.zip" skipexisting="yes"/>
<unzip src="${tmp.dir}/bravura.zip" dest="${tmp.dir}"/>
</target>-->
<target name="build-otf2png">
<description>Build the otf2png tool by invoking the ant file in the tool's folder</description>
<ant antfile="tools/otf2png/build.xml" inheritall="false" />
</target>
<target name="otf2png" depends="init, build-otf2png" unless="skip.images">
<description>Create png images for every glyph</description>
<mkdir dir="${tmp.dir}/png-glyphs"/>
<java classname="com.aerhard.otf2png.Otf2png" failonerror="true">
<arg line="-font node_modules/bravura/redist/otf/BravuraText.otf -out ${tmp.dir}/png-glyphs/hi -regex E.* -padding 0 -fontsize 1000 -height 120 -width 120 -mode fit"/>
<classpath>
<pathelement location="tools/otf2png/build/otf2png.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<java classname="com.aerhard.otf2png.Otf2png" failonerror="true">
<arg line="-font node_modules/bravura/redist/otf/BravuraText.otf -out ${tmp.dir}/png-glyphs/low -regex E.* -padding 0 -fontsize 1000 -height 40 -width 40 -mode fit"/>
<classpath>
<pathelement location="tools/otf2png/build/otf2png.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<target name="glyph2svg" depends="charDecl">
<description>Extract individual SVG shapes from the SVG font</description>
<mkdir dir="${tmp.dir}/svg-glyphs"/>
<xslt processor="trax" style="bravura2svg.xsl" basedir="node_modules/bravura/redist/svg" includes="Bravura.svg" destdir="${tmp.dir}/svg-glyphs">
<param name="charDeclPath" expression="${dist.dir}/data/charDecl.xml"/>
<param name="bravuraMetadataPath" expression="node_modules/bravura/redist/bravura_metadata.json"/>
</xslt>
</target>
<target name="charDecl" depends="init, yarn">
<description>Merge SMuFL metadata to one TEI file</description>
<mkdir dir="${dist.dir}/data"/>
<xslt processor="trax" style="smufl2tei.xsl" in="charDecl.xml.template" out="${dist.dir}/data/charDecl.xml">
<param name="ranges" expression="node_modules/smufl/metadata/ranges.json"/>
<param name="classes" expression="node_modules/smufl/metadata/classes.json"/>
<param name="glyphnames" expression="node_modules/smufl/metadata/glyphnames.json"/>
<param name="current.version" expression="${project.version}"/>
<param name="image.server" expression="${image.server}"/>
<param name="smufl.version" expression="${smufl.version}"/>
<param name="bravura.version" expression="${bravura.version}"/>
</xslt>
</target>
<target name="dist" depends="init, yarn, charDecl, otf2png, glyph2svg">
<copy file="expath-pkg.xml.template" tofile="${dist.dir}/expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
<filter token="project.app" value="${project.app}"/>
</filterset>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.*"/>
<include name="modules/**"/>
<include name="data/**"/>
<include name="resources/**"/>
<include name="templates/**"/>
<include name="xsl/**"/>
<!--<exclude name="${dist.dir}/*"/>-->
<!--<exclude name="${tmp.dir}/*"/>-->
<!--<exclude name="${build.dir}/*"/>-->
<exclude name="build.xml"/>
<exclude name="package.json"/>
<exclude name="*.template"/>
<exclude name="*.properties"/>
<exclude name="*.xsl"/>
<exclude name="*.xpr"/>
<exclude name="*.lock"/>
</fileset>
</copy>
<mkdir dir="${dist.dir}/resources/images"/>
<mkdir dir="${dist.dir}/resources/fonts"/>
<copy todir="${dist.dir}/resources/images">
<fileset dir="${tmp.dir}/png-glyphs">
<include name="**/*.png"/>
</fileset>
<fileset dir="${tmp.dir}/svg-glyphs">
<include name="**/*.svg"/>
</fileset>
</copy>
<copy todir="${dist.dir}/resources/fonts">
<!--<fileset dir="${tmp.dir}">
<include name="eot/"/>
<include name="woff/"/>
<include name="otf/"/>
<include name="svg/"/>
</fileset>-->
<fileset dir="node_modules/bootstrap/dist/fonts">
<include name="*.*"/>
</fileset>
<fileset dir="node_modules/font-awesome/fonts/">
<include name="fontawesome-webfont.*"/>
</fileset>
</copy>
<copy todir="${dist.dir}/resources/css">
<fileset dir="node_modules/bootstrap/dist/css">
<include name="bootstrap.min.css"/>
</fileset>
<fileset dir="node_modules/select2/dist/css">
<include name="select2.min.css"/>
</fileset>
<fileset dir="node_modules/font-awesome/css">
<include name="font-awesome.min.css"/>
</fileset>
</copy>
<copy todir="${dist.dir}/resources/js">
<fileset dir="node_modules/bootstrap/dist/js">
<include name="bootstrap.min.js"/>
</fileset>
<fileset dir="node_modules/jquery/dist">
<include name="jquery.min.js"/>
<include name="jquery.min.map"/>
</fileset>
<fileset dir="node_modules/select2/dist/js/">
<include name="select2.min.js"/>
</fileset>
</copy>
</target>
<target name="xar" depends="dist">
<zip destfile="${build.dir}/${project.app}-${project.version}.xar">
<fileset dir="${dist.dir}"/>
</zip>
</target>
</project>