-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.xml
247 lines (203 loc) · 8.31 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Open Knesset" default="development" basedir=".">
<property name="GoogleClosureDir" value="compiler-latest"/>
<property name="concat.dir" value="temp/www"/>
<property name="source.web.dir" value="src/web/www"/>
<property name="target.web.dir" value="target/web/www/"/>
<property name="xcodeWWWDir" value="native/iOS/OKnesset/www"/>
<property name="androidWWWDir" value="native/Android/OKnesset/assets/www"/>
<target name="buildweb">
<delete dir="${target.web.dir}"/>
<copy todir="${target.web.dir}">
<fileset dir="${source.web.dir}">
<include name="**"/>
</fileset>
</copy>
</target>
<target name="customize">
<copy todir="target/${channel.dir}/www">
<fileset dir="${source.web.dir}">
<include name="**"/>
</fileset>
</copy>
<copy todir="target/${channel.dir}/www" overwrite="true">
<fileset dir="src/${channel.dir}/www">
<include name="**"/>
</fileset>
</copy>
</target>
<target name="buildProd">
<delete dir="target_prod/${channel.dir}/"/>
<delete dir="${concat.dir}"/>
<!-- Copy all files except javascripts files that need concatenation -->
<copy todir="target_prod/${channel.dir}/www">
<fileset dir="target/${channel.dir}/www">
<exclude name="**/*.js"/>
<exclude name="index*.html"/>
</fileset>
</copy>
<!-- copy all javascript files to a temp dir for concatenation -->
<copy todir="${concat.dir}" overwrite="true">
<fileset dir="target/${channel.dir}/www/">
<include name="**/*.js"/>
</fileset>
</copy>
<!-- concatenate the javascript files -->
<concat destfile="${concat.dir}/concat.js" outputencoding="utf-8" encoding="utf-8">
<filelist refid="essentialConcatFiles"/>
<fileset refid="concatFiles"/>
<fileset refid="concatFilesViews"/>
<fileset refid="concatFilesControllers"/>
</concat>
<echo message="Minifying ${channel.dir}"/>
<!-- minify concatenated file -->
<java jar="${GoogleClosureDir}/compiler.jar" fork="true">
<arg line="--js ${concat.dir}/concat.js --compilation_level WHITESPACE_ONLY --jscomp_off=internetExplorerChecks --js_output_file target_prod/${channel.dir}/www/javascripts/concat.min.js"/>
</java>
<!-- delete temp directory
<delete dir="${concat.dir}"/> -->
<!-- copy index-prod.html and apiParser file -->
<copy file="target/${channel.dir}/www/index-prod.html" tofile="target_prod/${channel.dir}/www/index.html"/>
<copy file="target/${channel.dir}/www/javascripts/apiParser.js" tofile="target_prod/${channel.dir}/www/javascripts/apiParser.js"/>
</target>
<target name="copyToXcode">
<delete dir="${xcodeWWWDir}"/>
<copy todir="${xcodeWWWDir}">
<fileset dir="${source.dir}">
<include name="**"/>
</fileset>
</copy>
</target>
<target name="copyToAndroid">
<delete dir="${androidWWWDir}"/>
<copy todir="${androidWWWDir}">
<fileset dir="${source.dir}">
<include name="**"/>
</fileset>
</copy>
</target>
<target name="development">
<antcall target="setup"/>
<antcall target="copyToXcode">
<param name="source.dir" value="target/ios/www"/>
</antcall>
<antcall target="copyToAndroid">
<param name="source.dir" value="target/android/www"/>
</antcall>
<set.timestamp/>
<echo message="build complete at ${current.time}"/>
</target>
<target name="production">
<antcall target="setup"/>
<antcall target="buildProd">
<param name="channel.dir" value="ios"/>
</antcall>
<antcall target="copyToXcode">
<param name="source.dir" value="target_prod/ios/www"/>
</antcall>
<antcall target="buildProd">
<param name="channel.dir" value="android"/>
</antcall>
<antcall target="copyToAndroid">
<param name="source.dir" value="target_prod/android/www"/>
</antcall>
<antcall target="buildProd">
<param name="channel.dir" value="web"/>
</antcall>
<set.timestamp/>
<echo message="build complete at ${current.time}"/>
</target>
<patternset id="appFilesExclustion">
<exclude name="**/cordova-2.2.0.js"/>
<exclude name="**/apiParser.js"/>
<exclude name="**/debug.js"/>
<exclude name="**/time.js"/>
<exclude name="**/*.txt"/>
<exclude name="apiParserTest.js"/>
<exclude name="sencha-touch/sencha-touch.js"/>
<exclude name="sencha-touch/sencha-touch-debug-w-comments.js"/>
<exclude name="sencha-touch/sencha-touch-fixes.js"/>
<exclude name="customization.js"/>
<exclude name="views/disclaimer.js"/>
<exclude name="views/memberPanel.js"/>
<exclude name="utils.js"/>
<exclude name="routes.js"/>
<exclude name="index.js"/>
<exclude name="private.js"/>
<exclude name="models/strings.js"/>
<exclude name="models/slimData.js"/>
<exclude name="models/partyInfoData.js"/>
<exclude name="models/data.js"/>
<exclude name="views/OKnessetPanel.js"/>
<exclude name="views/memberPanel.js"/>
<exclude name="views/committeesPanel.js"/>
</patternset>
<patternset id="appFiles">
<include name="*.js"/>
</patternset>
<patternset id="appFilesViews">
<include name="**/views/*.js"/>
</patternset>
<patternset id="appFilesControllers">
<include name="**/controllers/*.js"/>
</patternset>
<filelist id="essentialConcatFiles" dir="${concat.dir}/javascripts">
<file name="cordova-2.2.0.js"/>
<!-- <file name="sencha-touch/sencha-touch-debug-w-comments.js"/> -->
<file name="sencha-touch/sencha-touch.js"/>
<file name="sencha-touch/sencha-touch-fixes.js"/>
<file name="customization.js"/>
<file name="utils.js"/>
<file name="index.js"/>
<file name="private.js"/>
<file name="routes.js"/>
<file name="models/slimData.js"/>
<file name="models/partyInfoData.js"/>
<file name="models/electionData.js"/>
<file name="views/disclaimer.js"/>
<file name="views/credits.js"/>
<file name="models/strings.js"/>
<file name="models/data.js"/>
<file name="views/OKnessetPanel.js"/>
<file name="views/memberPanel.js"/>
<file name="views/committeesPanel.js"/>
</filelist>
<fileset id="concatFiles" dir="${concat.dir}/javascripts">
<patternset refid="appFiles"/>
<patternset refid="appFilesExclustion"/>
</fileset>
<fileset id="concatFilesViews" dir="${concat.dir}/javascripts">
<patternset refid="appFilesViews"/>
<patternset refid="appFilesExclustion"/>
</fileset>
<fileset id="concatFilesControllers" dir="${concat.dir}/javascripts">
<patternset refid="appFilesControllers"/>
<patternset refid="appFilesExclustion"/>
</fileset>
<target name="setup">
<defaultexcludes add="**/.settings"/>
<defaultexcludes add="**/.settings/**"/>
<defaultexcludes add="**/.git"/>
<defaultexcludes add="**/.git/**"/>
<defaultexcludes add=".project"/>
<defaultexcludes add=".gitignore"/>
<defaultexcludes add=".rockstarapps"/>
<defaultexcludes add=".DS_Store"/>
<defaultexcludes add="createInitialData.html"/>
<defaultexcludes add="sencha-touch/sencha-touch-debug-w-comments.js"/>
<antcall target="buildweb"/>
<antcall target="customize">
<param name="channel.dir" value="ios"/>
</antcall>
<antcall target="customize">
<param name="channel.dir" value="android"/>
</antcall>
</target>
<macrodef name="set.timestamp">
<sequential>
<tstamp>
<format property="current.time" pattern="MM/dd/yyyy hh:mm"/>
</tstamp>
</sequential>
</macrodef>
</project>