blob: aedc2eca9dd3c007c6e954bf76ca2521afdc5943 [file] [log] [blame]
<?xml version="1.0">
<!--
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="common"
xmlns:ivy="antlib:org.apache.ivy.ant">
<dirname property="common.dir" file="${ant.file.common}"/>
<property file="${common.dir}/build.properties"/>
<path id="lib.path.id">
<fileset dir="${deps.dir}" />
</path>
<path id="sigil.path.id">
<path refid="lib.path.id" />
<path location="${classes.dir}" />
</path>
<!-- setup ivy default configuration with some custom info -->
<property name="ivy.local.default.root" value="${repository.dir}/local"/>
<property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
<!-- =================================
target: load-ivy
================================= -->
<target name="load-ivy" depends="ivy-taskdefs">
<ivy:settings file="${common.dir}/ivysettings.xml" />
</target>
<!-- =================================
target: ivy-taskdefs
================================= -->
<target name="ivy-taskdefs" unless="ivy.loaded">
<property name="ivy.loaded" value="true"/>
<echo message="Loading Ivy ... common.dir=${common.dir}"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpath="${ivy.jar}"/>
<taskdef name="sigil.bundle"
classname="oorg.apache.felix.sigil.ant.BundleTask"
classpath="${sigil-ivy-plugin.jar}"/>
</target>
<!-- =================================
target: build (default target)
================================= -->
<target name="build" depends="ident, jar, resources" />
<target name="ident">
<echo message="${ant.project.name}"/>
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="load-ivy, clean-deps"
description="--> resolve and retrieve dependencies with ivy">
<mkdir dir="${deps.dir}"/>
<ivy:resolve file="${ivy.file}"/>
<ivy:retrieve pattern="${deps.dir}/[artifact].[ext]" />
</target>
<!-- =================================
target: install
================================= -->
<target name="install" depends="install-version, build"
description="--> publish this project in the local repository">
<ivy:publish artifactspattern="${dest.lib.dir}/[artifact].[ext]"
resolver="local"
pubrevision="${version}"
pubdate="${now}"
forcedeliver="true"
status="integration"/>
<echo message="project ${ant.project.name} published locally with version ${version}" />
</target>
<target name="install-version">
<tstamp>
<format property="now" pattern="yyyyMMddHHmmss"/>
</tstamp>
<property name="version"
value="${module.version.target}-local-${now}"/>
</target>
<!-- =================================
target: report
================================= -->
<target name="report" depends="resolve"
description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile" depends="resolve"
description="--> compile the project">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
classpathref="lib.path.id"
target="1.5"
debug="true" />
</target>
<!-- =================================
target: jar
================================= -->
<target name="jar" depends="compile"
description="--> make a jar file for this project">
<mkdir dir="${dest.lib.dir}"/>
<sigil.bundle destpattern="${dest.lib.dir}/[id].[ext]"
classpathref="sigil.path.id"/>
</target>
<!-- =================================
target: resources
================================= -->
<available file="${resource.dir}" type="dir"
property="resource.dir.present"/>
<target name="resources" if="resource.dir.present"
description="--> filter xml resources replacing ${VERSION} etc.">
<mkdir dir="${dest.etc.dir}"/>
<copy todir="${dest.etc.dir}">
<fileset dir="${resource.dir}">
<include name="*.composite"/>
<include name="*.system"/>
</fileset>
<filterset begintoken="$${" endtoken="}">
<filter token="VERSION" value="${bundle.version}"/>
<filter token="BLITZ_VERSION" value="${blitz.version}"/>
<filter token="JINI_VERSION" value="${jini.version}"/>
</filterset>
</copy>
</target>
<!-- =================================
target: clean-local
================================= -->
<target name="clean-local"
description="--> cleans the local repository for the current module">
<delete dir="${ivy.local.default.root}/${ant.project.name}"/>
</target>
<!-- =================================
target: clean-deps
================================= -->
<target name="clean-deps"
description="--> clean the project libraries directory (dependencies)">
<delete includeemptydirs="true" dir="${deps.dir}"/>
</target>
<!-- =================================
target: clean-build
================================= -->
<target name="clean-build"
description="--> clean the project built files">
<delete includeemptydirs="true" dir="${build.dir}"/>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" depends="clean-build, clean-deps"
description="--> clean the project" />
<!-- =================================
target: buildlist
================================= -->
<fileset id="projects" dir="${basedir}" includes="**/build.xml"/>
<target name="buildlist" depends="load-ivy">
<ivy:buildlist reference="ordered-list"
onMissingDescriptor="skip">
<fileset refid="projects"/>
</ivy:buildlist>
</target>
<!-- =================================
target: install-list
================================= -->
<target name="install-list" depends="buildlist"
description="--> compile, jar and install all projects in the right order">
<subant target="install" buildpathref="ordered-list">
<propertyset>
<propertyref name="ivy.loaded" />
</propertyset>
</subant>
</target>
<!-- =================================
target: clean-list
================================= -->
<target name="clean-list" depends="clean, buildlist"
description="--> clean all projects">
<subant target="clean" buildpathref="ordered-list" />
</target>
<!-- =================================
target: clean-all
================================= -->
<target name="clean-all" depends="clean-list"
description="--> delete repository, ivy cache, and all projects">
<delete dir="${repository.dir}"/>
<ivy:cleancache />
</target>
</project>