forked from bergie/VIE
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
291 lines (261 loc) · 10.6 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?xml version="1.0"?>
<project name="vie.js" basedir="." default="all">
<property name="VERSION" value="2.1.0alpha1"/>
<property name="DOCS_ROOT" value="./docs" />
<property name="DOCS_DIR" value="${DOCS_ROOT}/${VERSION}" description="API documentation"/>
<property name="DOCS_TMP" value="./docs_tmp" />
<property name="DIST_DIR" value="./dist"/>
<property name="DEMOS_DIR" value="./demos"/>
<property name="LIB_DIR" value="./lib"/>
<property name="SRC_DIR" value="./src"/>
<property name="TEST_DIR" value="./test"/>
<property name="TMP_DIR" value="./tmp"/>
<property name="TOOLS_DIR" value="./utils"/>
<property name="YUI" value="${TOOLS_DIR}/yui-compressor/yuicompressor-2.4.7.jar" />
<target name="timestamp">
<tstamp>
<format property="current.time"
pattern="yyyyMMddHHmmss" />
</tstamp>
</target>
<target name="doc" depends="init" description="Generates documentation for vie.js with Docco-Husky">
<echo message="Generating Documentation"/>
<echo message="Attention: 'Docco-Husky' is needed for that. Make sure it is on your PATH or"/>
<echo message="get it from: https://github.com/mbrevoort/docco-husky"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="docco-husky src/" />
</exec>
<move todir="${DOCS_DIR}">
<fileset dir="${DOCS_TMP}" />
</move>
<delete dir="${DOCS_TMP}"/>
</target>
<target name="doc_copy" depends="doc" description="Copies documentation into gh-pages branch ">
<echo message="Move docs temporarily"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${DOCS_DIR} ${DOCS_ROOT}/tmp"/>
</exec>
<echo message="Switching to gh-pages branch"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git checkout gh-pages" />
</exec>
<echo message="Move docs again"/>
<delete dir="${DOCS_DIR}" quiet="true"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${DOCS_ROOT}/tmp ${DOCS_DIR}"/>
</exec>
<echo message="Adding..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git add ${DOCS_DIR}" />
</exec>
<echo message="Committing..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git commit -m 'updating documentation for version ${VERSION}' ${DOCS_DIR}" />
</exec>
<echo message="Pushing..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git push origin gh-pages" />
</exec>
<echo message="Switching to master branch"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git checkout master" />
</exec>
</target>
<target name="test_copy" depends="dist" description="Copies browser-tests into gh-pages branch ">
<echo message="Move dist folder temporarily"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${DIST_DIR} ${DIST_DIR}_tmp"/>
</exec>
<echo message="Move lib folder temporarily"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="cp -R ${LIB_DIR} ${LIB_DIR}_tmp"/>
</exec>
<echo message="Move tests temporarily"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${TEST_DIR} ${TEST_DIR}_tmp"/>
</exec>
<echo message="Switching to gh-pages branch"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git checkout gh-pages" />
</exec>
<delete dir="${DIST_DIR}"/>
<echo message="Move dist again"/>
<delete dir="${DIST_DIR}" quiet="true"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${DIST_DIR}_tmp ${DIST_DIR}"/>
</exec>
<echo message="Remove timestamped files"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="rm ${DIST_DIR}/*_*.js"/>
</exec>
<delete dir="${LIB_DIR}"/>
<echo message="Move libs again"/>
<delete dir="${LIB_DIR}" quiet="true"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${LIB_DIR}_tmp ${LIB_DIR}"/>
</exec>
<delete dir="${TEST_DIR}"/>
<echo message="Move tests again"/>
<delete dir="${TEST_DIR}" quiet="true"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="mv ${TEST_DIR}_tmp ${TEST_DIR}"/>
</exec>
<echo message="Adding..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git add ${TEST_DIR}/*" />
</exec>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git add ${LIB_DIR}/*" />
</exec>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git add ${DIST_DIR}/*" />
</exec>
<echo message="Committing..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git commit -m 'updating browser-tests for version ${VERSION}_${current.time}' ${DIST_DIR} ${LIB_DIR} ${TEST_DIR}" />
</exec>
<echo message="Pushing..."/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git push origin gh-pages" />
</exec>
<echo message="Switching to master branch"/>
<exec executable="sh" dir=".">
<arg value="-c" />
<arg value="git checkout master" />
</exec>
</target>
<target name="clean" description="Tidy up project.">
<echo message="Deleting distribution and API documentation"/>
<delete dir="${DIST_DIR}"/>
<delete dir="${DOCS_DIR}"/>
</target>
<target name="init" depends="clean, timestamp">
<mkdir dir="${DIST_DIR}" />
<mkdir dir="${DOCS_DIR}" />
</target>
<target name="all" depends="dist"/>
<target name="dist" depends="init, combine, minimise, combineAll, minimiseAll" />
<target name="zip" depends="dist">
<zip destfile="${DIST_DIR}/vie-${VERSION}_${current.time}.zip">
<zipfileset dir="docs/" prefix="docs"/>
<zipfileset dir="service" prefix="service"/>
<zipfileset dir="dist/" includes="*.js"/>
</zip>
</target>
<target name="combine" description="combines core/*.js files into one file">
<echo message="Building vie.js Distribution" />
<concat destfile="${DIST_DIR}/vie-${VERSION}_${current.time}.debug.js">
<string>/*
</string>
<fileset dir="." includes="LICENSE"/>
<string>*/
</string>
<string>(function(){
</string>
<fileset dir="${SRC_DIR}" includes="VIE.js"/>
<fileset dir="${SRC_DIR}" includes="Able.js"/>
<fileset dir="${SRC_DIR}" includes="Util.js"/>
<fileset dir="${SRC_DIR}" includes="Literal.js"/>
<fileset dir="${SRC_DIR}" includes="LiteralCollection.js"/>
<fileset dir="${SRC_DIR}" includes="Entity.js"/>
<fileset dir="${SRC_DIR}" includes="Collection.js"/>
<fileset dir="${SRC_DIR}" includes="Type.js"/>
<fileset dir="${SRC_DIR}" includes="Attribute.js"/>
<fileset dir="${SRC_DIR}" includes="Namespace.js"/>
<!-- VIE 1.0 API compat -->
<fileset dir="${SRC_DIR}" includes="Classic.js"/>
<fileset dir="${SRC_DIR}/service" includes="*.js"/>
<fileset dir="${SRC_DIR}/service/stanbol">
<include name="StanbolConnector.js"/>
</fileset>
<fileset dir="${SRC_DIR}/service/stanbol">
<include name="*.js"/>
<exclude name="StanbolConnector.js"/>
</fileset>
<fileset dir="${SRC_DIR}/view" includes="*.js"/>
<!-- Internet Explorer specific jQuery Ajax transport handler -->
<fileset dir="${SRC_DIR}" includes="xdr.js"/>
<string>
})();
</string>
</concat>
<copy file="${DIST_DIR}/vie-${VERSION}_${current.time}.debug.js" tofile="${DIST_DIR}/vie-latest.debug.js" overwrite="true" />
</target>
<target name="combineAll" description="combines js libs and core/*.js files into one file">
<echo message="Building vie.js Distribution" />
<concat destfile="${DIST_DIR}/vie-ALL-${VERSION}_${current.time}.debug.js">
<string>/*
</string>
<fileset dir="${LIB_DIR}/jquery" includes="LICENSE"/>
<string>*/
</string>
<fileset dir="${LIB_DIR}/jquery/1.7" includes="jquery-1.7.1.min.js"/>
<string>/*
</string>
<fileset dir="${LIB_DIR}/underscoreJS" includes="LICENSE"/>
<string>*/
</string>
<fileset dir="${LIB_DIR}/underscoreJS" includes="underscore.js"/>
<string>/*
</string>
<fileset dir="${LIB_DIR}/backboneJS" includes="LICENSE"/>
<string>*/
</string>
<fileset dir="${LIB_DIR}/backboneJS" includes="backbone.js"/>
<string>/*
</string>
<fileset dir="${LIB_DIR}/json" includes="README"/>
<string>*/
</string>
<fileset dir="${LIB_DIR}/json" includes="json2.js"/>
<fileset dir="${DIST_DIR}" includes="vie-latest.debug.js"/>
</concat>
<copy file="${DIST_DIR}/vie-ALL-${VERSION}_${current.time}.debug.js" tofile="${DIST_DIR}/vie-ALL-latest.debug.js" overwrite="true" />
</target>
<target name="minimise">
<echo message="Minimising vie.js" />
<antcall target="minimiseJSFile">
<param name="inputFile" value="${DIST_DIR}/vie-${VERSION}_${current.time}.debug.js" />
<param name="outputFile" value="${DIST_DIR}/vie-${VERSION}_${current.time}.js" />
</antcall>
<replaceregexp file="${DIST_DIR}/vie-${VERSION}_${current.time}.js" match="^" replace="/* VIE ${VERSION} may be freely distributed under the MIT license. See http://viejs.org/ for more details. */" />
<copy file="${DIST_DIR}/vie-${VERSION}_${current.time}.js" tofile="${DIST_DIR}/vie-latest.js" overwrite="true" />
</target>
<target name="minimiseAll">
<echo message="Minimising ALL vie.js" />
<antcall target="minimiseJSFile">
<param name="inputFile" value="${DIST_DIR}/vie-ALL-${VERSION}_${current.time}.debug.js" />
<param name="outputFile" value="${DIST_DIR}/vie-ALL-${VERSION}_${current.time}.js" />
</antcall>
<copy file="${DIST_DIR}/vie-ALL-${VERSION}_${current.time}.js" tofile="${DIST_DIR}/vie-ALL-latest.js" overwrite="true" />
<replaceregexp file="${DIST_DIR}/vie-latest.js" match="^" replace="/*VIE may be freely distributed under the MIT license.*/" />
</target>
<target name="minimiseJSFile">
<java jar="${YUI}" fork="true" failonerror="true">
<arg line="--type js" />
<arg line="-o ${outputFile}" />
<arg value="${inputFile}" />
</java>
</target>
</project>