Richard S. Hall | 85bafab | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 1 | <?xml version="1.0"> |
| 2 | <!-- |
| 3 | Licensed to the Apache Software Foundation (ASF) under one |
| 4 | or more contributor license agreements. See the NOTICE file |
| 5 | distributed with this work for additional information |
| 6 | regarding copyright ownership. The ASF licenses this file |
| 7 | to you under the Apache License, Version 2.0 (the |
| 8 | "License"); you may not use this file except in compliance |
| 9 | with the License. You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, |
| 14 | software distributed under the License is distributed on an |
| 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | KIND, either express or implied. See the License for the |
| 17 | specific language governing permissions and limitations |
| 18 | under the License. |
| 19 | --> |
| 20 | <project name="depender" default="run" xmlns:ivy="antlib:org.apache.ivy.ant"> |
| 21 | <!-- some variables used --> |
| 22 | <property name="lib.dir" value="${basedir}/lib" /> |
| 23 | <property name="build.dir" value="${basedir}/build" /> |
| 24 | <property name="classes.dir" value="${build.dir}/classes" /> |
| 25 | <property name="src.dir" value="${basedir}/src" /> |
| 26 | |
| 27 | <!-- ivy properties used --> |
| 28 | <property name="ivy.settings.dir" value="../settings" /> |
| 29 | <property file="${ivy.settings.dir}/ivysettings.properties" /> |
| 30 | |
| 31 | <!-- paths used for compilation and run --> |
| 32 | <path id="lib.path.id"> |
| 33 | <fileset dir="${lib.dir}" /> |
| 34 | </path> |
| 35 | <path id="run.path.id"> |
| 36 | <path refid="lib.path.id" /> |
| 37 | <path location="${classes.dir}" /> |
| 38 | </path> |
| 39 | |
| 40 | <!-- ================================= |
| 41 | target: init |
| 42 | ================================= --> |
| 43 | <target name="init"> |
| 44 | <taskdef resource="org/apache/ivy/ant/antlib.xml" |
| 45 | uri="antlib:org.apache.ivy.ant" |
| 46 | classpath="${ivy.jar}"/> |
| 47 | |
| 48 | <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> |
| 49 | |
| 50 | <taskdef name="sigil.bundle" |
David Morgan Spencer Savage | 8ec5a4c | 2009-07-14 15:59:46 +0000 | [diff] [blame] | 51 | classname="org.apache.felix.sigil.ant.BundleTask" |
Richard S. Hall | 85bafab | 2009-07-13 13:25:46 +0000 | [diff] [blame] | 52 | classpath="${sigil-ivy-plugin.jar}"/> |
| 53 | </target> |
| 54 | |
| 55 | |
| 56 | <!-- ================================= |
| 57 | target: resolve |
| 58 | ================================= --> |
| 59 | <target name="resolve" depends="init" |
| 60 | description="--> resolve and retrieve dependencies with ivy"> |
| 61 | <ivy:retrieve /> |
| 62 | </target> |
| 63 | |
| 64 | <!-- ================================= |
| 65 | target: report |
| 66 | ================================= --> |
| 67 | <target name="report" depends="resolve" description="--> generates a report of dependencies"> |
| 68 | <ivy:report todir="${build.dir}" dot="true"/> |
| 69 | </target> |
| 70 | |
| 71 | <!-- ================================= |
| 72 | target: gen-graph |
| 73 | ================================= --> |
| 74 | <target name="gen-graph" depends="report" description="--> generates a graph of dependencies (requires dot in your path - see http://www.graphviz.org/)"> |
| 75 | <property name="dot.file" value="${build.dir}/apache-depending-default.dot" /> |
| 76 | <property name="ivygraph.output.file" value="${build.dir}/graph.png" /> |
| 77 | <exec executable="dot"> |
| 78 | <arg line="-T png -o ${ivygraph.output.file} ${dot.file}" /> |
| 79 | </exec> |
| 80 | </target> |
| 81 | |
| 82 | <!-- ================================= |
| 83 | target: compile |
| 84 | ================================= --> |
| 85 | <target name="compile" depends="resolve" description="--> description"> |
| 86 | <mkdir dir="${classes.dir}" /> |
| 87 | <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" /> |
| 88 | </target> |
| 89 | |
| 90 | <!-- ================================= |
| 91 | target: run |
| 92 | ================================= --> |
| 93 | <target name="run" depends="clean, compile" description="--> compile and run the project"> |
| 94 | <java classpathref="run.path.id" classname="depending.Main"/> |
| 95 | </target> |
| 96 | |
| 97 | <!-- ================================= |
| 98 | target: clean |
| 99 | ================================= --> |
| 100 | <target name="clean" description="--> clean the project"> |
| 101 | <delete includeemptydirs="true"> |
| 102 | <fileset dir="${basedir}"> |
| 103 | <exclude name="src/**" /> |
| 104 | <exclude name="build.xml" /> |
| 105 | <exclude name="ivy.xml" /> |
| 106 | <exclude name="sigil.properties" /> |
| 107 | </fileset> |
| 108 | </delete> |
| 109 | </target> |
| 110 | </project> |