-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
109 lines (101 loc) · 4.68 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="Van Gogh TEI Publisher Demo App">
<xmlproperty file="expath-pkg.xml" />
<property name="npm" value="npm" />
<property name="project.version" value="${package(version)}" />
<property name="project.app" value="${package(abbrev)}" />
<property name="build.dir" value="build"/>
<property name="app.build.dir" value="${build.dir}/${project.app}-${project.version}"/>
<property name="git.repo.path" value="${basedir}/.git"/>
<available file="${git.repo.path}" type="dir" property="git.present"/>
<property name="scripts.dir" value="node_modules/@teipublisher/pb-components/dist"/>
<property name="server.url" value="http://demo.exist-db.org/exist/apps/public-repo/public/" />
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
</target>
<target name="filter">
<mkdir dir="${app.build.dir}"/>
<copy todir="${app.build.dir}">
<fileset dir="${basedir}"
excludes="${build.dir}/**,build.xml,README.md,.*,repo.xml.tmpl,node_modules/**,package*.json,local.node-exist.json,gulpfile.js,.devcontainer,.idea/**"/>
</copy>
<copy todir="${app.build.dir}" overwrite="true" verbose="true">
<fileset file="*.xml.tmpl"/>
<filterchain>
<replacetokens>
<token key="name" value="${app.name}"/>
<token key="version" value="${app.version}"/>
<token key="url" value="${app.url}"/>
<token key="title" value="${app.title}"/>
<token key="commit-id" value="${git.revision}"/>
<token key="commit-time" value="${git.time}"/>
</replacetokens>
<tokenfilter>
<!-- until we move template processing to XSLT, take care with special characters -->
<replacestring from="&" to="&amp;"/>
</tokenfilter>
</filterchain>
<globmapper from="*.tmpl" to="*"/>
</copy>
</target>
<target name="prepare">
<copy todir="${app.build.dir}/resources/images">
<fileset dir="${basedir}/node_modules/@teipublisher/pb-components/images">
<include name="leaflet/*" />
<include name="openseadragon/*" />
</fileset>
</copy>
<copy todir="${app.build.dir}/resources/scripts">
<fileset dir="${scripts.dir}">
<include name="*.js" />
<include name="*.map" />
</fileset>
</copy>
<copy todir="${app.build.dir}/resources/css">
<fileset dir="${basedir}/node_modules/@teipublisher/pb-components/css" />
</copy>
<copy todir="${app.build.dir}/resources/lib">
<fileset dir="${basedir}/node_modules/@teipublisher/pb-components/lib">
</fileset>
</copy>
<copy todir="${app.build.dir}/resources/i18n/common">
<fileset dir="${scripts.dir}/../i18n/common" />
</copy>
</target>
<target name="xar" depends="clean,filter">
<zip basedir="${app.build.dir}" destfile="${build.dir}/${project.app}-${project.version}.xar" excludes="${build.dir}/* node_modules/**"/>
</target>
<target name="xar-local" depends="clean,npm.install,git.revision,filter,prepare">
<zip basedir="${app.build.dir}" destfile="${build.dir}/${project.app}-${project.version}.xar" excludes="${build.dir}/* node_modules/**"/>
</target>
<target name="npm.install">
<exec executable="${npm}" outputproperty="npm.output">
<arg line="install"/>
</exec>
<echo message="${npm.output}"/>
</target>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="--git-dir=${git.repo.path}"/>
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo>Git repo: ${repository.version}</echo>
<exec executable="git" outputproperty="git.time" failifexecutionfails="false" errorproperty="">
<arg value="--git-dir=${git.repo.path}"/>
<arg value="show"/>
<arg value="-s"/>
<arg value="--format=%ct"/>
<arg value="${git.revision}"/>
</exec>
<echo>Git time: ${git.time}</echo>
</target>
</project>