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