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="dependee" 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 | target: resolve |
| 57 | ================================= --> |
| 58 | <target name="resolve" depends="init" |
| 59 | description="--> resolve and retrieve dependencies with ivy"> |
| 60 | <ivy:retrieve /> |
| 61 | </target> |
| 62 | |
| 63 | <!-- ================================= |
| 64 | target: report |
| 65 | ================================= --> |
| 66 | <target name="report" depends="resolve" description="--> generates a report of dependencies"> |
| 67 | <ivy:report todir="${build.dir}"/> |
| 68 | </target> |
| 69 | |
| 70 | <!-- ================================= |
| 71 | target: compile |
| 72 | ================================= --> |
| 73 | <target name="compile" depends="resolve" description="--> description"> |
| 74 | <mkdir dir="${classes.dir}" /> |
| 75 | <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" /> |
| 76 | </target> |
| 77 | |
| 78 | <!-- ================================= |
| 79 | target: run |
| 80 | ================================= --> |
| 81 | <target name="run" depends="compile" description="--> compile and run the project"> |
| 82 | <java classpathref="run.path.id" classname="standalone.Main"/> |
| 83 | </target> |
| 84 | |
| 85 | <!-- ================================= |
| 86 | target: jar |
| 87 | ================================= --> |
| 88 | <target name="jar" depends="compile" description="--> make a jar file for this project"> |
| 89 | <propertyfile file="${classes.dir}/version.properties"> |
| 90 | <entry key="version" type="int" operation="+" default="0" /> |
| 91 | </propertyfile> |
| 92 | <property file="${classes.dir}/version.properties" /> |
| 93 | <!-- |
| 94 | <jar destfile="${build.dir}/${ant.project.name}.jar"> |
| 95 | <fileset dir="${classes.dir}" /> |
| 96 | </jar> |
| 97 | --> |
| 98 | <sigil.bundle destpattern="${build.dir}/[id].[ext]" |
| 99 | classpathref="run.path.id" /> |
| 100 | </target> |
| 101 | |
| 102 | <!-- ================================= |
| 103 | target: publish |
| 104 | ================================= --> |
| 105 | <target name="publish" depends="jar" description="--> publish this project in the ivy repository"> |
| 106 | <property name="revision" value="${version}"/> |
| 107 | <delete file="${build.dir}/ivy.xml"/> |
| 108 | <ivy:publish artifactspattern="${build.dir}/[artifact].[ext]" |
| 109 | resolver="projects" |
| 110 | pubrevision="${revision}" |
| 111 | status="release" |
| 112 | /> |
| 113 | <echo message="project ${ant.project.name} released with version ${revision}" /> |
| 114 | </target> |
| 115 | |
| 116 | |
| 117 | <!-- ================================= |
| 118 | target: clean |
| 119 | ================================= --> |
| 120 | <target name="clean" description="--> clean the project"> |
| 121 | <delete includeemptydirs="true"> |
| 122 | <fileset dir="${basedir}"> |
| 123 | <exclude name="src/**" /> |
| 124 | <exclude name="build.xml" /> |
| 125 | <exclude name="ivy.xml" /> |
| 126 | <exclude name="sigil.properties" /> |
| 127 | </fileset> |
| 128 | </delete> |
| 129 | </target> |
| 130 | </project> |