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 | <property name="ivy.jar.file" |
| 41 | value="/opt/apache-ivy-2.0.0/ivy-2.0.0.jar"/> |
| 42 | |
| 43 | <!-- ================================= |
| 44 | target: init |
| 45 | ================================= --> |
| 46 | <target name="init"> |
| 47 | <taskdef resource="org/apache/ivy/ant/antlib.xml" |
| 48 | uri="antlib:org.apache.ivy.ant" |
| 49 | classpath="${ivy.jar.file}"/> |
| 50 | <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> |
| 51 | </target> |
| 52 | |
| 53 | <!-- ================================= |
| 54 | target: resolve |
| 55 | ================================= --> |
| 56 | <target name="resolve" depends="init" |
| 57 | description="--> resolve and retrieve dependencies with ivy"> |
| 58 | <ivy:retrieve /> |
| 59 | </target> |
| 60 | |
| 61 | <!-- ================================= |
| 62 | target: report |
| 63 | ================================= --> |
| 64 | <target name="report" depends="resolve" description="--> generates a report of dependencies"> |
| 65 | <ivy:report todir="${build.dir}" dot="true"/> |
| 66 | </target> |
| 67 | |
| 68 | <!-- ================================= |
| 69 | target: gen-graph |
| 70 | ================================= --> |
| 71 | <target name="gen-graph" depends="report" description="--> generates a graph of dependencies (requires dot in your path - see http://www.graphviz.org/)"> |
| 72 | <property name="dot.file" value="${build.dir}/apache-depending-default.dot" /> |
| 73 | <property name="ivygraph.output.file" value="${build.dir}/graph.png" /> |
| 74 | <exec executable="dot"> |
| 75 | <arg line="-T png -o ${ivygraph.output.file} ${dot.file}" /> |
| 76 | </exec> |
| 77 | </target> |
| 78 | |
| 79 | <!-- ================================= |
| 80 | target: compile |
| 81 | ================================= --> |
| 82 | <target name="compile" depends="resolve" description="--> description"> |
| 83 | <mkdir dir="${classes.dir}" /> |
| 84 | <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" /> |
| 85 | </target> |
| 86 | |
| 87 | <!-- ================================= |
| 88 | target: run |
| 89 | ================================= --> |
| 90 | <target name="run" depends="clean, compile" description="--> compile and run the project"> |
| 91 | <java classpathref="run.path.id" classname="depending.Main"/> |
| 92 | </target> |
| 93 | |
| 94 | <!-- ================================= |
| 95 | target: clean |
| 96 | ================================= --> |
| 97 | <target name="clean" description="--> clean the project"> |
| 98 | <delete includeemptydirs="true"> |
| 99 | <fileset dir="${basedir}"> |
| 100 | <exclude name="src/**" /> |
| 101 | <exclude name="build.xml" /> |
| 102 | <exclude name="ivy.xml" /> |
| 103 | <exclude name="sigil.properties" /> |
| 104 | </fileset> |
| 105 | </delete> |
| 106 | </target> |
| 107 | </project> |