forked from oSoc13/MyTurtle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
154 lines (137 loc) · 4.94 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="utf-8"?>
<!--
Build script for MyTurtle
@author: Michiel Vancoillie ([email protected])
-->
<project name="myturtle" default="build" basedir=".">
<description>MyTurtle</description>
<target name="-load.properties"
description="Set properties for this build">
<property name="devdir" value="src"/>
<!--YUI Compressor location-->
<property name="yui.dir" value="${devdir}/tools/yuicompressor.jar"/>
<!--Source JS dir-->
<property name="src.js.dir" value="${devdir}/js"/>
<!--Output dir-->
<property name="build.dir" value="client"/>
<!--Build version information -->
<property name="build.major" value="1"/>
<property name="build.minor" value="0"/>
</target>
<!--Create build directories-->
<target name="-init" depends="-load.properties"
description="Create build directory structure">
<!--Delete previous build files-->
<delete dir="${build.dir}/js"/>
<!--Recreate the build directories-->
<mkdir dir="${build.dir}/js"/>
</target>
<!--Concatenate JS files-->
<target name="-js.concatenate" depends="-init"
description="Concatenates specified Javascript files">
<!-- Core -->
<concat destfile="${build.dir}/js/core.js">
<fileset
dir="${src.js.dir}"
includes="core/*.js"/>
</concat>
<!-- Libraries copy-->
<copy todir="${build.dir}/js">
<fileset
dir="${src.js.dir}/libs/"
includes="*.js"
excludes="jquery.min.js"/>
</copy>
<!-- Plugins -->
<concat destfile="${build.dir}/js/plugins.js">
<fileset
dir="${src.js.dir}"
includes="plugins/*.js"/>
</concat>
<echo>Finished</echo>
</target>
<!--Minify JS files-->
<target name="-js.minify" depends="-js.concatenate"
description="Minifies JavaScript files">
<apply executable="java" parallel="false" dest="${build.dir}/js">
<fileset
dir="${build.dir}/js"
includes="*.js"
excludes="log4javascript.min.js"/>
<arg line="-jar"/>
<arg path="${yui.dir}"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*.min.js"/>
<targetfile/>
</apply>
<echo>Finished</echo>
</target>
<!--Composer libs file (order is important)-->
<target name="-compose.libs" depends="-js.minify"
description="Build libs file">
<concat destfile="${build.dir}/js/libs.min.js">
<filelist dir="${build.dir}/js">
<file name="leaflet.min.js"/>
<file name="wax.leaf.min.js"/>
</filelist>
<filelist dir="${src.js.dir}/libs">
<file name="jquery.min.js"/>
</filelist>
<filelist dir="${build.dir}/js">
<file name="underscore.min.js"/>
<file name="backbone.min.js"/>
<file name="mustache.min.js"/>
<file name="tinycolor.min.js"/>
<file name="later.min.js"/>
</filelist>
</concat>
<echo>Finished</echo>
</target>
<!-- Concat it all -->
<target name="-concat.all" depends="-compose.libs"
description="Build one file">
<echo file="${build.dir}/js/libs.min.js" append="true">
log.info("Done loading libraries");
log.info("Start loading core files");
</echo>
<echo file="${build.dir}/js/core.min.js" append="true">
log.info("Done loading core files");
log.info("Start loading plugin files");
</echo>
<echo file="${build.dir}/js/plugins.min.js" append="true">
log.info("Done loading plugin files");
</echo>
<concat destfile="${build.dir}/js/script.min.js">
<filelist dir="${build.dir}/js">
<file name="libs.min.js"/>
<file name="core.min.js"/>
<file name="plugins.min.js"/>
</filelist>
</concat>
<echo>Finished</echo>
</target>
<!-- Clean -->
<target name="-clean" depends="-concat.all"
description="Clean build directory">
<delete includeemptydirs="true">
<fileset dir="${build.dir}/js" defaultexcludes="false">
<exclude name="log4javascript.min.js" />
<exclude name="script.min.js" />
</fileset>
</delete>
<echo>Finished</echo>
</target>
<!--Build-->
<target name="build"
description="Builds project files for production use"
depends="
-load.properties,
-init,
-js.concatenate,
-js.minify,
-compose.libs,
-concat.all,
-clean">
</target>
</project>