| <?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="depender" default="run" xmlns:ivy="antlib:org.apache.ivy.ant"> |
| <!-- some variables used --> |
| <property name="lib.dir" value="${basedir}/lib" /> |
| <property name="build.dir" value="${basedir}/build" /> |
| <property name="classes.dir" value="${build.dir}/classes" /> |
| <property name="src.dir" value="${basedir}/src" /> |
| |
| <!-- ivy properties used --> |
| <property name="ivy.settings.dir" value="../settings" /> |
| <property file="${ivy.settings.dir}/ivysettings.properties" /> |
| |
| <!-- paths used for compilation and run --> |
| <path id="lib.path.id"> |
| <fileset dir="${lib.dir}" /> |
| </path> |
| <path id="run.path.id"> |
| <path refid="lib.path.id" /> |
| <path location="${classes.dir}" /> |
| </path> |
| |
| <!-- ================================= |
| target: init |
| ================================= --> |
| <target name="init"> |
| <taskdef resource="org/apache/ivy/ant/antlib.xml" |
| uri="antlib:org.apache.ivy.ant" |
| classpath="${ivy.jar}"/> |
| |
| <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> |
| |
| <taskdef name="sigil.bundle" |
| classname="org.apache.felix.sigil.ant.BundleTask" |
| classpath="${sigil-ivy-plugin.jar}"/> |
| </target> |
| |
| |
| <!-- ================================= |
| target: resolve |
| ================================= --> |
| <target name="resolve" depends="init" |
| description="--> resolve and retrieve dependencies with ivy"> |
| <ivy:retrieve /> |
| </target> |
| |
| <!-- ================================= |
| target: report |
| ================================= --> |
| <target name="report" depends="resolve" description="--> generates a report of dependencies"> |
| <ivy:report todir="${build.dir}" dot="true"/> |
| </target> |
| |
| <!-- ================================= |
| target: gen-graph |
| ================================= --> |
| <target name="gen-graph" depends="report" description="--> generates a graph of dependencies (requires dot in your path - see http://www.graphviz.org/)"> |
| <property name="dot.file" value="${build.dir}/apache-depending-default.dot" /> |
| <property name="ivygraph.output.file" value="${build.dir}/graph.png" /> |
| <exec executable="dot"> |
| <arg line="-T png -o ${ivygraph.output.file} ${dot.file}" /> |
| </exec> |
| </target> |
| |
| <!-- ================================= |
| target: compile |
| ================================= --> |
| <target name="compile" depends="resolve" description="--> description"> |
| <mkdir dir="${classes.dir}" /> |
| <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" /> |
| </target> |
| |
| <!-- ================================= |
| target: run |
| ================================= --> |
| <target name="run" depends="clean, compile" description="--> compile and run the project"> |
| <java classpathref="run.path.id" classname="depending.Main"/> |
| </target> |
| |
| <!-- ================================= |
| target: clean |
| ================================= --> |
| <target name="clean" description="--> clean the project"> |
| <delete includeemptydirs="true"> |
| <fileset dir="${basedir}"> |
| <exclude name="src/**" /> |
| <exclude name="build.xml" /> |
| <exclude name="ivy.xml" /> |
| <exclude name="sigil.properties" /> |
| </fileset> |
| </delete> |
| </target> |
| </project> |