-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
113 lines (102 loc) · 4.37 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="update-baudi-docker" name="baudiApp" basedir="." xmlns:unless="ant:unless">
<dirname property="baudiApp.basedir" file="${ant.file.baudiApp}"/>
<!-- import default properties from file -->
<property file="${baudiApp.basedir}/local.build.properties"/>
<property file="${baudiApp.basedir}/build.properties"/>
<target name="clean-all">
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
<delete file="expath-pkg.xml"/>
<delete file="repo.xml"/>
</target>
<target name="clean">
<antcall target="clean-build"/>
<antcall target="clean-dist"/>
</target>
<target name="clean-build" if="${dist.dir}">
<delete includeemptydirs="true">
<fileset dir="${dist.dir}" defaultexcludes="false">
<!--<include name="*.xml"/>
<include name="*.txt"/>-->
<include name="**/*"/>
<exclude name="*.xar"/>
<exclude name="*.tar.gz"/>
</fileset>
</delete>
</target>
<target name="clean-dist" if="${build.dir}">
<delete includeemptydirs="true">
<fileset dir="${build.dir}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
</delete>
</target>
<target name="init" depends="get-current-hash-of-HEAD">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="get-current-hash-of-HEAD">
<description>Get the hash of the current git HEAD</description>
<exec executable="${bash.command}" outputproperty="local.revision">
<arg value="-c"/>
<arg value="${git.command} rev-parse --short HEAD"/>
<env key="LANG" value="C"/>
</exec>
<echo>Current HEAD: ${local.revision}</echo>
</target>
<target name="dist" depends="init">
<property name="project.app.pkg.name" value="${project.app}-${project.version}-${local.revision}.xar"/>
<copy todir="${build.dir}/">
<fileset dir=".">
<include name="**/*.*"/>
<exclude name="build.xml"/>
<exclude name=".existdb.json"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.xpr"/>
<exclude name="*.properties"/>
<exclude name="build/**"/>
<exclude name="${build.dir}/**"/>
<exclude name="scripts/**"/>
<exclude name="blob/"/>
<exclude name="**/__contents__.xml"/>
</fileset>
</copy>
<copy file="expath-pkg.xml.tmpl" tofile="${build.dir}/expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.app" value="${project.app}"/>
<filter token="project.name" value="${project.name}"/>
<filter token="project.version" value="${project.version}"/>
<filter token="project.version.hash" value="${local.revision}"/>
<filter token="project.url" value="${project.url}"/>
</filterset>
</copy>
<copy file="repo.xml.tmpl" tofile="${build.dir}/repo.xml" filtering="true" overwrite="true">
<filterset>
<filter token="data.target" value="${project.app}"/>
<filter token="project.name" value="${project.name}"/>
</filterset>
</copy>
<zip destfile="${dist.dir}/${project.app.pkg.name}">
<fileset dir="${build.dir}/">
<include name="**/*.*"/>
<exclude name="${dist.dir}/"/>
</fileset>
</zip>
<delete file="expath-pkg.xml"/>
<delete file="repo.xml"/>
<delete dir="${build.dir}"/>
</target>
<!-- Copy xar package to baudi-docker repo (autodeploy) -->
<target name="update-baudi-docker" depends="dist">
<echo>Delete old packages</echo>
<delete>
<fileset dir="./../baudi-docker/autodeploy">
<include name="${project.app}-*.xar"/>
</fileset>
</delete>
<echo>Add new package</echo>
<copy file="${dist.dir}/${project.app.pkg.name}" todir="./../baudi-docker/autodeploy" overwrite="yes"/>
</target>
</project>