-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
107 lines (94 loc) · 4.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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="lgpn-ling" basedir=".">
<xmlproperty file="expath-pkg.xml"/>
<xmlproperty file="build.properties.xml" semanticAttributes="true" keepRoot="false"/>
<property name="project.version" value="${package(version)}"/>
<property name="project.app" value="lgpn-ling"/>
<property name="build.dir" value="build"/>
<target name="all" depends="xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="clean" description="Clean output directories">
<echo message="Deleting xar files..."/>
<delete>
<fileset dir="${build.dir}">
<include name="*.xar"/>
</fileset>
</delete>
</target>
<available file=".git" type="dir" property="git.present"/>
<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="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<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 message="git HEAD is at ${repository.version}"/>
</target>
<target name="copy">
<copy todir="${build.dir}/${app.name}-${app.version}">
<fileset dir="${basedir}" excludes="${build.dir}/**,build.properties.xml,bower.json,build.xml,README.md,.idea/,.editorconfig,.existdb.json,expath-pkg.xml.tmpl,repo.xml.tmpl,bower_components/**,node_modules/**,package.json,local.node-exist.json,gulpfile.js"/>
</copy>
<copy todir="${build.dir}/${app.name}-${app.version}" overwrite="true" verbose="true">
<fileset file="expath-pkg.xml.tmpl"/>
<fileset file="repo.xml.tmpl"/>
<filterset>
<filter token="name" value="${app.name}"/>
<filter token="version" value="${app.version}"/>
<filter token="url" value="${app.url}"/>
<filter token="description" value="${app.description}"/>
<filter token="website" value="${app.url}"/>
<filter token="status" value="${app.status}"/>
<filter token="permissions" value="${app.permissions}"/>
</filterset>
<filterchain>
<replacetokens>
<token key="repository.version" value="${repository.version}" />
</replacetokens>
</filterchain>
<globmapper from="*.tmpl" to="*"/>
</copy>
</target>
<target name="xar" depends="clean,copy,git.revision" description="main target to create application XAR file">
<mkdir dir="${build.dir}"/>
<echo message="Calling npm start..."/>
<exec executable="${npm}" outputproperty="npm.output">
<arg line="start"/>
</exec>
<echo message="${npm.output}"/>
<echo message="Creating xar package..."/>
<zip basedir="${build.dir}/${app.name}-${app.version}" destfile="${build.dir}/${app.name}-${app.version}-${repository.version}.xar"/>
</target>
<!-- Update all packages and start gulp automation -->
<target name="update">
<echo message="Calling npm update..."/>
<exec executable="${npm}" outputproperty="npm.output">
<arg line="run-script"/>
<arg line="update"/>
</exec>
<echo message="${npm.output}"/>
</target>
<!-- Check & install new packages where required and start gulp automation -->
<target name="start">
<echo message="Calling npm start..."/>
<exec executable="${npm}" outputproperty="npm.output">
<arg line="start"/>
</exec>
<echo message="${npm.output}"/>
</target>
<!-- Start gulp build automation -->
<target name="gulp" description="Generate output files and sync static files from dependent packages">
<echo message="Calling gulp ..."/>
<exec executable="${npm}" outputproperty="npm.output">
<arg line="run-script"/>
<arg line="gulp"/>
</exec>
<echo message="${npm.output}"/>
</target>
</project>