forked from jsplumb/jsplumb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
120 lines (104 loc) · 3.42 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
114
115
116
117
118
119
120
<?xml version="1.0"?>
<project default="build">
<path id="yuicompressor.classpath">
<fileset dir="./lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="js.minify">
<java jar="./lib/yuicompressor-2.4.2.jar" fork="true" output="${output}">
<arg value="${input}"/>
<classpath>
<path refid="yuicompressor.classpath"/>
</classpath>
</java>
</target>
<!-- ant-contrib taskdefs -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="./lib/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<!--
create final version number
-->
<propertyregex property="final.version"
input="${version}"
regexp="[0-9]+\.[0-9]+\.[0-9]+"
select="\0"
casesensitive="false" />
<property name="dir" value="./js/${final.version}/"/>
<echo>building from version ${version}</echo>
<echo>building final version ${final.version} in directory ${dir}</echo>
<!--
fails the build if no "version" parameter supplied.
-->
<target name="check" unless="version">
<fail message="You must supply the version to bundle, eg. ant -Dversion=x.y.c-RCn"/>
</target>
<!--
concats a single library.
expects "library" parameter to be set.
-->
<target name="concatLibrary" depends="check">
<concat destfile="${dir}/${library}.jsPlumb-${final.version}-all.js">
<filelist dir="${dir}" files="jsPlumb-${version}.js,jsPlumb-defaults-${version}.js,jsPlumb-connectors-statemachine-${version}.js, jsPlumb-renderers-vml-${version}.js, jsPlumb-renderers-svg-${version}.js, jsPlumb-renderers-canvas-${version}.js, ${library}.jsPlumb-${version}.js, ../lib/jsBezier-0.3-min.js"/>
</concat>
</target>
<target name="minLibrary" depends="concatLibrary">
<antcall target="js.minify">
<param name="input" value="${dir}/${library}.jsPlumb-${final.version}-all.js"/>
<param name="output" value="${dir}/${library}.jsPlumb-${final.version}-all-min.js"/>
</antcall>
</target>
<!--
concats the three main files together to write final versions for
all supported libraries.
expects a "-Dversion=x.y.z-RCn" parameter on the Ant call. strips "-RCn"
from the end to derive a final name.
-->
<target name="concat" depends="check">
<antcall target="concatLibrary">
<param name="library" value="jquery"/>
</antcall>
<antcall target="concatLibrary">
<param name="library" value="mootools"/>
</antcall>
</target>
<!--
generates minified and concatenated scripts for supported libraries.
-->
<target name="min" depends="check">
<antcall target="minLibrary">
<param name="library" value="jquery"/>
</antcall>
<antcall target="minLibrary">
<param name="library" value="mootools"/>
</antcall>
<antcall target="minLibrary">
<param name="library" value="yui"/>
</antcall>
</target>
<target name="docs" depends="min">
<mkdir dir="js/TEMP"/>
<copy todir="js/TEMP">
<fileset dir="js/${final.version}">
<include name="jquery.jsPlumb-${final.version}-all.js"/>
</fileset>
</copy>
<mkdir dir="apidocs"/>
<exec executable="naturaldocs">
<arg line="-i"/>
<arg path="js/TEMP"/>
<arg line="-o"/>
<arg line="HTML"/>
<arg line="apidocs"/>
<arg line="-p"/>
<arg line="."/>
</exec>
<delete dir="js/TEMP"/>
</target>
<target name="build">
<antcall target="min"/>
</target>
</project>