2012-08-17 04:25:18 +08:00
|
|
|
<!-- ant build script for jsoneditoronline -->
|
|
|
|
|
|
|
|
<project name="jsoneditor-builder" default="main">
|
|
|
|
<!-- the version number of must be updated here (according to changelog.txt) -->
|
2012-12-20 02:22:09 +08:00
|
|
|
<property name="version" value="2.0.0"/>
|
2012-08-17 04:25:18 +08:00
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<!-- compression tools -->
|
2012-08-17 04:25:18 +08:00
|
|
|
<property name="compressor" value="tools/yuicompressor-2.4.7.jar" />
|
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<!-- directories -->
|
2013-01-02 03:54:07 +08:00
|
|
|
<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" />
|
2013-01-06 05:19:10 +08:00
|
|
|
<property name="jsoneditor" location="${lib}/jsoneditor-${version}" />
|
|
|
|
<property name="jsoneditor_min" location="${lib}/jsoneditor-${version}.min" />
|
2012-11-03 16:42:59 +08:00
|
|
|
|
|
|
|
<target name="build_lib" description="build jsoneditor library">
|
|
|
|
<delete dir="${jsoneditor}" />
|
|
|
|
<delete dir="${jsoneditor_min}" />
|
|
|
|
|
|
|
|
<!-- copy all files for the non-minified jsoneditor -->
|
2013-01-02 03:54:07 +08:00
|
|
|
<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" />
|
2012-11-03 16:42:59 +08:00
|
|
|
|
|
|
|
<!-- copy all files for the minified jsoneditor -->
|
2013-01-02 03:54:07 +08:00
|
|
|
<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>
|
2013-01-06 05:19:10 +08:00
|
|
|
<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">
|
2013-01-02 03:54:07 +08:00
|
|
|
<include name="**/*.html"/>
|
|
|
|
</replace>
|
2013-01-06 05:19:10 +08:00
|
|
|
<replace dir="${jsoneditor_min}/examples"
|
|
|
|
token="jsoneditor.css"
|
|
|
|
value="jsoneditor-min.css">
|
2013-01-02 03:54:07 +08:00
|
|
|
<include name="**/*.html"/>
|
|
|
|
</replace>
|
2013-01-06 05:19:10 +08:00
|
|
|
<replace file="${jsoneditor_min}/examples/requirejs_demo/scripts/main.js"
|
|
|
|
token="../../../jsoneditor"
|
|
|
|
value="../../../jsoneditor-min" />
|
2013-01-02 03:54:07 +08:00
|
|
|
|
2013-01-06 05:19:10 +08:00
|
|
|
<!-- concatenate the javascript files -->
|
|
|
|
<concat destfile="${jsoneditor}/tmp.js">
|
2013-01-02 03:54:07 +08:00
|
|
|
<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>
|
2013-01-06 05:19:10 +08:00
|
|
|
<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="/***jsoneditor***/"
|
|
|
|
value="${tmp}" />
|
|
|
|
|
|
|
|
<!-- concatenate the css files -->
|
2013-01-02 03:54:07 +08:00
|
|
|
<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>
|
2012-11-03 16:42:59 +08:00
|
|
|
|
|
|
|
<!-- minify the jsoneditor files -->
|
2013-01-02 03:54:07 +08:00
|
|
|
<java jar="${compressor}" dir="${jsoneditor}/" fork="true" failonerror="true">
|
2012-08-17 04:25:18 +08:00
|
|
|
<arg value="-o"/>
|
2013-01-02 03:54:07 +08:00
|
|
|
<arg value="${jsoneditor_min}/jsoneditor-min.js"/>
|
2012-08-17 04:25:18 +08:00
|
|
|
<arg value="jsoneditor.js"/>
|
|
|
|
</java>
|
2013-01-02 03:54:07 +08:00
|
|
|
<java jar="${compressor}" dir="${jsoneditor}" fork="true" failonerror="true">
|
2012-08-17 04:25:18 +08:00
|
|
|
<arg value="-o"/>
|
2013-01-02 03:54:07 +08:00
|
|
|
<arg value="${jsoneditor_min}/jsoneditor-min.css"/>
|
2012-08-17 04:25:18 +08:00
|
|
|
<arg value="jsoneditor.css"/>
|
|
|
|
</java>
|
|
|
|
|
|
|
|
<!-- create a zip file with non-minified jsoneditor -->
|
2013-01-06 05:19:10 +08:00
|
|
|
<zip destfile="${lib}/jsoneditor-${version}.zip">
|
|
|
|
<fileset dir="${lib}" includes="jsoneditor-${version}/**" />
|
2012-08-17 04:25:18 +08:00
|
|
|
</zip>
|
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<!-- create a zip file with minified jsoneditor -->
|
2013-01-06 05:19:10 +08:00
|
|
|
<zip destfile="${lib}/jsoneditor-${version}.min.zip">
|
|
|
|
<fileset dir="${lib}" includes="jsoneditor-${version}.min/**" />
|
2012-08-17 04:25:18 +08:00
|
|
|
</zip>
|
|
|
|
</target>
|
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<target name="build_web_app" depends="build_lib" description="copy all files for the web application to the build directory">
|
2012-11-01 05:16:07 +08:00
|
|
|
<delete dir="${web_app}" />
|
|
|
|
<mkdir dir="${web_app}" />
|
|
|
|
|
|
|
|
<!-- concatenate the javascript and css app files -->
|
|
|
|
<concat destfile="${web_app}/app.js">
|
2012-11-03 22:20:15 +08:00
|
|
|
<fileset dir="${web_app_src}" includes="queryparams.js"/>
|
2012-11-01 05:16:07 +08:00
|
|
|
<fileset dir="${web_app_src}" includes="ajax.js"/>
|
|
|
|
<fileset dir="${web_app_src}" includes="fileretriever.js"/>
|
2012-11-03 21:35:01 +08:00
|
|
|
<fileset dir="${web_app_src}" includes="notify.js"/>
|
2012-11-01 05:16:07 +08:00
|
|
|
<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}/img/logo.png" todir="${web_app}/img" />
|
|
|
|
<copy file="${web_app_src}/img/header_background.png" todir="${web_app}/img" />
|
|
|
|
|
|
|
|
<copy file="${web_app_src}/lib/jsonlint/jsonlint.js" todir="${web_app}/lib/jsonlint" />
|
2013-01-02 03:54:07 +08:00
|
|
|
<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" />
|
2012-11-01 05:16:07 +08:00
|
|
|
|
|
|
|
<!-- 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" />
|
2012-08-17 04:25:18 +08:00
|
|
|
</target>
|
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<target name="build_chrome_app" depends="build_lib" description="copy and zip all files for the chrome app">
|
2012-10-20 05:32:24 +08:00
|
|
|
<!-- hosted app -->
|
2012-08-24 02:29:47 +08:00
|
|
|
<delete dir="${chrome_app}" />
|
|
|
|
<mkdir dir="${chrome_app}" />
|
2012-10-09 03:51:35 +08:00
|
|
|
<copy file="app/chrome/manifest.json" todir="${chrome_app}" />
|
2012-11-01 05:16:07 +08:00
|
|
|
<copy file="${web_app_src}/img/icon_16.png" todir="${chrome_app}" />
|
|
|
|
<copy file="${web_app_src}/img/icon_128.png" todir="${chrome_app}" />
|
2012-08-24 02:29:47 +08:00
|
|
|
|
2012-11-01 05:16:07 +08:00
|
|
|
<zip destfile="build/app/chrome.zip">
|
2012-08-25 18:17:12 +08:00
|
|
|
<fileset dir="${chrome_app}" />
|
|
|
|
</zip>
|
2012-11-01 05:16:07 +08:00
|
|
|
|
|
|
|
<delete dir="${chrome_app}" />
|
2012-08-25 18:17:12 +08:00
|
|
|
</target>
|
|
|
|
|
2012-11-03 16:42:59 +08:00
|
|
|
<target name="main" depends="build_lib, build_web_app, build_chrome_app" />
|
2012-08-17 04:25:18 +08:00
|
|
|
|
|
|
|
</project>
|