-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.xml
More file actions
90 lines (81 loc) · 3.4 KB
/
build.xml
File metadata and controls
90 lines (81 loc) · 3.4 KB
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
<project default="xar" name="works" basedir=".">
<xmlproperty file="expath-pkg.xml"/>
<property name="app.name" value="works"/>
<property name="build.dir" value="build"/>
<property name="app.version" value="1.0.0"/>
<property name="app.version" value="${app.version}"/>
<property name="git.repo.path" value="${basedir}/.git" />
<available file="${git.repo.path}" type="dir" property="git.present" />
<target name="clean">
<echo message="Deleting xar files..." />
<delete dir="${build.dir}" failonerror="false" />
</target>
<target name="templates" description="process template files" depends="clean,git.revision">
<echo message="Creating build folder..." />
<mkdir dir="${build.dir}" />
<echo>Update Version with: ${app.version}</echo>
<copy todir="${build.dir}" verbose="true">
<fileset file="repo.xml" />
<fileset file="expath-pkg.xml" />
<filterchain>
<replacetokens>
<token key="commit-id" value="${git.revision}" />
<token key="commit-time" value="${git.time}" />
</replacetokens>
<!--
Replace the 'version="1.0"' string in the expath-pkg.xml with the correct version. Do
not use normal token replacement for this since the regular token approach (%version%)
is forbidden in expath-pkg.xml. Instead, replace version=".*", but not in the XML header
-->
<replaceregex
pattern="(?<!xml )version=".*""
replace="version="${app.version}"" />
</filterchain>
</copy>
</target>
<target name="xar" depends="clean,templates" description="create xar file">
<echo message="------------------------------------------------------------" />
<echo message="Creating xar file..." />
<echo message="------------------------------------------------------------" />
<!-- Create the xar archive -->
<echo>Creating xar file...</echo>
<zip destfile="${build.dir}/${app.name}.xar">
<fileset dir=".">
<exclude name="${build.dir}/**" />
<exclude name=".github/**" />
<exclude name="node_modules/**" />
<exclude name=".gitignore" />
<exclude name=".vscode/**" />
<exclude name="expath-pkg.xml" />
<exclude name="repo.xml" />
<exclude name="schema/**" />
</fileset>
<zipfileset dir="${build.dir}" includes="expath-pkg.xml" fullpath="expath-pkg.xml" />
<zipfileset dir="${build.dir}" includes="repo.xml" fullpath="repo.xml" />
</zip>
</target>
<target name="git.revision" description="Store git revision in ${repository.version}">
<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>