-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
106 lines (87 loc) · 3.48 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
<project name="JsSdk" default="RhinoBuild">
<property name="testoutputdirs" value="tests/out" />
<property name="outputdirs" value="build,output" />
<target name="TestClean" depends="-LoadAntContrib">
<foreach target="-CleanOutputDir" list="${testoutputdirs}" param="outputdir" />
</target>
<target name="Clean" depends="-LoadAntContrib">
<foreach target="-CleanOutputDir" list="${outputdirs}" param="outputdir" />
</target>
<target name="-CleanOutputDir">
<echo taskname="${ant.project.name}">Clean output directory: ${outputdir}</echo>
<delete dir="${outputdir}" />
<mkdir dir="${outputdir}" />
</target>
<target name="-LoadAntContrib" unless="ant-contrib-already-loaded">
<taskdef resource="net/sf/antcontrib/antlib.xml" id="">
<classpath>
<pathelement location="ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
</target>
<target name="-GetGitRevisionHash">
<exec executable="git" outputProperty="GitHash">
<arg value="rev-list"/>
<arg value="--tags"/>
<arg value="--max-count=1"/>
</exec>
</target>
<target name="-GetGitLastTag" depends="-GetGitRevisionHash">
<exec executable="git" outputproperty="GitLastTag">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="${GitHash}"/>
</exec>
</target>
<target name="RhinoBuild" depends="-LoadAntContrib,Clean,-GetGitLastTag">
<antcall target="copyDirToBuild">
<param name="dir" value="lib"/>
</antcall>
<antcall target="copyDirToBuild">
<param name="dir" value="context_aware/rhino"/>
</antcall>
<antcall target="copyFile">
<param name="theFile" value="AltaPayFactory.js"/>
</antcall>
<echo output="build/JssdkVersion.js" append="false">
JssdkVersion = {
VERSION : 'JsSDK/${GitLastTag}'
}
</echo>
<antcall target="includeDir">
<param name="dir" value="build"/>
</antcall>
<!-- It's important to copy the SalesForce modules to the end of the file only: -->
<antcall target="writeToOutputFile">
<param name="theFile" value="salesforce/SalesForceModules.js"/>
</antcall>
<move file="output/out.js" tofile="output/Rhino-AltaPay-Jssdk.js" />
<!-- Archive the latest build package with the latest version in the name -->
<zip destfile="output/Rhino-AltaPay-JsSDK_${GitLastTag}.zip">
<fileset dir="output">
<include name="Rhino-AltaPay-Jssdk.js" />
</fileset>
</zip>
</target>
<target name="copyDirToBuild">
<foreach target="copyFile" param="theFile">
<fileset dir="${dir}" casesensitive="yes">
<include name="**/*.js"/>
</fileset>
</foreach>
</target>
<target name="copyFile">
<copy file="${theFile}" todir="build"/>
</target>
<target name="includeDir">
<foreach target="writeToOutputFile" param="theFile">
<fileset dir="${dir}" casesensitive="yes">
<include name="**/*.js"/>
</fileset>
</foreach>
</target>
<target name="writeToOutputFile">
<loadfile property="fileContents" srcFile="${theFile}" />
<echo message="${fileContents}" output="output/out.js" append="true"/>
</target>
</project>