jsoneditor/build.xml

135 lines
6.4 KiB
XML

<!-- 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="package" value="jsoneditor"/>
<property name="version" value="1.6.0"/>
<!-- compression tools -->
<property name="compressor" value="tools/yuicompressor-2.4.7.jar" />
<!-- directories -->
<property name="root" location="" />
<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="jsoneditor" location="${lib}/${package}-${version}" />
<property name="jsoneditor_min" location="${lib}/${package}-${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="${root}/LICENSE" todir="${jsoneditor}" />
<copy file="${root}/NOTICE" todir="${jsoneditor}" />
<copy file="${root}/README.md" todir="${jsoneditor}" />
<copy file="${root}/changelog.txt" todir="${jsoneditor}" />
<copy file="${root}/demo.html" todir="${jsoneditor}" />
<copy file="${root}/jsoneditor/jsoneditor.js" todir="${jsoneditor}/jsoneditor" />
<copy file="${root}/jsoneditor/jsoneditor.css" todir="${jsoneditor}/jsoneditor" />
<copy file="${root}/jsoneditor/img/jsoneditor-icons.png" todir="${jsoneditor}/jsoneditor/img" />
<!-- copy all files for the minified jsoneditor -->
<copy file="${root}/LICENSE" todir="${jsoneditor_min}" />
<copy file="${root}/NOTICE" todir="${jsoneditor_min}" />
<copy file="${root}/README.md" todir="${jsoneditor_min}" />
<copy file="${root}/changelog.txt" todir="${jsoneditor_min}" />
<copy file="${root}/demo.html" todir="${jsoneditor_min}" />
<copy file="${root}/jsoneditor/img/jsoneditor-icons.png" todir="${jsoneditor_min}/jsoneditor/img" />
<!-- minify the jsoneditor files -->
<java jar="${compressor}" dir="jsoneditor" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${jsoneditor_min}/jsoneditor/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/jsoneditor-min.css"/>
<arg value="jsoneditor.css"/>
</java>
<!-- create a zip file with non-minified jsoneditor -->
<zip destfile="${lib}/${package}-${version}.zip">
<fileset dir="${jsoneditor}" includes="**" />
</zip>
<!-- create a zip file with minified jsoneditor -->
<zip destfile="${lib}/${package}-${version}.min.zip">
<fileset dir="${jsoneditor_min}" includes="**" />
</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="hash.js"/>
<fileset dir="${web_app_src}" includes="ajax.js"/>
<fileset dir="${web_app_src}" includes="fileretriever.js"/>
<fileset dir="${web_app_src}" includes="notifications.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}/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" />
<copy file="${jsoneditor_min}/jsoneditor/jsoneditor-min.js" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/jsoneditor/jsoneditor-min.css" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/jsoneditor/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>