Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> |
David Reiss | 16f5cd1 | 2009-03-30 22:52:51 +0000 | [diff] [blame] | 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 |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
David Reiss | 16f5cd1 | 2009-03-30 22:52:51 +0000 | [diff] [blame] | 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. |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 19 | --> |
| 20 | <project name="libfb303" default="dist" basedir="." |
| 21 | xmlns:artifact="antlib:org.apache.maven.artifact.ant"> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 22 | |
| 23 | <!-- project wide settings. All directories relative to basedir --> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 24 | <property name="thrift.root" location="${basedir}/../../../"/> |
| 25 | <property name="fb303.artifactid" value="libfb303"/> |
| 26 | <property name="interface.dir" value="${basedir}/../if"/> |
| 27 | <property name="thrift.java.dir" location="${thrift.root}/lib/java"/> |
| 28 | <property name="build.tools.dir" location="${thrift.java.dir}/build/tools/"/> |
| 29 | <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 30 | |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 31 | <!-- inherit from the java build file for version and other properties --> |
| 32 | <property file="${thrift.java.dir}/build.properties" /> |
| 33 | |
| 34 | <property environment="env"/> |
| 35 | |
| 36 | <condition property="version" value="${thrift.version}"> |
| 37 | <isset property="release"/> |
| 38 | </condition> |
| 39 | <property name="version" value="${thrift.version}-snapshot"/> |
| 40 | |
| 41 | <property name="fb303.final.name" value="${fb303.artifactid}-${version}"/> |
| 42 | <property name="thrift.java.libthrift" value="${thrift.java.dir}/build/libthrift-${version}.jar"/> |
| 43 | |
| 44 | <property name="src" value="${basedir}/src"/> |
| 45 | <property name="gen" value="${basedir}/gen-java"/> |
| 46 | <property name="build.dir" value="${basedir}/build"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 47 | <property name="build.lib.dir" value="${build.dir}/lib"/> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 48 | <property name="build.classes.dir" value="${build.dir}/classes"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 49 | |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 50 | <property name="fb303.jar.file" location="${build.dir}/${fb303.final.name}.jar"/> |
| 51 | <property name="fb303.pom.xml" location="${build.dir}/${fb303.final.name}.pom"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 52 | |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 53 | <target name="init" depends="setup.init,mvn.init" unless="init.finished"> |
| 54 | <property name="init.finished" value="true"/> |
| 55 | </target> |
| 56 | |
| 57 | <target name="setup.init"> |
| 58 | <tstamp/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 59 | <mkdir dir="${build.dir}"/> |
| 60 | <mkdir dir="${build.classes.dir}"/> |
| 61 | <mkdir dir="${build.lib.dir}"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 62 | </target> |
| 63 | |
| 64 | <!-- generate fb303 thrift code --> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 65 | <target name="generate"> |
| 66 | <echo message="generating thrift fb303 files"/> |
| 67 | <exec executable="${thrift_compiler}" failonerror="true"> |
| 68 | <arg line="--gen java -o ${basedir} ${interface.dir}/fb303.thrift"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 69 | </exec> |
| 70 | </target> |
| 71 | |
| 72 | <!-- compile the base and thrift generated code and jar them --> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 73 | <target name="dist" depends="init,generate"> |
| 74 | <echo message="Building ${fb303.final.name}.jar"/> |
| 75 | <javac destdir="${build.classes.dir}" debug="on"> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 76 | <classpath> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 77 | <pathelement location="${thrift.java.libthrift}"/> |
| 78 | <fileset dir="${thrift.root}/lib/java/build/lib"> |
| 79 | <include name="*.jar"/> |
Todd Lipcon | 6193478 | 2010-09-21 18:01:43 +0000 | [diff] [blame] | 80 | </fileset> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 81 | </classpath> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 82 | <src path="${src}"/> |
| 83 | <src path="${gen}"/> |
| 84 | <include name="**/*.java"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 85 | </javac> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 86 | <jar jarfile="${build.dir}/${fb303.final.name}.jar" basedir="${build.classes.dir}"> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 87 | </jar> |
| 88 | </target> |
| 89 | |
| 90 | <!-- copy the build jar to the distribution library directory --> |
| 91 | <target name="install" depends="dist"> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 92 | <copy todir="${install.path}"> |
| 93 | <fileset dir="${build.lib.dir}" includes="*.jar"/> |
| 94 | <fileset dir="${build.lib.dir}" includes="${fb303.final.name}.jar"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 95 | </copy> |
| 96 | </target> |
| 97 | |
| 98 | <target name="clean"> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 99 | <delete dir="${build.dir}"/> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 100 | <delete dir="${gen}"/> |
| 101 | </target> |
| 102 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame] | 103 | <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" unless="mvn.ant.tasks.found"> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 104 | <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/> |
| 105 | </target> |
| 106 | |
| 107 | <target name="mvn.ant.tasks.check"> |
| 108 | <condition property="mvn.ant.tasks.found"> |
| 109 | <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/> |
| 110 | </condition> |
| 111 | </target> |
| 112 | |
| 113 | <target name="mvn.init" depends="mvn.ant.tasks.download" unless="mvn.finished"> |
| 114 | <echo message="${mvn.ant.task.jar}"/> |
| 115 | <!-- Download mvn ant tasks, download dependencies, and setup pom file --> |
| 116 | <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${build.tools.dir}/${mvn.ant.task.jar}"/> |
| 117 | |
| 118 | <!-- remote repositories used to download dependencies from --> |
| 119 | <artifact:remoteRepository id="central" url="${mvn.repo}"/> |
| 120 | <artifact:remoteRepository id="apache" url="${apache.repo}"/> |
| 121 | |
| 122 | <!-- Pom file information --> |
| 123 | <artifact:pom id="pom" |
| 124 | groupId="${thrift.groupid}" |
| 125 | artifactId="${fb303.artifactid}" |
| 126 | version="${version}" |
| 127 | url="http://thrift.apache.org" |
| 128 | name="Apache Thrift" |
| 129 | description="Thrift is a software framework for scalable cross-language services development." |
| 130 | packaging="pom" |
| 131 | > |
| 132 | <remoteRepository refid="central"/> |
| 133 | <remoteRepository refid="apache"/> |
| 134 | <license name="The Apache Software License, Version 2.0" url="${license}"/> |
| 135 | <scm connection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/" |
| 136 | developerConnection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/" |
| 137 | url="http://svn.apache.org/viewcvs.cgi/thrift" |
| 138 | /> |
| 139 | <!-- Thrift Developers --> |
| 140 | <developer id="mcslee" name="Mark Slee"/> |
| 141 | <developer id="dreiss" name="David Reiss"/> |
| 142 | <developer id="aditya" name="Aditya Agarwal"/> |
| 143 | <developer id="marck" name="Marc Kwiatkowski"/> |
| 144 | <developer id="jwang" name="James Wang"/> |
| 145 | <developer id="cpiro" name="Chris Piro"/> |
| 146 | <developer id="bmaurer" name="Ben Maurer"/> |
| 147 | <developer id="kclark" name="Kevin Clark"/> |
| 148 | <developer id="jake" name="Jake Luciani"/> |
| 149 | <developer id="bryanduxbury" name="Bryan Duxbury"/> |
| 150 | <developer id="esteve" name="Esteve Fernandez"/> |
| 151 | <developer id="todd" name="Todd Lipcon"/> |
| 152 | <developer id="geechorama" name="Andrew McGeachie"/> |
| 153 | <developer id="molinaro" name="Anthony Molinaro"/> |
| 154 | <developer id="roger" name="Roger Meier"/> |
| 155 | <developer id="jfarrell" name="Jake Farrell"/> |
| 156 | |
| 157 | <!-- Thrift dependencies list --> |
| 158 | <dependency groupId="org.apache.thrift" artifactId="libthrift" version="${version}"/> |
| 159 | </artifact:pom> |
| 160 | |
| 161 | <!-- Generate the pom file --> |
| 162 | <artifact:writepom pomRefId="pom" file="${fb303.pom.xml}"/> |
| 163 | |
| 164 | <property name="mvn.finished" value="true"/> |
| 165 | </target> |
| 166 | |
| 167 | <macrodef name="signAndDeploy"> |
| 168 | <!-- Sign and deploy jars to apache repo --> |
| 169 | <attribute name="file"/> |
| 170 | <attribute name="classifier" default=""/> |
| 171 | <attribute name="packaging" default="jar"/> |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame] | 172 | <attribute name="pom" default=""/> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 173 | <sequential> |
| 174 | <artifact:mvn fork="true"> |
| 175 | <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/> |
| 176 | <arg value="-DrepositoryId=${maven-repository-id}"/> |
| 177 | <arg value="-Durl=${maven-repository-url}"/> |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame] | 178 | <arg value="-DpomFile=@{pom}"/> |
Jake Farrell | 680114d | 2011-04-19 21:15:17 +0000 | [diff] [blame] | 179 | <arg value="-Dfile=@{file}"/> |
| 180 | <arg value="-Dclassifier=@{classifier}"/> |
| 181 | <arg value="-Dpackaging=@{packaging}"/> |
| 182 | <arg value="-Pgpg"/> |
| 183 | </artifact:mvn> |
| 184 | </sequential> |
| 185 | </macrodef> |
| 186 | |
| 187 | <target name="publish" depends="clean,dist"> |
| 188 | <!-- Compile, packages and then send release to apache maven repo --> |
| 189 | <!-- run with: ant -Drelease=true publish--> |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame] | 190 | <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier="" pom="${fb303.pom.xml}"/> |
| 191 | <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier="" pom="${fb303.pom.xml}"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 192 | </target> |
| 193 | </project> |