cuba/build.xml
2011-04-14 15:05:28 +00:00

294 lines
15 KiB
XML

<?xml version="1.0"?>
<project xmlns:ext="http://haulmont.com/schema/ant" xmlns:jmx="antlib:org.apache.catalina.ant.jmx"
name="cuba" basedir=".">
<property name="root.dir" location=".."/>
<property file="${root.dir}/build-script/local.build.properties"/>
<property file="${root.dir}/build-script/build.properties"/>
<property file="build.properties"/>
<import file="${root.dir}/build-script/build-inc-prj.xml"/>
<property file="lib.properties"/>
<property name="bali.build.dir" location="${root.dir}/bali/build"/>
<property name="chile.build.dir" location="${root.dir}/chile/build"/>
<property name="build.dir" location="build"/>
<property name="target.dir" location="target"/>
<property name="deploy.dir" location="${root.dir}/tomcat"/>
<property name="app.name" value="cuba"/>
<property name="coreapp.name" value="cuba-core"/>
<target name="delegate">
<property name="target" value="noop" />
<ant dir="modules/shared-lib" target="${target}" inheritAll="false"/>
<ant dir="modules/global" target="${target}" inheritAll="false"/>
<ant dir="modules/core" target="${target}" inheritAll="false"/>
<ant dir="modules/core-war" target="${target}" inheritAll="false"/>
<ant dir="modules/client" target="${target}" inheritAll="false"/>
<ant dir="modules/gui" target="${target}" inheritAll="false"/>
<ant dir="modules/web-war" target="${target}" inheritAll="false"/>
<ant dir="modules/web" target="${target}" inheritAll="false"/>
<!--<ant dir="modules/admin-console-war" target="${target}" inheritAll="false"/>-->
</target>
<target name="clean">
<delete dir="target"/>
<delete dir="build"/>
<delete dir="out"/>
</target>
<target name="install-lib">
<!-- tomcat -->
<ext:install-tomcat version="${tomcat.version}" toDir="${tomcat.dir}"/>
<!-- common libs -->
<ext:install-lib groupId="antlr" artifactId="antlr" version="${antlr.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.antlr" artifactId="antlr-runtime" version="${antlr-runtime.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="asm" artifactId="asm" version="${asm.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="commons-codec" artifactId="commons-codec" version="${commons-codec.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="commons-pool" artifactId="commons-pool" version="${commons-pool.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="commons-cli" artifactId="commons-cli" version="${commons-cli.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.freemarker" artifactId="freemarker" version="${freemarker.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.perf4j" artifactId="perf4j" version="${perf4j.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="openjpa" version="${openjpa.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="net.sourceforge.serp" artifactId="serp" version="${serp.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="com.google.guava" artifactId="guava" version="${guava.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="aopalliance" artifactId="aopalliance" version="${aopalliance.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.aspectj" artifactId="aspectjrt" version="${aspectjrt.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.aspectj" artifactId="aspectjweaver" version="${aspectjweaver.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-beans" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-context" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-aop" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-asm" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-expression" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-web" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-tx" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="xerces" artifactId="xercesImpl" version="${xercesImpl.version}" toDir="${lib.common.dir}"/>
<!--<ext:install-lib name="jaxen" version="${jaxen.version}" toDir="${lib.common.dir}"/>-->
<!-- server libs -->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="vaadin" version="${vaadin.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="jcifs" version="${jcifs.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="jespa" version="${jespa.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="dashlayout" version="${dashlayout.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="popupbutton" version="${popupbutton.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="commons-fileupload" artifactId="commons-fileupload" version="${commons-fileupload.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-jdbc" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-orm" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-context-support" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.apache.commons" artifactId="commons-compress" version="${commons-compress.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="jgroups" artifactId="jgroups" version="${jgroups.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.apache.tomcat" artifactId="servlet-api" version="${servlet-api.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="jfree" artifactId="jcommon" version="${jcommon.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="jfree" artifactId="jfreechart" version="${jfreechart.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-webmvc" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.mybatis" artifactId="mybatis" version="${mybatis.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.mybatis" artifactId="mybatis-spring" version="${mybatis-spring.version}" toDir="${lib.server.dir}"/>
<!-- CAS -->
<ext:install-lib groupId="org.jasig.cas" artifactId="cas-client-core" version="${cas.version}" toDir="${lib.server.dir}"/>
<!-- gwt libs -->
<ext:install-lib groupId="com.google.gwt" artifactId="gwt-user" version="${gwt-user.version}" toDir="${lib.gwt.dir}"/>
<ext:install-lib groupId="com.google.gwt" artifactId="gwt-dev" version="${gwt-dev.version}" toDir="${lib.gwt.dir}"/>
<!-- jdbc -->
<ext:install-lib groupId="hsqldb" artifactId="hsqldb" version="${hsqldb.version}" toDir="${lib.jdbc.dir}"/>
<ext:install-lib groupId="postgresql" artifactId="postgresql" version="${postgresql.version}" toDir="${lib.jdbc.dir}"/>
<!-- reporting -->
<ext:install-lib groupId="jasperreports" artifactId="jasperreports" version="${jasperreports.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="commons-digester" artifactId="commons-digester" version="${commons-digester.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="commons-beanutils" artifactId="commons-beanutils" version="${commons-beanutils.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.apache.poi" artifactId="poi" version="${poi.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="com.lowagie" artifactId="itext" version="${itext.version}" toDir="${lib.common.dir}"/>
<!--Open Office-->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="ooo-bootstrapconnector" version="${openoffice.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.openoffice" artifactId="unoil" version="${openoffice.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.openoffice" artifactId="jurt" version="${openoffice.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.openoffice" artifactId="juh" version="${openoffice.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.openoffice" artifactId="ridl" version="${openoffice.version}" toDir="${lib.server.dir}"/>
<!--XStream-->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="xstream" version="${xstream.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="xpp3" artifactId="xpp3_min" version="${xpp3.version}" toDir="${lib.server.dir}"/>
<!-- Desktop libs -->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="miglayout" version="${miglayout.version}" toDir="${lib.desktop.dir}"/>
</target>
<target name="compile">
<antcall target="delegate" inheritAll="false">
<param name="target" value="compile-module"/>
</antcall>
</target>
<target name="init-release-number">
<tstamp>
<format property="release.timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<echo message="${release.number}" file="modules/global/src/com/haulmont/cuba/core/global/release.number"/>
<echo message="${release.timestamp}" file="modules/global/src/com/haulmont/cuba/core/global/release.timestamp"/>
</target>
<target name="build" depends="init-release-number">
<antcall target="delegate" inheritAll="false">
<param name="target" value="build-module"/>
</antcall>
<ant dir="modules/web-war" target="build-module-gwt" inheritAll="false"/>
</target>
<target name="target" depends="build">
<!-- core-war -->
<property name="coreapp.dir" value="${target.dir}/webapps/${coreapp.name}"/>
<mkdir dir="${coreapp.dir}"/>
<copy todir="${coreapp.dir}">
<fileset dir="${build.dir}/core-war" includes="**/*"/>
</copy>
<copy todir="${coreapp.dir}/WEB-INF/lib">
<fileset dir="${bali.build.dir}" includes="*.jar"/>
<fileset dir="${chile.build.dir}" includes="*.jar"/>
<fileset dir="${build.dir}">
<include name="cuba-global.jar"/>
<include name="cuba-core.jar"/>
</fileset>
</copy>
<!-- core-conf -->
<mkdir dir="${target.dir}/conf/${coreapp.name}"/>
<copy todir="${target.dir}/conf/${coreapp.name}">
<fileset dir="${build.dir}/core-conf" includes="**/*"/>
</copy>
<!-- web-war -->
<property name="webapp.dir" value="${target.dir}/webapps/${app.name}"/>
<mkdir dir="${webapp.dir}"/>
<copy todir="${webapp.dir}">
<fileset dir="${build.dir}/web-war" includes="**/*"/>
</copy>
<copy todir="${webapp.dir}/WEB-INF/lib">
<fileset dir="${bali.build.dir}" includes="*.jar"/>
<fileset dir="${chile.build.dir}" includes="*.jar"/>
<fileset dir="${build.dir}">
<include name="cuba-global.jar"/>
<include name="cuba-client.jar"/>
<include name="cuba-gui.jar"/>
<include name="cuba-web.jar"/>
</fileset>
</copy>
<!-- web-conf -->
<mkdir dir="${target.dir}/conf/${app.name}"/>
<copy todir="${target.dir}/conf/${app.name}">
<fileset dir="${build.dir}/web-conf" includes="**/*"/>
</copy>
<!-- shared-lib -->
<mkdir dir="${target.dir}/shared/lib"/>
<copy todir="${target.dir}/shared/lib">
<fileset dir="${build.dir}" includes="cuba-shared-lib.jar"/>
</copy>
<!-- fonts -->
<mkdir dir="${target.dir}/shared/fonts"/>
<copy todir="${target.dir}/shared/fonts">
<fileset dir="${build.dir}/core-conf/cuba/fonts" includes="**/*"/>
</copy>
</target>
<target name="deploy" depends="target">
<copy todir="${tomcat.dir}">
<fileset dir="etc/tomcat" includes="**/*"/>
</copy>
<copy todir="${deploy.dir}">
<fileset dir="${target.dir}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${deploy.dir}/shared/lib"/>
<copy todir="${deploy.dir}/shared/lib">
<fileset dir="${lib.common.dir}">
<include name="*.jar"/>
<!--<exclude name="log4j.jar"/>-->
</fileset>
<fileset dir="${lib.server.dir}">
<include name="*.jar"/>
<exclude name="servlet-api.jar"/>
</fileset>
</copy>
<copy todir="${deploy.dir}/lib">
<fileset dir="${lib.jdbc.dir}">
<include name="hsqldb.jar"/>
</fileset>
</copy>
</target>
<target name="clear-caches" if="do.clear.caches">
<jmx:open host="localhost" port="7777" username="" password=""/>
<jmx:invoke name="app.cuba:service=CachingFacade" operation="clearMessagesCache"/>
<jmx:invoke name="app.cuba:service=CachingFacade" operation="clearGroovyCache"/>
</target>
<target name="undeploy">
<delete dir="${deploy.dir}/${app.name}"/>
</target>
<target name="start">
<exec dir="${root.dir}/tomcat/bin" executable="cmd.exe" spawn="true">
<env key="NOPAUSE" value="true"/>
<arg line="/c start callAndExit.bat debug.bat"/>
</exec>
</target>
<target name="stop">
<exec dir="${root.dir}/tomcat/bin" executable="cmd.exe">
<env key="NOPAUSE" value="true"/>
<arg line="/c start callAndExit.bat shutdown.bat"/>
</exec>
</target>
<target name="restart">
<parallel>
<antcall target="stop"/>
<antcall target="deploy"/>
</parallel>
<waitfor maxwait="6" maxwaitunit="second" checkevery="2" checkeveryunit="second">
<not>
<socket server="localhost" port="8787"/>
</not>
</waitfor>
<antcall target="start"/>
</target>
<target name="clean-build" depends="clean,build"/>
</project>