drawio/etc/build/build.xml
2016-09-13 15:26:01 +01:00

191 lines
6.6 KiB
XML

<?xml version="1.0"?>
<project basedir="." default="all">
<import file="${basedir}/build-github.xml"/>
<property file="build.properties.local" />
<property file="build.properties" />
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${jscompiler}" />
<target name="reader" depends="atlas">
<delete file=".tmp0.js"/>
<echo file=".tmp0.js">
var mxBasePath = 'https://www.draw.io/mxgraph/';
var mxLoadStylesheets = mxLoadResources = false;
var mxLanguage = 'en';
</echo>
<delete file=".tmp1.js"/>
<java fork="false" classname="Preprocessor" classpath="${mxgraph2.dir}/etc/build">
<arg value="${mxgraph2.dir}/javascript/src/js/mxClient.js"/>
<arg value=".tmp1.js"/>
<arg value="reader_excludes"/>
</java>
<loadfile property="version" srcFile="${mxgraph2.dir}/VERSION"/>
<replace file=".tmp1.js" token="@MXGRAPH-VERSION@" value="${version}"/>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${war.dir}/js/reader.min.js">
<sources dir="${war.dir}/js/sanitizer">
<file name="sanitizer.min.js" />
</sources>
<sources dir="${war.dir}/js/deflate">
<file name="base64.js"/>
<file name="pako.min.js"/>
</sources>
<sources dir="${war.dir}/js/json">
<file name="json2.min.js"/>
</sources>
<sources dir=".">
<file name=".tmp0.js"/>
</sources>
<sources dir="${grapheditor.dir}">
<file name="Init.js" />
</sources>
<sources dir=".">
<file name=".tmp1.js"/>
</sources>
<sources dir="${grapheditor.dir}">
<file name="Graph.js" />
<file name="Shapes.js"/>
</sources>
</jscomp>
<delete file=".tmp0.js"/>
<delete file=".tmp1.js"/>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${war.dir}/js/embed.min.js">
<sources dir="${war.dir}/js/diagramly">
<file name="Embed.js"/>
</sources>
</jscomp>
<concat destfile="${war.dir}/js/embed-static.min.js" fixlastline="yes" append="no">
<file name="${war.dir}/js/reader.min.js" />
<file name="${war.dir}/js/embed.min.js" />
</concat>
<replaceregexp file="${war.dir}/js/embed-static.min.js" match="}\)\(\);$" replace=""/>
<echo file="${war.dir}/js/embed-static.min.js" append="true">})('</echo>
<copy file="${war.dir}/styles/default.xml" tofile=".tmp0.xml" overwrite="true"/>
<replaceregexp file=".tmp0.xml" match="\n" flags="g" replace=""/>
<replaceregexp file=".tmp0.xml" match="\t" flags="g" replace=""/>
<replaceregexp file=".tmp0.xml" match="'" replace="\\\\'" byline="true"/>
<concat destfile="${war.dir}/js/embed-static.min.js" fixlastline="no" append="yes">
<file name=".tmp0.xml" />
</concat>
<delete file=".tmp0.xml"/>
<echo file="${war.dir}/js/embed-static.min.js" append="true">');</echo>
<copy file="${war.dir}/js/diagramly/Embed.js" tofile="${war.dir}/js/embed.dev.js" overwrite="true"/>
<replaceregexp file="${war.dir}/js/embed.dev.js" match="}\)\(\);$" replace=""/>
<replaceregexp file="${war.dir}/js/embed.min.js" match="}\)\(\);$" replace=""/>
</target>
<target name="clean-desktop" depends="atlas">
<delete dir="${desktop.dir}/js" />
<delete dir="${desktop.dir}/images" />
<delete dir="${desktop.dir}/img" />
<delete dir="${desktop.dir}/mxgraph" />
<delete dir="${desktop.dir}/resources" />
<delete dir="${desktop.dir}/styles" />
</target>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="desktop-init.min.js">
<sources dir="${desktop.dir}">
<file name="Desktop-Init.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="desktop-start.min.js">
<sources dir="${desktop.dir}">
<file name="Desktop-Start.js" />
</sources>
</jscomp>
<target name="build-desktop" depends="clean-desktop">
<concat destfile="${desktop.dir}/js/desktop.min.js" fixlastline="yes" append="no">
<file name="desktop-init.min.js" />
<file name="${war.dir}/js/app.min.js" />
<file name="${war.dir}/js/extensions.min.js" />
<file name="${war.dir}/js/shapes.min.js" />
<file name="desktop-start.min.js" />
</concat>
<delete file="desktop-init.min.js"/>
<delete file="desktop-start.min.js"/>
<copy todir="${desktop.dir}/js">
<fileset file="${war.dir}/stencils.xml"></fileset>
</copy>
<copy todir="${desktop.dir}/js/jscolor">
<fileset dir="${war.dir}/js/jscolor"></fileset>
</copy>
<copy todir="${desktop.dir}/images">
<fileset dir="${war.dir}/images">
<exclude name="ajax-loader.gif"/>
<exclude name="drawlogo*.png"/>
<exclude name="apple-*"/>
<exclude name="android-*"/>
<exclude name="favicon*"/>
<exclude name="mstile-*"/>
<exclude name="glyphicons_facebook.png"/>
<exclude name="glyphicons_blogger.png"/>
<exclude name="glyphicons_google.png"/>
<exclude name="glyphicons_twitter.png"/>
<exclude name="glyphicons_github.png"/>
<exclude name="stop-flat-icon-80.png"/>
<exclude name="1x1.png"/>
<exclude name="2x2.png"/>
<exclude name="3x3.png"/>
<exclude name="images/log.png"/>
<exclude name="logo-confluence.png"/>
<exclude name="logo-jira.png"/>
<exclude name="dropbox-logo-*"/>
<exclude name="google-drive-logo-*"/>
<exclude name="onedrive-logo-*"/>
<exclude name="safari-pinned-tab.svg"/>
<exclude name="manifest.json"/>
<exclude name="browserconfig.xml"/>
</fileset>
</copy>
<copy todir="${desktop.dir}/img">
<fileset dir="${war.dir}/img"></fileset>
</copy>
<copy todir="${desktop.dir}/mxgraph">
<fileset dir="${war.dir}/mxgraph"></fileset>
</copy>
<copy todir="${desktop.dir}/resources">
<fileset dir="${war.dir}/resources"></fileset>
</copy>
<copy todir="${desktop.dir}/styles">
<fileset dir="${war.dir}/styles"></fileset>
</copy>
<copy file="${basedir}/desktop-manifest.json" tofile="${desktop.dir}/manifest.json" overwrite="true"/>
<loadfile property="version2" srcFile="${basedir}/../../VERSION"/>
<replace file="${desktop.dir}/manifest.json" token="@DRAWIO-VERSION@" value="${version2}"/>
<zip destfile="${desktop.dir}/../drawio-desktop-${version2}.zip">
<zipfileset dir="${desktop.dir}">
<exclude name="Desktop-Init.js"/>
<exclude name="Desktop-Start.js"/>
</zipfileset>
</zip>
</target>
<target name="atlas" depends="app">
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/atlas.min.js">
<sources dir="${war.dir}/js">
<file name="atlas.min.js" />
</sources>
<sources dir="${war.dir}/connect/common/js">
<file name="mxReader.js" />
</sources>
</jscomp>
</target>
<target name="all" depends="build-desktop,reader">
</target>
</project>