drawio/etc/build/build.xml
2019-04-24 21:21:40 +01:00

424 lines
15 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>
<java fork="false" classname="Xml2Js" classpath=".">
<arg value="../../src/main/webapp/stencils"/>
<arg value="../../src/main/webapp/js/stencils.min.js"/>
</java>
<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['default-style2'] = 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}/.tmp1.js"/>
<copy file="${war.dir}/styles/dark-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"/>
<echo file="${basedir}/Graph-Stylesheet.js" append="true">Graph.prototype.defaultThemes['darkTheme'] = 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="Format.js" />
<file name="Shapes.js" />
<file name="Actions.js" />
<file name="Menus.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-AlliedTelesis.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-AWS4.js" />
<file name="Sidebar-AWS4b.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-CiscoSafe.js" />
<file name="Sidebar-Citrix.js" />
<file name="Sidebar-Cumulus.js" />
<file name="Sidebar-DFD.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-GCP2.js" />
<file name="Sidebar-Gmdl.js" />
<file name="Sidebar-IBM.js" />
<file name="Sidebar-Infographic.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-Sitemap.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" />
<file name="Minimal.js" />
<file name="DrawioComment.js" />
<file name="DrawioUser.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="${war.dir}/js/extensions.min.js"/>
<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="RemoteFile.js" />
<file name="RemoteLibrary.js" />
<file name="UrlLibrary.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="DiffSync.js" />
<file name="Settings.js" />
<file name="DrawioFileSync.js" />
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
<file name="Minimal.js" />
<file name="DistanceGuides.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/cryptojs" files="aes.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>
<sources dir="${war.dir}/js/diagramly/vsdx">
<file name="VsdxExport.js" />
<file name="mxVsdxCanvas2D.js" />
<file name="bmpDecoder.js" />
<file name="importer.js" />
</sources>
<sources dir="${war.dir}/js/diagramly/graphml">
<file name="mxGraphMlCodec.js" />
</sources>
</jscomp>
<concat destfile="${war.dir}/js/extensions.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="RemoteFile.js" />
<file name="RemoteLibrary.js" />
<file name="UrlLibrary.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="DiffSync.js" />
<file name="Settings.js" />
<file name="DrawioFileSync.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="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="DrawioComment.js" />
<file name="DriveComment.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
<file name="Minimal.js" />
<file name="DistanceGuides.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/cryptojs" files="aes.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" />
</path>
<target name="javac" depends="app" description="Java compilation">
<mkdir dir="${javac.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" excludes="**/EmbedServlet2.java" destdir="${javac.dir}">
<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>
<delete file="${basedir}/base.min.js"/>
<delete file="${basedir}/base-viewer.min.js"/>
</target>
<target name="war" depends="javac" description="Create the stand-alone war file">
<zip destfile="${build.dir}/${war.name}" basedir="${war.dir}" >
</zip>
</target>
</project>