forked from josdejong/jsoneditor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
196 lines (171 loc) · 9.13 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
<!-- ant build script for jsoneditoronline -->
<project name="jsoneditor-builder" default="main">
<!-- the version number of must be updated here (according to changelog.txt) -->
<property name="version" value="2.1.1"/>
<!-- compression tools -->
<property name="compressor" value="tools/yuicompressor-2.4.7.jar" />
<!-- directories -->
<property name="lib" location="build/lib" />
<property name="web_app" location="build/app/web" />
<property name="chrome_app" location="build/app/chrome" />
<property name="web_app_src" location="app/web" />
<property name="src" location="jsoneditor" />
<property name="js_src" location="jsoneditor/js" />
<property name="css_src" location="jsoneditor/css" />
<property name="img_src" location="jsoneditor/css/img" />
<property name="jsoneditor" location="${lib}/jsoneditor-${version}" />
<property name="jsoneditor_min" location="${lib}/jsoneditor-${version}.min" />
<target name="build_lib" description="build jsoneditor library">
<delete dir="${jsoneditor}" />
<delete dir="${jsoneditor_min}" />
<!-- copy all files for the non-minified jsoneditor -->
<copy file="README.md" todir="${jsoneditor}" />
<copy file="LICENSE" todir="${jsoneditor}" />
<copy file="NOTICE" todir="${jsoneditor}" />
<copy file="changelog.txt" todir="${jsoneditor}" />
<copy todir="${jsoneditor}/examples">
<fileset dir="${src}/examples"/>
</copy>
<copy file="${img_src}/jsoneditor-icons.png" todir="${jsoneditor}/img" />
<!-- copy all files for the minified jsoneditor -->
<copy file="README.md" todir="${jsoneditor_min}" />
<copy file="LICENSE" todir="${jsoneditor_min}" />
<copy file="NOTICE" todir="${jsoneditor_min}" />
<copy file="changelog.txt" todir="${jsoneditor_min}" />
<copy todir="${jsoneditor_min}/examples">
<fileset dir="${src}/examples"/>
</copy>
<copy file="${img_src}/jsoneditor-icons.png" todir="${jsoneditor_min}/img" />
<!-- replace the library references with the references of the minified lib -->
<replace dir="${jsoneditor_min}/examples"
token="jsoneditor.js"
value="jsoneditor-min.js">
<include name="**/*.html"/>
</replace>
<replace dir="${jsoneditor_min}/examples"
token="jsoneditor.css"
value="jsoneditor-min.css">
<include name="**/*.html"/>
</replace>
<replace file="${jsoneditor_min}/examples/requirejs_demo/scripts/main.js"
token="../../../jsoneditor"
value="../../../jsoneditor-min" />
<!-- concatenate the javascript files -->
<concat destfile="${jsoneditor}/tmp.js">
<fileset dir="${js_src}" includes="jsoneditor.js"/>
<fileset dir="${js_src}" includes="jsonformatter.js"/>
<fileset dir="${js_src}" includes="node.js"/>
<fileset dir="${js_src}" includes="appendnode.js"/>
<fileset dir="${js_src}" includes="contextmenu.js"/>
<fileset dir="${js_src}" includes="history.js"/>
<fileset dir="${js_src}" includes="searchbox.js"/>
<fileset dir="${js_src}" includes="highlighter.js"/>
<fileset dir="${js_src}" includes="util.js"/>
</concat>
<loadfile property="tmp" srcFile="${jsoneditor}/tmp.js"/>
<delete file="${jsoneditor}/tmp.js" />
<!-- inject the concatenated javascript files in the module file -->
<copy file="${js_src}/module.js" tofile="${jsoneditor}/jsoneditor.js" />
<replace file="${jsoneditor}/jsoneditor.js"
token="/***code_placeholder***/"
value="${tmp}" />
<!-- concatenate the css files -->
<concat destfile="${jsoneditor}/jsoneditor.css">
<fileset dir="${css_src}" includes="jsoneditor.css"/>
<fileset dir="${css_src}" includes="menu.css"/>
<fileset dir="${css_src}" includes="contextmenu.css"/>
<fileset dir="${css_src}" includes="searchbox.css"/>
</concat>
<!-- minify the jsoneditor files -->
<java jar="${compressor}" dir="${jsoneditor}/" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${jsoneditor_min}/jsoneditor-min.js"/>
<arg value="jsoneditor.js"/>
</java>
<java jar="${compressor}" dir="${jsoneditor}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${jsoneditor_min}/jsoneditor-min.css"/>
<arg value="jsoneditor.css"/>
</java>
<!-- create a zip file with non-minified jsoneditor -->
<zip destfile="${lib}/jsoneditor-${version}.zip">
<fileset dir="${lib}" includes="jsoneditor-${version}/**" />
</zip>
<!-- create a zip file with minified jsoneditor -->
<zip destfile="${lib}/jsoneditor-${version}.min.zip">
<fileset dir="${lib}" includes="jsoneditor-${version}.min/**" />
</zip>
</target>
<target name="build_web_app" depends="build_lib" description="copy all files for the web application to the build directory">
<delete dir="${web_app}" />
<mkdir dir="${web_app}" />
<!-- concatenate the javascript and css app files -->
<concat destfile="${web_app}/app.js">
<fileset dir="${web_app_src}" includes="queryparams.js"/>
<fileset dir="${web_app_src}" includes="ajax.js"/>
<fileset dir="${web_app_src}" includes="fileretriever.js"/>
<fileset dir="${web_app_src}" includes="notify.js"/>
<fileset dir="${web_app_src}" includes="splitter.js"/>
<fileset dir="${web_app_src}" includes="app.js"/>
</concat>
<concat destfile="${web_app}/app.css">
<fileset dir="${web_app_src}" includes="fileretriever.css"/>
<fileset dir="${web_app_src}" includes="app.css"/>
</concat>
<!-- copy all other files and libraries-->
<copy file="changelog.txt" todir="${web_app}" />
<copy file="README.md" todir="${web_app}" />
<copy file="LICENSE" todir="${web_app}" />
<copy file="NOTICE" todir="${web_app}" />
<copy file="${web_app_src}/robots.txt" todir="${web_app}" />
<copy file="${web_app_src}/datapolicy.txt" todir="${web_app}" />
<copy file="${web_app_src}/index.html" todir="${web_app}" />
<copy file="${web_app_src}/favicon.ico" todir="${web_app}" />
<copy file="${web_app_src}/fileretriever.php" todir="${web_app}" />
<copy file="${web_app_src}/googlea47c4a0b36d11021.html" todir="${web_app}" />
<copy file="${web_app_src}/img/logo.png" todir="${web_app}/img" />
<copy file="${web_app_src}/img/header_background.png" todir="${web_app}/img" />
<copy todir="${web_app}/doc">
<fileset dir="${web_app_src}/doc"/>
</copy>
<!-- concatenate and copy the ace files -->
<concat destfile="${web_app}/lib/ace/ace-min.js">
<fileset dir="${web_app_src}/lib/ace" includes="ace.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="mode-json.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="theme-textmate.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="theme-jso.js"/>
</concat>
<copy file="${web_app_src}/lib/ace/worker-json.js" todir="${web_app}/lib/ace" />
<copy file="${web_app_src}/lib/jsonlint/jsonlint.js" todir="${web_app}/lib/jsonlint" />
<copy file="${jsoneditor_min}/jsoneditor-min.js" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/jsoneditor-min.css" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/img/jsoneditor-icons.png" todir="${web_app}/lib/jsoneditor/img" />
<!-- minify the javascript files -->
<java jar="${compressor}" dir="${web_app}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="app-min.js"/>
<arg value="app.js"/>
</java>
<java jar="${compressor}" dir="${web_app}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="app-min.css"/>
<arg value="app.css"/>
</java>
<!-- delete non-minified app files -->
<delete file="${web_app}/app.js" />
<delete file="${web_app}/app.css" />
</target>
<target name="build_chrome_app" depends="build_lib" description="copy and zip all files for the chrome app">
<!-- hosted app -->
<delete dir="${chrome_app}" />
<mkdir dir="${chrome_app}" />
<copy file="app/chrome/manifest.json" todir="${chrome_app}" />
<copy file="${web_app_src}/img/icon_16.png" todir="${chrome_app}" />
<copy file="${web_app_src}/img/icon_128.png" todir="${chrome_app}" />
<zip destfile="build/app/chrome.zip">
<fileset dir="${chrome_app}" />
</zip>
<delete dir="${chrome_app}" />
</target>
<target name="main" depends="build_lib, build_web_app, build_chrome_app" />
</project>