forked from GeoCanViz/GeoCanViz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·247 lines (227 loc) · 9.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?xml version="1.0" encoding="UTF-8"?>
<project name="GCViz" default="build" basedir=".">
<description>GCViz Viewer</description>
<!-- properties -->
<target name="properties">
<property name="gcviz-build.version" value="v0.0.1-development"/>
<tstamp>
<format property="gcviz-build.timestamp" pattern="yyyy-MM-dd- hh:mm aa" locale="en,CA"/>
</tstamp>
<!-- allow user-specific overrides -->
<property file="build.user.properties"/>
<property file="build.properties"/>
</target>
<!-- classpath -->
<target name="classpath-lib" depends="properties">
<!-- ant contribs task definition -->
<path id="antcontrib.classpath">
<pathelement location="${antcontribs.jar}"/>
</path>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="antcontrib.classpath"/>
</taskdef>
<!-- yui-compressor task definition -->
<path id="yui.classpath">
<pathelement location="${yui-compressor.jar}"/>
<pathelement location="${yui-compressor-ant-task.jar}"/>
</path>
<taskdef name="yui-compressor" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
<classpath refid="yui.classpath"/>
</taskdef>
<!-- JSHint Ant task definition -->
<path id="jshint.classpath">
<pathelement location="${jshint.jar}"/>
</path>
<taskdef name="jshint" classname="com.philmander.jshint.JsHintAntTask">
<classpath refid="jshint.classpath"/>
</taskdef>
</target>
<!-- create distribution folder -->
<target name="create-dist">
<echo level="info" message="Creating dist folder..."/>
<echo message="${dist.dir}"/>
<delete dir="${dist.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<!-- Include jruby + gems (compass + sass) -->
<target name="build-jruby" depends="-jruby.jar.check" unless="jruby.jar.exists">
<echo level="info" message="---Enabling sass---"/>
<mkdir dir="${lib.dir}/jruby-compiled" />
<parallel>
<get src="http://jruby.org.s3.amazonaws.com/downloads/${jruby.version}/${jruby.jar}" dest="${lib.dir}/${jruby.jar}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${sass.gem}" dest="${gem.dir}/${sass.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${chunky_png.gem}" dest="${gem.dir}/${chunky_png.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${fssm.gem}" dest="${gem.dir}/${fssm.gem}" skipexisting="true"/>
<get src="http://production.cf.rubygems.org/gems/${compass.gem}" dest="${gem.dir}/${compass.gem}" skipexisting="true"/>
</parallel>
<parallel>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${sass.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${chunky_png.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${fssm.gem}" --local -f"/>
</java>
<java jar="${lib.dir}/${jruby.jar}" fork="true">
<arg line="-S gem install -i "${lib.dir}/vendors-${jruby.depends}" "${gem.dir}/${compass.gem}" --local -f"/>
</java>
</parallel>
</target>
<target name="-jruby.jar.check">
<checksum file="${basedir}/build.properties" property="jruby.depends"/>
<condition property="jruby.jar.exists">
<and>
<available file="${lib.dir}/${jruby.jar}" type="file"/>
<available file="${lib.dir}/vendors-${jruby.depends}" type="dir"/>
</and>
</condition>
</target>
<!-- Compile all of the SCSS files into their CSS counterparts "ant compile.sass" -->
<target name="compile-sass">
<echo level="info" message="---Converting CSS SCSS Files into CSS---"/>
<antcall target="call-sass">
<param name="command" value="compile"/>
</antcall>
</target>
<target name="call-sass">
<java fork="true" failonerror="true" jar="${lib.dir}/${jruby.jar}">
<arg value="--1.8"/>
<arg path="${build.dir}/compile.rb"/>
<arg path="${lib.dir}/vendors-${jruby.depends}/gems/"/>
<arg value="${command}"/>
<arg path="${src.dir}/js"/>
<arg value="${sass.css.dir}"/>
<arg value="false"/>
</java>
</target>
<!-- jshint -->
<target name="call-jshint">
<echo level="info" message="---Checking syntax with JSHint---"/>
<jshint dir="${src.dir}" fail="${jshint.failbuild}" options="maxerr=5000,bitwise=true,camelcase=true,curly=true,eqeqeq=true,forin=true,immed=true,latedef=true,newcap=false,noarg=true,noempty=true,nonew=true,plusplus=false,quotmark=true,undef=true,unused=true,strict=true,trailing=true" globalsFile="${jshint.globals.file}">
<report type="xml" destfile="${src.dir}/jshint.out.xml"/>
<include name="**/*.js"/>
<exclude name="**/*.min.js"/>
</jshint>
</target>
<!-- consolidate js NOT USE BECAUSE AMD IS EASIERS IN DIFFERENT FILES-->
<!-- <target name="consolidate-js" depends="properties, create-dist, jshint">
<echo level="info" message="...Consolidating js..."/>
<copy file="${src.dir}/js/${name.base.js}" tofile="${file.consolidated.js}"/>
<concat id="srcfiles" destfile="${file.consolidated.js}" append="true">
<fileset dir="${src.dir}/js">
<include name="**/*.js"/>
<exclude name="${name.base.js}"/>
<exclude name="config.js"/>
<exclude name="dependencies/jquery.min.js"/>
<exclude name="dependencies/knockout.min.js"/>
</fileset>
</concat>
<pathconvert pathsep=";" property="files" refid="srcfiles"/>
<echo>${files}</echo>
</target> -->
<!-- consolidate css -->
<target name="consolidate-css">
<echo level="info" message="---Consolidating css---"/>
<copy file="${src.dir}/js/sass/css/${name.base.css}" tofile="${file.consolidated.css}"/>
<concat id="srcfiles" destfile="${file.consolidated.css}" append="true">
<fileset dir="${src.dir}/js/sass">
<include name="**/*.css"/>
<exclude name="**/${name.base.css}"/>
</fileset>
</concat>
<pathconvert pathsep=";" property="files" refid="srcfiles"/>
<echo>${files}</echo>
<delete dir="${src.dir}/js/${sass.css.dir}"/>
</target>
<!-- minify -->
<target name="minify">
<echo level="info" message="---Minifying---"/>
<copy file="${src.dir}/js/${name.base.js}" tofile="${file.consolidated.js}"/>
<copy file="${src.dir}/js/${name.config.js}" tofile="${dist.dir}/${name.config.js}"/>
<copy todir="${dist.dir}/js/gistasks">
<fileset dir="${src.dir}/js/gistasks">
<include name="**/*.js" />
</fileset>
</copy>
<copy todir="${dist.dir}/js">
<fileset dir="${src.dir}/js/widgets">
<include name="**/*.js" />
</fileset>
</copy>
<copy todir="${dist.dir}/js/custom">
<fileset dir="${src.dir}/js/custom">
<include name="**/*.js" />
</fileset>
</copy>
<yui-compressor warn="false" munge="true" preserveAllSemiColons="false" fromDir="${dist.dir}" toDir="${dist.dir}" charset="utf-8">
<include name="**/*.css"/>
<include name="**/*.js"/>
</yui-compressor>
<delete>
<fileset dir="${dist.dir}">
<include name="**/*.css" />
<include name="**/*.js" />
<exclude name="**/*min.css" />
<exclude name="**/*min.js" />
</fileset>
</delete>
</target>
<!-- create language files -->
<target name="create-i18n">
<echo level="info" message="---Creating i18n language files---"/>
<!-- invoke java -->
<exec executable="java">
<!-- pass arguments -->
<arg line="-jar ${rhino.jar} -opt -1 ${build.dir}/createi18n.js" />
</exec>
</target>
<!-- copy images -->
<target name="copy-images">
<echo level="info" message="---Copying images---"/>
<copy todir="${dist.dir}/images">
<fileset dir="${src.dir}/js/images/global"/>
<fileset dir="${src.dir}/js/images/jqueryui"/>
<fileset dir="${src.dir}/js/images/jquerydatatable"/>
<fileset dir="${src.dir}/js/images/lightbox"/>
<fileset dir="${src.dir}/js/images/sprite"/>
<fileset dir="${src.dir}/js/images/head"/>
<fileset dir="${src.dir}/js/images/help"/>
<fileset dir="${src.dir}/js/images/draw"/>
<fileset dir="${src.dir}/js/images/nav"/>
<fileset dir="${src.dir}/js/images/foot"/>
<fileset dir="${src.dir}/js/images/inset"/>
<fileset dir="${src.dir}/js/images/print"/>
</copy>
</target>
<!-- copy print templates -->
<target name="copy-printtemplates">
<echo level="info" message="---Copying print templates---"/>
<copy todir="${dist.dir}/print">
<fileset dir="${src.dir}/print"/>
</copy>
</target>
<!-- copy dependencies -->
<target name="copy-dependencies">
<echo level="info" message="---Copying dependencies---"/>
<copy todir="${dist.dir}/dependencies">
<fileset dir="${src.dir}/js/dependencies"/>
</copy>
</target>
<!-- update header -->
<target name="update-headers">
<echo level="info" message="---Updating headers---"/>
<replace dir="${dist.dir}" encoding="UTF-8">
<include name="**/*.js"/>
<include name="**/*.css"/>
<replacefilter token="@gcviz.version@" value="${gcviz-build.version} Build: ${gcviz-build.timestamp}"/>
</replace>
</target>
<!-- finish -->
<target name="finish">
<echo level="info" message="---Build finish---"/>
</target>
<!-- build -->
<target name="build" depends="classpath-lib, create-dist, build-jruby, compile-sass, call-jshint, consolidate-css, minify, create-i18n, copy-images, copy-printtemplates, copy-dependencies, update-headers, finish"></target>
</project>