blob: 3895436dc94a456073d50ca4a77e3fe2f016adaf [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="Apache Forrest master" default="compile-all">
<!-- Bundles import this build file -->
<property environment="env" />
<property name="forrest.home" location="${env.FORREST_HOME}" />
<property name="forrest.bin.dir" location="${forrest.home}/bin" />
<property name="forrest.lib.dir" location="${forrest.home}/lib" />
<property name="tools.dir" location="${forrest.home}/tools" />
<property name="ant.dir" location="${tools.dir}/ant" />
<property name="bnd.dir" location="${tools.dir}/bnd" />
<property name="bnd.jar.file" location="${bnd.dir}/lib/bnd-0.0.384.jar" />
<property name="bundle.deploy.dir" location="${forrest.home}/bundle" />
<property name="build.compiler.source" value="1.5" />
<property name="build.compiler.target" value="1.5" />
<!--
Bundle properties
Override in bundle build.xml where necessary
-->
<property name="bundle.vendor" value="The Apache Software Foundation" />
<property name="bundle.name" value="" />
<property name="bundle.symbolic.name" value="" />
<property name="bundle.activator" value="" />
<property name="bundle.version" value="0.10.1.dev" />
<property name="bundle.bnd.file" location="" />
<property name="src.dir" location="src" />
<property name="java.src.dir" location="${src.dir}/java" />
<property name="java.test.src.dir" location="${src.dir}/test" />
<property name="bundle.resource.dir" location="${src.dir}/bundle" />
<property name="build.dir" location="build" />
<property name="build.classes" location="${build.dir}/classes" />
<property name="build.test.classes" location="${build.dir}/test" />
<property name="jar.file" value="${bundle.symbolic.name}.jar" />
<target name="init">
<mkdir dir="${build.classes}" />
<mkdir dir="${build.test.classes}" />
<path id="classpath">
<fileset dir="${forrest.lib.dir}" includes="*.jar" />
<fileset dir="${bundle.deploy.dir}" includes="*.jar" />
</path>
</target>
<target name="compile" depends="init">
<echo>Compiling ${ant.project.name}</echo>
<javac srcdir="${java.src.dir}"
destdir="${build.classes}"
classpathref="classpath"
debug="true"
source="${build.compiler.source}"
target="${build.compiler.target}"
includeantruntime="false">
<compilerarg value="-Xlint" />
</javac>
</target>
<target name="compile-tests" depends="compile">
<echo>Compiling tests for ${ant.project.name}</echo>
<javac srcdir="${java.test.src.dir}"
destdir="${build.test.classes}"
debug="true"
source="${build.compiler.source}"
target="${build.compiler.target}"
includeantruntime="false">
<classpath>
<pathelement location="${forrest.lib.dir}/junit-4.8.1.jar" />
<pathelement location="${build.classes}" />
<pathelement location="${java.test.src.dir}" />
<fileset dir="${forrest.lib.dir}/bundle" includes="*.jar" />
</classpath>
</javac>
</target>
<target name="test" depends="compile,compile-tests">
<junit printsummary="withOutAndErr"
failureproperty="junit.failure"
includeantruntime="false">
<classpath>
<pathelement location="${forrest.lib.dir}/junit-4.8.1.jar" />
<pathelement location="${build.classes}" />
<pathelement location="${build.test.classes}" />
<fileset dir="${forrest.lib.dir}/bundle" includes="*.jar" />
</classpath>
<batchtest>
<fileset dir="${build.test.classes}" />
</batchtest>
<formatter type="plain" usefile="false" />
</junit>
<fail if="junit.failure" message="There are unit test failures. Please check the output above." />
</target>
<target name="bundle" depends="test">
<echo>Bundling ${ant.project.name}</echo>
<mkdir dir="${bundle.deploy.dir}" />
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${bnd.jar.file}" />
<!-- bnd was chosen over bndwrap because bnd seems to be fail-fast -->
<!--
<bndwrap
jars="${build.dir}/${jar.file}"
output="${bundle.deploy.dir}/${bundle.symbolic.name}-${bundle.version}.jar" />
-->
<bnd
classpath="${build.classes}"
eclipse="false"
failok="false"
files="${bundle.bnd.file}"
output="${bundle.deploy.dir}/${bundle.symbolic.name}-${bundle.version}.jar" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>