-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
220 lines (199 loc) · 9.03 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
<?xml version="1.0"?>
<project name="morpheuz" basedir="." default="all">
<property name="ver" value="46"/>
<property name="verdec" value="4.6"/>
<property name="inc" value="12"/> <!-- Cloudpebble download inc -->
<property name="vinc" value="1"/> <!-- Version marker on urls v=?? -->
<!--<property name="vincstr" value="?v=${vinc}"/>-->
<property name="vincstr" value=""/>
<property name="builddir" value="website/morpheuz/build"/>
<property name="srcdir" value="website/morpheuz"/>
<property name="test.dir" value="../Desktop/morpheuz"/>
<property name="img" value="/img"/>
<property name="cpexport" value="/Users/keith/Dropbox/PebbleStuff/morpheuz20/${verdec}/cloud/morpheuz${ver}-${inc}.zip"/>
<property name="maindir" value="/Users/keith/morpheuz20"/>
<property name="dbarchive" value="/Users/keith/Dropbox/PebbleStuff/morpheuz20/${verdec}/morpheuz20.zip"/>
<property name="jqplot" value="website/morpheuz/jqplot"/>
<property name="jqplotplug" value="website/morpheuz/jqplot/plugins"/>
<target name="baselibs" description="baselibs">
<antcall target="concatjqplot" inheritrefs="true" inheritall="true"/>
</target>
<target name="all" description="all">
<antcall target="unpack-cloud" inheritrefs="true" inheritall="true"/>
<antcall target="concat" inheritrefs="true" inheritall="true">
<param name="in.file.1" value="view.js" />
<param name="in.file.2" value="utils.js" />
<param name="in.file.3" value="../../src/js/morpheuzCommon.js" />
<param name="in.file.4" value="suncalc/suncalc.js" />
<param name="join.file" value="view-${ver}.js" />
</antcall>
<antcall target="shrink" inheritrefs="true" inheritall="true">
<param name="in.file" value="${srcdir}/view.css" />
<param name="min.file" value="view-${ver}.min.css" />
</antcall>
<antcall target="shrink" inheritrefs="true" inheritall="true">
<param name="in.file" value="${builddir}/view-${ver}.js" />
<param name="min.file" value="view-${ver}.min.js" />
</antcall>
<antcall target="copyedit" inheritrefs="true" inheritall="true">
<param name="in.file" value="view.html" />
<param name="out.file" value="view-${ver}.max.html" />
</antcall>
<antcall target="copyversion" inheritrefs="true" inheritall="true">
<param name="in.file" value="currentversion.json" />
<param name="out.file" value="currentversion.json" />
</antcall>
<antcall target="copyquote" inheritrefs="true" inheritall="true">
<param name="in.file" value="quotes.json" />
<param name="out.file" value="quotes.json" />
</antcall>
<antcall target="copyquote" inheritrefs="true" inheritall="true">
<param name="in.file" value="tweetmysleep.json" />
<param name="out.file" value="tweetmysleep.json" />
</antcall>
<antcall target="copyquote" inheritrefs="true" inheritall="true">
<param name="in.file" value="json_email.php" />
<param name="out.file" value="json_email.php" />
</antcall>
<antcall target="copyquote" inheritrefs="true" inheritall="true">
<param name="in.file" value="versionwrite.html" />
<param name="out.file" value="versionwrite.html" />
</antcall>
<antcall target="shrinkhtml" inheritrefs="true" inheritall="true">
<param name="max.html" value="view-${ver}.max.html" />
<param name="min.html" value="view-${ver}.html" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.min.css" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.min.js" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="view-${ver}.html" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="currentversion.json" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="quotes.json" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="tweetmysleep.json" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="json_email.php" />
</antcall>
<antcall target="copy" inheritrefs="true" inheritall="true">
<param name="min.file" value="versionwrite.html" />
</antcall>
<antcall target="copyimages" inheritrefs="true" inheritall="true" />
<antcall target="archive" inheritrefs="true" inheritall="true"/>
<fail message="package.json has incorrect version">
<condition>
<not>
<resourcecontains resource="package.json" substring=""${verdec}.0""/>
</not>
</condition>
</fail>
</target>
<target name="concatjqplot" description="concatjqplot">
<echo message="All jqplot javascript into ${jqplot}/jqplotbundle.min.js"/>
<concat destfile="${jqplot}/jqplotbundle.min.js">
<fileset file="${jqplot}/jquery.min.js" />
<fileset file="${jqplot}/jquery.jqplot.min.js" />
<fileset file="${jqplotplug}/jqplot.canvasAxisLabelRenderer.min.js" />
<fileset file="${jqplotplug}/jqplot.dateAxisRenderer.min.js" />
<fileset file="${jqplotplug}/jqplot.canvasTextRenderer.min.js" />
<fileset file="${jqplotplug}/jqplot.canvasAxisTickRenderer.min.js" />
<fileset file="${jqplotplug}/jqplot.canvasOverlay.min.js" />
<fileset file="${jqplotplug}/jqplot.pieRenderer.min.js" />
</concat>
</target>
<target name="concat" description="concat">
<concat destfile="${builddir}/${join.file}">
<fileset file="${srcdir}/${in.file.1}" />
<fileset file="${srcdir}/${in.file.2}" />
<fileset file="${srcdir}/${in.file.3}" />
<fileset file="${srcdir}/${in.file.4}" />
</concat>
</target>
<target name="shrink" description="shrink">
<delete file="${builddir}/${min.file}"/>
<echo message="Minifying ${in.file} to ${builddir}/${min.file}"/>
<java jar="../yui/yuicompressor-2.4.8.jar" fork="true">
<arg value="${in.file}" />
<arg value="-o" />
<arg value="${builddir}/${min.file}" />
<classpath>
<pathelement location="../yui/yuicompressor-2.4.8.jar" />
</classpath>
</java>
</target>
<target name="shrinkhtml" description="shrinkhtml">
<java jar="../yui/htmlcompressor-1.5.3.jar" fork="true">
<arg value="-o"/>
<arg value="${builddir}/${min.html}"/>
<arg value="${builddir}/${max.html}"/>
<arg value="--remove-quotes"/>
<arg value="--simple-doctype"/>
<arg value="--remove-style-attr"/>
<arg value="--remove-link-attr"/>
<arg value="--remove-script-attr"/>
<arg value="--remove-form-attr"/>
<arg value="--remove-input-attr"/>
<arg value="--simple-bool-attr"/>
<arg value="--remove-js-protocol"/>
<classpath>
<pathelement location="../yui/htmlcompressor-1.5.3.jar"/>
<pathelement location="../yui/yuicompressor-2.4.8.jar" />
</classpath>
</java>
</target>
<target name="copy" description="copy">
<echo message="Copying ${builddir}/${min.file} to ${test.dir}/${min.file}"/>
<copy file="${builddir}/${min.file}" tofile="${test.dir}/${min.file}" overwrite="true" force="true" />
</target>
<target name="copyedit" description="copyedit">
<echo message="Copying ${srcdir}/${in.file} to ${builddir}/${out.file}"/>
<copy file="${srcdir}/${in.file}" tofile="${builddir}/${out.file}" overwrite="true" force="true" />
<echo message="Editing ${builddir}/${out.file}"/>
<replace file="${builddir}/${out.file}" token="view.js?v=1" value="view-${ver}.min.js${vincstr}"/>
<replace file="${builddir}/${out.file}" token="view.css?v=1" value="view-${ver}.min.css${vincstr}"/>
</target>
<target name="copyversion" description="copyversion">
<echo message="Copying ${srcdir}/${in.file} to ${builddir}/${out.file}"/>
<copy file="${srcdir}/${in.file}" tofile="${builddir}/${out.file}" overwrite="true" force="true" />
<echo message="Editing ${builddir}/${out.file}"/>
<replace file="${builddir}/${out.file}" token="@@@" value="${ver}"/>
</target>
<target name="copyquote" description="copyquote">
<echo message="Copying ${srcdir}/${in.file} to ${builddir}/${out.file}"/>
<copy file="${srcdir}/${in.file}" tofile="${builddir}/${out.file}" overwrite="true" force="true" outputencoding="US-ASCII"/>
</target>
<target name="shrinkjson" description="shrinkjson">
<echo message="Shrink JSON on ${builddir}/${min.file}"/>
<exec executable="/usr/local/bin/json-minify">
<arg value="${maindir}/${builddir}/${min.file}"/>
</exec>
</target>
<target name="copyimages" description="copyimages">
<echo message="Copying images from ${srcdir}${img} to ${test.dir}${img}"/>
<copy todir="${test.dir}${img}" overwrite="true" force="true">
<fileset dir="${srcdir}${img}"/>
</copy>
</target>
<target name="unpack-cloud" description="unpack cloudpebble file">
<delete dir="${builddir}"/>
<delete dir="src"/>
<delete dir="resources"/>
<unzip src="${cpexport}" dest="${maindir}">
<mapper>
<globmapper from="morpheuz${ver}/*" to="*"/>
</mapper>
</unzip>
</target>
<target name="archive" description="archive maindir">
<zip basedir="${maindir}" destfile="${dbarchive}"/>
</target>
</project>