blob: 326a8c04cf625c0a964c834f9368eca17001d11f [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="camel common build file" default="build.classes">
<property environment="env"/>
<property name="build.dir" location="${basedir}/target"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="build.test.classes.dir" location="${build.dir}/test-classes"/>
<property name="cameldoc.dir" location="${build.dir}/site/cameldoc"/>
<property name="build.src.dir" location="${basedir}/src/main/java"/>
<property name="build.test.dir" location="${basedir}/src/test/java"/>
<property name="build.resources.dir" location="${basedir}/src/main/resources"/>
<property name="camel.lib" location="../../lib"/>
<property name="activemq.home" value="${env.ACTIVEMQ_HOME}"/>
<property name="hibernate.core.home" value="${env.HIBERNATE_CORE_HOME}"/>
<property name="hibernate.entitymanager.home" value="${env.HIBERNATE_EM_HOME}"/>
<property name="hsqldb.home" value="${env.HSQLDB_HOME}"/>
<property name="aspectj.home" value="${env.ASPECTJ_HOME}"/>
<property name="spring.home" value="${env.SPRING_HOME}"/>
<property name="guice.home" value="${env.GUICE_HOME}"/>
<condition property="build.src">
<available file="${build.src.dir}"/>
</condition>
<condition property="build.test">
<and>
<available file="${build.test.dir}"/>
<available classname="junit.framework.TestCase"/>
</and>
</condition>
<mkdir dir="${build.dir}"/>
<!-- Define some classpaths used by the different samples. -->
<path id="activemq.classpath">
<fileset dir="${activemq.home}/lib">
<include name="**/geronimo-j2ee-management_*_spec-*.jar"/>
<include name="**/geronimo-jms_*_spec-*.jar"/>
<include name="**/activemq-core-*.jar"/>
<include name="**/activemq-camel-*.jar"/>
<include name="**/backport-util-concurrent-*.jar"/>
<include name="**/optional/spring-tx-*.jar"/>
<include name="**/optional/spring-jms-*.jar"/>
<include name="**/optional/activemq-pool-*.jar"/>
<include name="**/optional/commons-pool-*.jar"/>
<include name="**/optional/xbean-*.jar"/>
</fileset>
</path>
<path id="hibernate.classpath">
<fileset dir="${hibernate.core.home}">
<include name="**/hibernate*.jar"/>
<include name="**/antlr-*.jar"/>
<include name="**/asm*.jar"/>
<include name="**/cglib-*.jar"/>
<include name="**/dom4j-*.jar"/>
<include name="**/javassist*.jar"/>
<include name="**/jta.jar"/>
</fileset>
<fileset dir="${hibernate.entitymanager.home}">
<include name="**/hibernate-*.jar"/>
<include name="**/jboss-archive-browsing*.jar"/>
<include name="**/*persistence.jar"/>
</fileset>
<fileset dir="${hsqldb.home}">
<include name="**/hsqldb.jar"/>
</fileset>
</path>
<path id="aspectj.classpath">
<fileset dir="${aspectj.home}/lib">
<include name="**/aspectj*.jar"/>
</fileset>
</path>
<path id="spring.classpath">
<fileset dir="${spring.home}/dist">
<include name="spring.jar"/>
</fileset>
</path>
<path id="guice.classpath">
<fileset dir="${guice.home}/lib">
<include name="guice*.jar"/>
</fileset>
</path>
<path id="log4j.classpath">
<fileset dir="${camel.lib}">
<include name="**/log4j-*.jar"/>
</fileset>
</path>
<path id="camel.core.classpath">
<fileset dir="${camel.lib}">
<include name="**/camel-core-*.jar"/>
<include name="**/commons-logging-*.jar"/>
<include name="**/commons-management-*.jar"/>
<include name="**/jaxb-api-*.jar"/>
<include name="**/spring-*.jar"/>
<exclude name="**/*-tests.jar"/>
</fileset>
</path>
<path id="camel.spring.classpath">
<path refid="camel.core.classpath"/>
<fileset dir="${camel.lib}">
<include name="**/camel-spring-*.jar"/>
<exclude name="**/camel-spring-osgi*.jar"/>
<exclude name="**/camel-spring-integration*.jar"/>
<include name="**/activation-*.jar"/>
<include name="**/jaxb-impl-*.jar"/>
<include name="**/stax-api-*.jar"/>
<exclude name="**/*-tests.jar"/>
</fileset>
</path>
<target name="build.classes" if="build.src">
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}" debug="true">
<src path="${build.src.dir}"/>
<src path="${build.dir}"/>
<classpath>
<path refid="sample.build.classpath"/>
</classpath>
</javac>
<copy todir="${build.classes.dir}">
<fileset dir="${build.resources.dir}" includes="**/*"/>
</copy>
</target>
<target name="build.test" if="build.test">
<mkdir dir="${build.test.classes.dir}"/>
<javac destdir="${build.test.classes.dir}" debug="true">
<src path="${build.test.dir}"/>
<classpath>
<path refid="sample.build.classpath"/>
</classpath>
</javac>
</target>
<target name="build" depends="build.classes,build.test"/>
<macrodef name="camelrun">
<attribute name="mainClass" default="org.apache.camel.spring.Main"/>
<element name="arguments" optional="true"/>
<sequential>
<path id="sample.run.classpath">
<pathelement location="${build.classes.dir}"/>
<path refid="sample.build.classpath"/>
<path refid="log4j.classpath"/>
</path>
<!--
<property name="sampleclasspath" refid="sample.run.classpath"/>
<echo message="running with classpath: ${sampleclasspath}"/>
-->
<java classname="@{mainClass}"
fork="true"
failonerror="true">
<classpath refid="sample.run.classpath"/>
<arguments/>
<sysproperty key="java.util.logging.config.file" value="${build.classes.dir}/logging.properties"/>
</java>
<condition property="has.cameldoc">
<available file="${cameldoc.dir}"/>
</condition>
</sequential>
</macrodef>
<condition property="shell.suffix" value=".exe">
<os family="windows"/>
</condition>
<property name="shell.suffix" value=""/>
<!-- This macro assumes the dot executable is on your path. -->
<macrodef name="cameldot">
<attribute name="dotFileDir" default="${cameldoc.dir}"/>
<attribute name="outputType" default="svg"/>
<sequential>
<apply executable="dot${shell.suffix}">
<arg value="-T@{outputType}"/>
<arg value="-O"/>
<fileset dir="@{dotFileDir}">
<patternset>
<include name="**/*.dot"/>
</patternset>
</fileset>
</apply>
</sequential>
</macrodef>
<target name="camel.dot" depends="run" if="has.cameldoc"
description="Output visualization">
<cameldot outputType="svg"/>
<!--
<cameldot outputType="cmapx"/>
-->
</target>
<target name="clean">
<delete dir="${build.test.classes.dir}"/>
<delete dir="${build.classes.dir}"/>
<delete dir="${build.dir}"/>
</target>
</project>