drawio/etc/build/build.xml
2017-10-24 12:54:15 +02:00

390 lines
14 KiB
XML

<?xml version="1.0"?>
<project basedir="." default="all">
<property file="build.properties.local" />
<property file="build.properties" />
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${jscompiler}" />
<target name="merge">
<concat destfile="${basedir}/../../build/shapes.js" fixlastline="yes" append="no">
<fileset dir="${war.dir}/shapes" includes="**/*.js"/>
<fileset dir="${war.dir}/stencils" includes="**/*.js"/>
</concat>
<echo file="${war.dir}/stencils.xml" append="false"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]>${line.separator}</echo>
<echo file="${war.dir}/stencils.xml" append="true"><![CDATA[<stencils>]]>${line.separator}</echo>
<concat destfile="${war.dir}/stencils.xml" fixlastline="yes" append="yes">
<fileset dir="${war.dir}/shapes" includes="**/*.xml"/>
<fileset dir="${war.dir}/stencils" includes="**/*.xml"/>
</concat>
<echo file="${war.dir}/stencils.xml" append="true"><![CDATA[</stencils>]]></echo>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/shapes.min.js">
<sources dir="${basedir}/../../build">
<file name="shapes.js" />
</sources>
</jscomp>
<tstamp>
<format property="time.stamp" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<echo file="${war.dir}/cache.manifest" append="false">CACHE MANIFEST${line.separator}${line.separator}</echo>
<echo file="${war.dir}/cache.manifest" append="true"># THIS FILE WAS GENERATED. DO NOT MODIFY!${line.separator}</echo>
<echo file="${war.dir}/cache.manifest" append="true"># ${time.stamp}${line.separator}${line.separator}</echo>
<concat destfile="${war.dir}/cache.manifest" fixlastline="yes" append="true">
<filelist dir="${basedir}" files="cache.txt"/>
</concat>
<delete dir="${basedir}/../../build"/>
</target>
<target name="app" depends="merge">
<delete file="${basedir}/.tmp0.js"/>
<echo file="${basedir}/.tmp0.js">
window.STENCIL_PATH = window.STENCIL_PATH || 'https://www.draw.io/stencils';
window.SHAPES_PATH = window.SHAPES_PATH || 'https://www.draw.io/shapes';
window.mxBasePath = window.mxBasePath || 'https://www.draw.io/mxgraph/';
window.mxLoadStylesheets = window.mxLoadStylesheets || false;
</echo>
<delete file="${basedir}/.tmp1.js"/>
<copy file="${war.dir}/styles/default.xml" tofile="${basedir}/.tmp1.xml" overwrite="true"/>
<replaceregexp file="${basedir}/.tmp1.xml" match="${line.separator}" flags="g" replace=""/>
<replaceregexp file="${basedir}/.tmp1.xml" match="\t" flags="g" replace=""/>
<replaceregexp file="${basedir}/.tmp1.xml" match="'" flags="g" replace="\\\\'" byline="true"/>
<delete file="${basedir}/Graph-Stylesheet.js"/>
<echo file="${basedir}/Graph-Stylesheet.js">Graph.prototype.defaultThemes[Graph.prototype.defaultThemeName] = mxUtils.parseXml('</echo>
<concat destfile="${basedir}/Graph-Stylesheet.js" fixlastline="no" append="true">
<filelist dir="${basedir}" files=".tmp1.xml"/>
</concat>
<echo file="${basedir}/Graph-Stylesheet.js" append="true">').documentElement;</echo>
<delete file="${basedir}/.tmp2.js"/>
<copy file="${war.dir}/resources/dia.txt" tofile="${basedir}/.tmp2.xml" overwrite="true"/>
<replaceregexp file="${basedir}/.tmp2.xml" match="${line.separator}" flags="g" replace="\\\\n"/>
<replaceregexp file="${basedir}/.tmp2.xml" match="'" flags="g" replace="\\\\'" byline="true"/>
<delete file="${basedir}/Graph-Resources.js"/>
<echo file="${basedir}/Graph-Resources.js">mxResources.parse('</echo>
<concat destfile="${basedir}/Graph-Resources.js" fixlastline="no" append="true">
<filelist dir="${basedir}" files=".tmp2.xml"/>
</concat>
<echo file="${basedir}/Graph-Resources.js" append="true">');</echo>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/grapheditor.min.js">
<sources dir="${grapheditor.dir}">
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Sidebar.js" />
<file name="Graph.js" />
<file name="Shapes.js" />
<file name="Actions.js" />
<file name="Menus.js" />
<file name="Format.js" />
<file name="Toolbar.js" />
<file name="Dialogs.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/sidebar.min.js">
<sources dir="${war.dir}/js/diagramly/sidebar">
<file name="Sidebar.js" />
<file name="Sidebar-Advanced.js" />
<file name="Sidebar-Android.js" />
<file name="Sidebar-ArchiMate.js" />
<file name="Sidebar-ArchiMate3.js" />
<file name="Sidebar-Arrows2.js" />
<file name="Sidebar-Atlassian.js" />
<file name="Sidebar-AWS.js" />
<file name="Sidebar-AWS3.js" />
<file name="Sidebar-AWS3D.js" />
<file name="Sidebar-Azure.js" />
<file name="Sidebar-Basic.js" />
<file name="Sidebar-Bootstrap.js" />
<file name="Sidebar-BPMN.js" />
<file name="Sidebar-Cabinet.js" />
<file name="Sidebar-Citrix.js" />
<file name="Sidebar-EIP.js" />
<file name="Sidebar-Electrical.js" />
<file name="Sidebar-ER.js" />
<file name="Sidebar-Floorplan.js" />
<file name="Sidebar-Flowchart.js" />
<file name="Sidebar-GCP.js" />
<file name="Sidebar-Gmdl.js" />
<file name="Sidebar-IBM.js" />
<file name="Sidebar-Ios.js" />
<file name="Sidebar-Ios7.js" />
<file name="Sidebar-LeanMapping.js" />
<file name="Sidebar-Mockup.js" />
<file name="Sidebar-MSCAE.js" />
<file name="Sidebar-Network.js" />
<file name="Sidebar-Office.js" />
<file name="Sidebar-PID.js" />
<file name="Sidebar-Rack.js" />
<file name="Sidebar-Sysml.js" />
<file name="Sidebar-Veeam.js" />
<file name="Sidebar-WebIcons.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/client.min.js">
<sources dir="${war.dir}/js/deflate">
<file name="base64.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="Init.js" />
</sources>
<sources dir="${grapheditor.dir}">
<file name="Init.js" />
</sources>
<sources dir="${basedir}/../mxgraph">
<file name="mxClient.js" />
</sources>
<sources dir="${war.dir}/js/jscolor">
<file name="jscolor.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp0.min.js">
<sources dir="${basedir}">
<file name=".tmp0.js"/>
</sources>
</jscomp>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp1.js">
<sources dir="${grapheditor.dir}">
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Graph.js" />
<file name="Shapes.js" />
<file name="Actions.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Pages.js" />
<file name="Trees.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Resources.js" />
<file name="Graph-Stylesheet.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="GraphViewer.js" />
</sources>
</jscomp>
<concat destfile="${basedir}/base-viewer.min.js" fixlastline="yes" append="no">
<filelist dir="${basedir}" files=".tmp0.min.js"/>
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${basedir}" files="client.min.js,.tmp1.js"/>
</concat>
<echo file="${basedir}/.tmp2.js">
(function()
{
Editor.initMath();
GraphViewer.initCss();
if (window.onDrawioViewerLoad != null)
{
window.onDrawioViewerLoad();
}
else
{
GraphViewer.processElements();
}
})();
</echo>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp2.min.js">
<sources dir="${basedir}">
<file name=".tmp2.js"/>
</sources>
</jscomp>
<concat destfile="${war.dir}/js/viewer.min.js" fixlastline="yes" append="no">
<filelist dir="${basedir}" files="base-viewer.min.js,.tmp2.min.js"/>
</concat>
<delete file="${basedir}/.tmp0.js"/>
<delete file="${basedir}/.tmp0.min.js"/>
<delete file="${basedir}/.tmp1.js"/>
<delete file="${basedir}/.tmp2.js"/>
<delete file="${basedir}/.tmp2.min.js"/>
<delete file="${basedir}/.tmp1.xml"/>
<delete file="${basedir}/.tmp2.xml"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/.tmp1.js">
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="LocalLibrary.js" />
<file name="StorageFile.js" />
<file name="StorageLibrary.js" />
<file name="UrlLibrary.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Settings.js" />
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Stylesheet.js" />
</sources>
</jscomp>
<concat destfile="${basedir}/base.min.js" fixlastline="yes" append="no">
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${basedir}" files="client.min.js,grapheditor.min.js,sidebar.min.js,.tmp1.js"/>
</concat>
<loadfile property="version" srcFile="../../VERSION"/>
<replace file="${basedir}/base.min.js" token="@DRAWIO-VERSION@" value="${version}"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/extensions.min.js">
<sources dir="${war.dir}/js/diagramly">
<file name="Extensions.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/vsdx.min.js">
<sources dir="${war.dir}/js/diagramly/vsdx">
<file name="VsdxExport.js" />
<file name="mxVsdxCanvas2D.js" />
</sources>
</jscomp>
<concat destfile="${war.dir}/js/vsdx.min.js" fixlastline="yes" append="yes">
<fileset dir="${war.dir}/js/jszip" includes="**/*.min.js"/>
</concat>
<delete file="${basedir}/.tmp1.js"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/.tmp1.js">
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="LocalLibrary.js" />
<file name="StorageFile.js" />
<file name="StorageLibrary.js" />
<file name="UrlLibrary.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Settings.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Stylesheet.js" />
</sources>
<sources dir="${war.dir}/js/diagramly/util">
<file name="mxAsyncCanvas.js" />
<file name="mxJsCanvas.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioClient.js" />
<file name="DrawioUser.js" />
<file name="DriveRealtime.js" />
<file name="RealtimeMapping.js" />
<file name="DriveFile.js" />
<file name="DriveLibrary.js" />
<file name="DriveClient.js" />
<file name="DropboxFile.js" />
<file name="DropboxLibrary.js" />
<file name="DropboxClient.js" />
<file name="OneDriveFile.js" />
<file name="OneDriveLibrary.js" />
<file name="OneDriveClient.js" />
<file name="GitHubFile.js" />
<file name="GitHubLibrary.js" />
<file name="GitHubClient.js" />
<file name="TrelloFile.js" />
<file name="TrelloLibrary.js" />
<file name="TrelloClient.js" />
<file name="ChatWindow.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
</sources>
</jscomp>
<concat destfile="${war.dir}/js/app.min.js" fixlastline="yes" append="no">
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${basedir}" files="client.min.js,grapheditor.min.js,sidebar.min.js,.tmp1.js"/>
</concat>
<replace file="${war.dir}/js/app.min.js" token="@DRAWIO-VERSION@" value="${version}"/>
<delete file="${basedir}/Graph-Stylesheet.js"/>
<delete file="${basedir}/Graph-Resources.js"/>
<delete file="${basedir}/grapheditor.min.js"/>
<delete file="${basedir}/sidebar.min.js"/>
<delete file="${basedir}/client.min.js"/>
<delete file="${basedir}/.tmp1.js"/>
</target>
<target name="all" depends="app">
</target>
<!-- ================== Stand-alone war creation ============================= -->
<path id="javac.class.path">
<fileset dir="${war.dir}/WEB-INF/lib" includes="mxgraph-core.jar" />
<fileset dir="${basedir}/jars" includes="servlet-api.jar" />
<fileset dir="${basedir}/jars" includes="commons-codec-1.10.jar" />
<fileset dir="${basedir}/jars" includes="commons-fileupload-1.3.2.jar" />
<fileset dir="${basedir}/jars" includes="gson-2.7.jar" />
<fileset dir="${basedir}/jars" includes="commons-lang3-3.5.jar" />
<fileset dir="${basedir}/jars" includes="gae-stub-1.0.1.jar" />
</path>
<target name="javac" depends="app" description="Java compilation">
<mkdir dir="${javac.dir}"/>
<javac srcdir="${src.dir}" excludes="**/EmbedServlet2.java" encoding="utf-8" destdir="${javac.dir}" source="1.7" target="1.7" debug="true" debuglevel="lines,vars,source">
<classpath refid="javac.class.path" />
</javac>
<copy todir="${javac.dir}" file="${src.dir}/log4j.properties" />
</target>
<target name="clean" description="Cleans build directories">
<delete failonerror="false">
<fileset dir="${javac.dir}">
</fileset>
<fileset dir="${build.dir}">
</fileset>
</delete>
</target>
<target name="war" depends="javac" description="Create the stand-alone war file">
<zip excludes="**/appengine*.jar,**/jsr*.jar,**/junit*.jar" destfile="${build.dir}/${war.name}" basedir="${war.dir}" >
</zip>
</target>
</project>