-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
79 lines (72 loc) · 3.39 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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="xar" name="pocom">
<xmlproperty file="build.properties.xml" keepRoot="false" semanticAttributes="true"/>
<property name="build.dir" value="build"/>
<property name="git.repo.path" value="${basedir}/.git"/>
<available file="${git.repo.path}" property="git.present" type="dir"/>
<target name="clean">
<echo message="Deleting xar files..."/>
<delete dir="${build.dir}" failonerror="false"/>
<delete failonerror="false" file="${basedir}/expath-pkg.xml"/>
<delete failonerror="false" file="${basedir}/repo.xml"/>
</target>
<target depends="clean,git.revision" description="create xar file" name="xar">
<echo message="Creating build folder..."/>
<mkdir dir="${build.dir}"/>
<echo message="Apply values to expath-pkg.xml..."/>
<copy overwrite="true" todir="${basedir}" 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 reserved characters -->
<replacestring from="&" to="&amp;"/>
</tokenfilter>
</filterchain>
<globmapper from="*.tmpl" to="*"/>
</copy>
<echo message="------------------------------------------------------------"/>
<echo message="Creating xar file..."/>
<echo message="------------------------------------------------------------"/>
<zip basedir="${basedir}" destfile="${build.dir}/${app.name}.xar">
<exclude name="${build.dir}/**"/>
<exclude name="*.tmpl"/>
<exclude name=".github/**"/>
<exclude name="test/**"/>
<exclude name="node_modules/**"/>
</zip>
<echo>Version: ${app.version}</echo>
</target>
<target description="Store git revision in ${repository.version}" if="git.present"
name="git.revision">
<exec errorproperty="" executable="git" failifexecutionfails="false"
outputproperty="git.revision">
<arg value="--git-dir=${git.repo.path}"/>
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<condition else="unknown" property="repository.version" value="${git.revision}">
<and>
<isset property="git.revision"/>
<length length="0" string="${git.revision}" trim="yes" when="greater"/>
</and>
</condition>
<echo>Git repo: ${repository.version}</echo>
<exec errorproperty="" executable="git" failifexecutionfails="false"
outputproperty="git.time">
<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>