forked from tinymce/tinymce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
393 lines (344 loc) · 18.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<?xml version="1.0" encoding="UTF-8"?>
<project name="TinyMCE" default="build" basedir=".">
<!-- Path properties -->
<property description="Classes directory" name="classes_dir" location="jscripts/tiny_mce/classes" />
<property description="Build directory" name="build_dir" location="jscripts/tiny_mce" />
<property description="Temp directory" name="temp_dir" location="tmp" />
<property environment="env" />
<!-- Allow any user specific values to override the defaults -->
<property file="${user.home}/tinymce_build.properties" />
<!-- Setup classpath for js-build-tools ant tasks -->
<path id="tasks.classpath">
<pathelement location="."/>
<fileset dir="tools/ant">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- use a build number from the environment, defaulting it if not set. -->
<target name="default-build-number" unless="env.BUILD_NUMBER">
<tstamp />
<property description="Build number" name="build-number" value="${DSTAMP}${TSTAMP}" />
<echo message="${build-number}" />
</target>
<target name="env-build-number" if="env.BUILD_NUMBER">
<property description="Build number" name="build-number" value="${env.BUILD_NUMBER}" />
</target>
<target name="init-build-number" depends="env-build-number,default-build-number"/>
<!-- Register new js-build-tools ant tasks -->
<taskdef name="preprocess" classname="com.moxiecode.ant.tasks.PreProcessTask" classpathref="tasks.classpath" loaderref="tasks.classpath.loader" />
<taskdef name="yuicompress" classname="com.moxiecode.ant.tasks.YuiCompressTask" classpathref="tasks.classpath" loaderref="tasks.classpath.loader" />
<taskdef name="moxiedoc" classname="com.moxiecode.ant.tasks.MoxieDocTask" classpathref="tasks.classpath" loaderref="tasks.classpath.loader" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="tasks.classpath" loaderref="tasks.classpath.loader" />
<!-- Generate JS documentation -->
<target name="moxiedoc" depends="" description="Generates HTML documentation out of js source">
<mkdir dir="docs"/>
<delete quiet="true">
<fileset dir="docs/api" includes="**/*"/>
</delete>
<moxiedoc outdir="${basedir}/docs/api" templatedir="${basedir}/tools/templates" msintellisense="${basedir}/docs/api/tinymce.vsdoc.js" eventclass="tinymce.util.Dispatcher" title="TinyMCE API">
<fileset dir="${basedir}/jscripts/tiny_mce/classes">
<include name="**/*.js" />
</fileset>
<fileset dir="${basedir}/jscripts/tiny_mce/themes">
<include name="**/editor_template_src.js" />
</fileset>
<fileset dir="${basedir}/jscripts/tiny_mce/plugins">
<include name="**/editor_plugin_src.js" />
</fileset>
</moxiedoc>
</target>
<!-- Cleanup the build -->
<target name="clean" depends="" description="Cleans up the project from temporary files">
<delete dir="${temp_dir}" quiet="true" />
</target>
<!-- Concat and minify classes and scripts -->
<target name="build" depends="" description="Builds the project">
<!-- Combine all class files into one single script file -->
<concat destfile="${build_dir}/tiny_mce_tmp.js" fixlastline="yes">
<!-- tinymce base -->
<fileset dir="${classes_dir}" includes="tinymce.js" />
<fileset dir="${classes_dir}" includes="adapter/jquery/adapter.js" />
<fileset dir="${classes_dir}" includes="adapter/prototype/adapter.js" />
<!-- tinymce.util.* -->
<fileset dir="${classes_dir}" includes="util/Dispatcher.js" />
<fileset dir="${classes_dir}" includes="util/URI.js" />
<fileset dir="${classes_dir}" includes="util/Cookie.js" />
<fileset dir="${classes_dir}" includes="util/JSON.js" />
<fileset dir="${classes_dir}" includes="util/XHR.js" />
<fileset dir="${classes_dir}" includes="util/JSONRequest.js" />
<!-- tinymce.html.* -->
<fileset dir="${classes_dir}" includes="html/Entities.js" />
<fileset dir="${classes_dir}" includes="html/Styles.js" />
<fileset dir="${classes_dir}" includes="html/Schema.js" />
<fileset dir="${classes_dir}" includes="html/SaxParser.js" />
<fileset dir="${classes_dir}" includes="html/Node.js" />
<fileset dir="${classes_dir}" includes="html/DomParser.js" />
<fileset dir="${classes_dir}" includes="html/Writer.js" />
<fileset dir="${classes_dir}" includes="html/Serializer.js" />
<!-- tinymce.dom.* -->
<fileset dir="${classes_dir}" includes="dom/DOMUtils.js" />
<fileset dir="${classes_dir}" includes="dom/Range.js" />
<fileset dir="${classes_dir}" includes="dom/TridentSelection.js" />
<fileset dir="${classes_dir}" includes="dom/Sizzle.js" />
<fileset dir="${classes_dir}" includes="dom/EventUtils.js" />
<fileset dir="${classes_dir}" includes="dom/Element.js" />
<fileset dir="${classes_dir}" includes="dom/Selection.js" />
<fileset dir="${classes_dir}" includes="dom/Serializer.js" />
<fileset dir="${classes_dir}" includes="dom/ScriptLoader.js" />
<fileset dir="${classes_dir}" includes="dom/TreeWalker.js" />
<fileset dir="${classes_dir}" includes="dom/RangeUtils.js" />
<!-- tinymce.ui.* -->
<fileset dir="${classes_dir}" includes="ui/KeyboardNavigation.js" />
<fileset dir="${classes_dir}" includes="ui/Control.js" />
<fileset dir="${classes_dir}" includes="ui/Container.js" />
<fileset dir="${classes_dir}" includes="ui/Separator.js" />
<fileset dir="${classes_dir}" includes="ui/MenuItem.js" />
<fileset dir="${classes_dir}" includes="ui/Menu.js" />
<fileset dir="${classes_dir}" includes="ui/DropMenu.js" />
<fileset dir="${classes_dir}" includes="ui/Button.js" />
<fileset dir="${classes_dir}" includes="ui/ListBox.js" />
<fileset dir="${classes_dir}" includes="ui/NativeListBox.js" />
<fileset dir="${classes_dir}" includes="ui/MenuButton.js" />
<fileset dir="${classes_dir}" includes="ui/SplitButton.js" />
<fileset dir="${classes_dir}" includes="ui/ColorSplitButton.js" />
<fileset dir="${classes_dir}" includes="ui/ToolbarGroup.js" />
<fileset dir="${classes_dir}" includes="ui/Toolbar.js" />
<!-- tinymce.* -->
<fileset dir="${classes_dir}" includes="AddOnManager.js" />
<fileset dir="${classes_dir}" includes="EditorManager.js" />
<fileset dir="${classes_dir}" includes="Editor.js" />
<fileset dir="${classes_dir}" includes="EditorCommands.js" />
<fileset dir="${classes_dir}" includes="UndoManager.js" />
<fileset dir="${classes_dir}" includes="ForceBlocks.js" />
<fileset dir="${classes_dir}" includes="ControlManager.js" />
<fileset dir="${classes_dir}" includes="WindowManager.js" />
<fileset dir="${classes_dir}" includes="Formatter.js" />
<fileset dir="${classes_dir}" includes="LegacyInput.js" />
</concat>
<!-- Remove all jsdoc style comments -->
<replaceregexp match="/\*\*(.*?)\*\/\s*" replace="" flags="gs" byline="false" file="${build_dir}/tiny_mce_tmp.js" />
<!-- Preprocess core -->
<preprocess infile="${build_dir}/tiny_mce_tmp.js" outfile="${build_dir}/tiny_mce_src.js" />
<preprocess infile="${build_dir}/tiny_mce_tmp.js" outfile="${build_dir}/tiny_mce_prototype_src.js" defines="prototype,prototype_adapter" />
<preprocess infile="${build_dir}/tiny_mce_tmp.js" outfile="${build_dir}/tiny_mce_jquery_src.js" defines="jquery,jquery_adapter" />
<!-- Compress core -->
<yuicompress infile="${build_dir}/tiny_mce_src.js" outfile="${build_dir}/tiny_mce.js" />
<yuicompress infile="${build_dir}/tiny_mce_prototype_src.js" outfile="${build_dir}/tiny_mce_prototype.js" />
<yuicompress infile="${build_dir}/tiny_mce_jquery_src.js" outfile="${build_dir}/tiny_mce_jquery.js" />
<!-- Compress popup -->
<yuicompress infile="${build_dir}/classes/Popup.js" outfile="${build_dir}/tiny_mce_popup.js" />
<concat destfile="${build_dir}/tiny_mce_popup.js.tmp">
<header filtering="no" trimleading="yes">
// Uncomment and change this document.domain value if you are loading the script cross subdomains
// document.domain = 'moxiecode.com';
</header>
<fileset file="${build_dir}/tiny_mce_popup.js" />
</concat>
<move file="${build_dir}/tiny_mce_popup.js.tmp" tofile="${build_dir}/tiny_mce_popup.js" overwrite="true" />
<!-- Compress themes -->
<yuicompress infile="${build_dir}/themes/simple/editor_template_src.js" outfile="${build_dir}/themes/simple/editor_template.js" />
<yuicompress infile="${build_dir}/themes/advanced/editor_template_src.js" outfile="${build_dir}/themes/advanced/editor_template.js" />
<!-- Compress plugins -->
<for param="file">
<path>
<fileset dir="${build_dir}/plugins/" includes="*/editor_plugin_src.js" />
</path>
<sequential>
<propertyregex property="file.compressed" input="@{file}" regexp="_src.js$" replace=".js" override="yes" />
<yuicompress infile="@{file}" outfile="${file.compressed}" />
</sequential>
</for>
<!-- Compress jQuery plugin -->
<yuicompress infile="${classes_dir}/adapter/jquery/jquery.tinymce.js" outfile="${build_dir}/jquery.tinymce.js" />
<!-- Cleanup -->
<delete file="${build_dir}/tiny_mce_tmp.js" quiet="true"/>
</target>
<target name="build_full" depends="build" description="Builds a complete package">
<!-- Combine all files -->
<concat destfile="${build_dir}/tiny_mce_full.js">
<fileset dir="${build_dir}" includes="tiny_mce.js" />
<fileset dir="${build_dir}" includes="langs/en.js" />
<fileset dir="${build_dir}" includes="themes/advanced/langs/en.js" />
<fileset dir="${build_dir}" includes="themes/advanced/editor_template.js" />
<fileset dir="${build_dir}" includes="**/editor_plugin.js">
<exclude name="**/legacyoutput/*" />
<exclude name="**/example/*" />
<exclude name="**/fullpage/*" />
</fileset>
</concat>
</target>
<target name="prepare-release-files" depends="build,moxiedoc">
<delete dir="${temp_dir}" quiet="true" />
<!-- Copy the current repos and start processing it -->
<copy todir="${temp_dir}/tinymce">
<fileset dir=".">
<include name="**"/>
<exclude name="**/.*/**"/>
<exclude name="**/.*"/>
<exclude name="build-utils/**" />
</fileset>
</copy>
</target>
<target name="prepare-versions" depends="init-build-number,prepare-release-files" description="Builds release packages">
<!-- Parse minor version, major version and release date from changelog -->
<loadfile property="changelog" srcFile="${temp_dir}/tinymce/changelog.txt" />
<propertyregex property="version" input="${changelog}" regexp="^Version ([0-9xabrc.]+)" select="\1" />
<propertyregex property="release_date" input="${changelog}" regexp="^Version [^\(]+\(([^\)]+)\)" select="\1" />
<propertyregex property="version.major" input="${version}" regexp="^([0-9]+)\." select="\1" />
<propertyregex property="version.minor.upstream" input="${version}" regexp="^[^\.]+.([0-9xabrc.]+)" select="\1" />
<property name="version.minor" value="${version.minor.upstream}" />
<property name="file_version" value="${version}-${build-number}" />
<!-- Replace major version -->
<replaceregexp byline="true">
<regexp pattern="@@tinymce_major_version@@" />
<substitution expression="${version.major}" />
<fileset dir="${temp_dir}/tinymce">
<include name="jscripts/tiny_mce/tiny_mce.js" />
<include name="jscripts/tiny_mce/tiny_mce_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype_src.js" />
</fileset>
</replaceregexp>
<!-- Replace minor version -->
<replaceregexp byline="true">
<regexp pattern="@@tinymce_minor_version@@" />
<substitution expression="${version.minor}" />
<fileset dir="${temp_dir}/tinymce">
<include name="jscripts/tiny_mce/tiny_mce.js" />
<include name="jscripts/tiny_mce/tiny_mce_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype_src.js" />
</fileset>
</replaceregexp>
<!-- Replace release date -->
<replaceregexp byline="true">
<regexp pattern="@@tinymce_release_date@@" />
<substitution expression="${release_date}" />
<fileset dir="${temp_dir}/tinymce">
<include name="jscripts/tiny_mce/tiny_mce.js" />
<include name="jscripts/tiny_mce/tiny_mce_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery.js" />
<include name="jscripts/tiny_mce/tiny_mce_jquery_src.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype.js" />
<include name="jscripts/tiny_mce/tiny_mce_prototype_src.js" />
</fileset>
</replaceregexp>
</target>
<target name="prepare-examples" depends="prepare-release-files">
<!-- Replaces the tiny_mce_dev.js with tiny_mce.js in examples -->
<replaceregexp match="tiny_mce_(dev|jquery)\.js" replace="tiny_mce.js" flags="g" byline="true">
<fileset dir="${temp_dir}/tinymce/examples">
<include name="**/*.htm*" />
</fileset>
</replaceregexp>
</target>
<target name="prepare-version-queries" depends="prepare-release-files, prepare-versions">
<!-- Add or remove version queries -->
<if>
<equals arg1="${version_queries}" arg2="true" />
<then>
<!-- Add version suffix to all file requests -->
<replaceregexp match="\?v=\{tinymce_version\}" replace="?v=${file_version}" flags="g" byline="true">
<fileset dir="${temp_dir}/tinymce">
<include name="**/*.htm*" />
<include name="**/*.css" />
</fileset>
</replaceregexp>
</then>
<else>
<!-- Remove version suffixes, so that it won't break Lotus Notes -->
<replaceregexp match="\?v=\{tinymce_version\}" replace="" flags="g" byline="true">
<fileset dir="${temp_dir}/tinymce">
<include name="**/*.htm*" />
<include name="**/*.css" />
</fileset>
</replaceregexp>
</else>
</if>
</target>
<target name="prepare-release" depends="prepare-release-files, prepare-versions, prepare-examples, prepare-version-queries" />
<!--TODO consider if the community release name is the right one for this. -->
<target name="community-release" depends="prepare-release" description="Builds release packages">
<!-- Compress development package -->
<delete file="${temp_dir}/tinymce_${file_version}_dev.zip" quiet="true" />
<zip destfile="${temp_dir}/tinymce_${file_version}_dev.zip">
<zipfileset dir="${temp_dir}/tinymce" prefix="tinymce" />
</zip>
</target>
<target name="production-release" depends="prepare-release">
<!-- Compress production package -->
<delete file="${temp_dir}/tinymce_${file_version}.zip" quiet="true" />
<zip destfile="${temp_dir}/tinymce_${file_version}.zip" excludes="**/classes">
<fileset dir="${temp_dir}">
<include name="tinymce/jscripts/**" />
<include name="tinymce/examples/**" />
<include name="tinymce/changelog.txt" />
<!-- TODO consider if the license needs to be changed?-->
<exclude name="tinymce/examples/full_jquery.html" />
<exclude name="tinymce/jscripts/tiny_mce/classes/**" />
<exclude name="tinymce/jscripts/tiny_mce/jquery.tinymce.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_dev.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_jquery.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_jquery_src.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_prototype.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_prototype_src.js" />
</fileset>
</zip>
</target>
<target name="jquery-release" depends="prepare-release">
<!-- Compress production package for jquery -->
<delete file="${temp_dir}/tinymce_${file_version}_jquery.zip" quiet="true" />
<zip destfile="${temp_dir}/tinymce_${file_version}_jquery.zip" excludes="**/classes">
<fileset dir="${temp_dir}">
<include name="tinymce/jscripts/**" />
<include name="tinymce/changelog.txt" />
<exclude name="tinymce/examples/**" />
<exclude name="tinymce/jscripts/tiny_mce/classes/**" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_src.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_dev.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_jquery.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_jquery_src.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_prototype.js" />
<exclude name="tinymce/jscripts/tiny_mce/tiny_mce_prototype_src.js" />
</fileset>
<zipfileset dir="${temp_dir}" includes="tinymce/examples/css/content.css" fullpath="tinymce/examples/css/content.css"/>
<zipfileset dir="${temp_dir}" includes="tinymce/examples/full_jquery.html" fullpath="tinymce/examples/index.html"/>
<zipfileset dir="${temp_dir}" includes="tinymce/jscripts/tiny_mce/tiny_mce_jquery.js" fullpath="tinymce/jscripts/tiny_mce/tiny_mce.js"/>
<zipfileset dir="${temp_dir}" includes="tinymce/jscripts/tiny_mce/tiny_mce_jquery_src.js" fullpath="tinymce/jscripts/tiny_mce/tiny_mce_src.js"/>
</zip>
</target>
<!-- TODO does this belong here? how does this fit in with Ephox? -->
<target name="commercial-release" depends="prepare-release">
<!-- Remove copyright headers for commercial version -->
<replaceregexp match="^/\*(.*?)\*\/\s*" replace="" flags="gs" byline="false">
<fileset dir="${temp_dir}/tinymce">
<include name="**/*.js" />
</fileset>
</replaceregexp>
<echo file="${temp_dir}/tinymce/license_info.txt" append="false">
TinyMCE Commercial Application License
--------------------------------------
This copy of TinyMCE is under a commercial license, the LGPL headers are removed.
A signed agreement from Moxiecode Systems AB is required in order to use this specific copy of TinyMCE.
If you have any questions regarding your license, contact Moxiecode Systems AB (www.moxiecode.com).
</echo>
<!-- Compress development package (commercial) -->
<delete file="${temp_dir}/tinymce_${file_version}_dev_commercial.zip" quiet="true" />
<zip destfile="${temp_dir}/tinymce_${file_version}_dev_commercial.zip" excludes="**/license.txt">
<fileset dir="${temp_dir}">
<include name="tinymce/**" />
<exclude name="tinymce/**/license.txt" />
<exclude name="tinymce/**/advanced/about.htm" />
</fileset>
</zip>
</target>
<target name="release" depends="community-release, production-release, jquery-release, commercial-release" />
<target name="addsuffixes" description="Adds version suffixes to all requests">
<property name="version_queries" value="true" />
</target>
</project>