blob: 62699a4360917d38c52a789f26737ddca414c20f [file] [log] [blame]
Jake Farrell680114d2011-04-19 21:15:17 +00001<?xml version="1.0"?>
David Reiss16f5cd12009-03-30 22:52:51 +00002<!--
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 Farrell680114d2011-04-19 21:15:17 +000010
11 http://www.apache.org/licenses/LICENSE-2.0
12
David Reiss16f5cd12009-03-30 22:52:51 +000013 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 Farrell680114d2011-04-19 21:15:17 +000019 -->
20<project name="libfb303" default="dist" basedir="."
21 xmlns:artifact="antlib:org.apache.maven.artifact.ant">
pwyckoff99b000b2008-04-03 19:30:55 +000022
23 <!-- project wide settings. All directories relative to basedir -->
Jake Farrell680114d2011-04-19 21:15:17 +000024 <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"/>
pwyckoff99b000b2008-04-03 19:30:55 +000030
Jake Farrell680114d2011-04-19 21:15:17 +000031 <!-- 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"/>
pwyckoff99b000b2008-04-03 19:30:55 +000047 <property name="build.lib.dir" value="${build.dir}/lib"/>
Jake Farrell680114d2011-04-19 21:15:17 +000048 <property name="build.classes.dir" value="${build.dir}/classes"/>
pwyckoff99b000b2008-04-03 19:30:55 +000049
Jake Farrell680114d2011-04-19 21:15:17 +000050 <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"/>
pwyckoff99b000b2008-04-03 19:30:55 +000052
Jake Farrell680114d2011-04-19 21:15:17 +000053 <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/>
pwyckoff99b000b2008-04-03 19:30:55 +000059 <mkdir dir="${build.dir}"/>
60 <mkdir dir="${build.classes.dir}"/>
61 <mkdir dir="${build.lib.dir}"/>
pwyckoff99b000b2008-04-03 19:30:55 +000062 </target>
63
64 <!-- generate fb303 thrift code -->
Jake Farrell680114d2011-04-19 21:15:17 +000065 <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"/>
pwyckoff99b000b2008-04-03 19:30:55 +000069 </exec>
70 </target>
71
72 <!-- compile the base and thrift generated code and jar them -->
Jake Farrell680114d2011-04-19 21:15:17 +000073 <target name="dist" depends="init,generate">
74 <echo message="Building ${fb303.final.name}.jar"/>
75 <javac destdir="${build.classes.dir}" debug="on">
pwyckoff99b000b2008-04-03 19:30:55 +000076 <classpath>
Jake Farrell680114d2011-04-19 21:15:17 +000077 <pathelement location="${thrift.java.libthrift}"/>
78 <fileset dir="${thrift.root}/lib/java/build/lib">
79 <include name="*.jar"/>
Todd Lipcon61934782010-09-21 18:01:43 +000080 </fileset>
pwyckoff99b000b2008-04-03 19:30:55 +000081 </classpath>
Jake Farrell680114d2011-04-19 21:15:17 +000082 <src path="${src}"/>
83 <src path="${gen}"/>
84 <include name="**/*.java"/>
pwyckoff99b000b2008-04-03 19:30:55 +000085 </javac>
Jake Farrell680114d2011-04-19 21:15:17 +000086 <jar jarfile="${build.dir}/${fb303.final.name}.jar" basedir="${build.classes.dir}">
pwyckoff99b000b2008-04-03 19:30:55 +000087 </jar>
88 </target>
89
90 <!-- copy the build jar to the distribution library directory -->
91 <target name="install" depends="dist">
Jake Farrell680114d2011-04-19 21:15:17 +000092 <copy todir="${install.path}">
93 <fileset dir="${build.lib.dir}" includes="*.jar"/>
94 <fileset dir="${build.lib.dir}" includes="${fb303.final.name}.jar"/>
pwyckoff99b000b2008-04-03 19:30:55 +000095 </copy>
96 </target>
97
98 <target name="clean">
pwyckoff99b000b2008-04-03 19:30:55 +000099 <delete dir="${build.dir}"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000100 <delete dir="${gen}"/>
101 </target>
102
103 <target name="mvn.ant.tasks.download" depends="setup.init" unless="mvn.ant.tasks.found">
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"/>
172 <sequential>
173 <artifact:mvn fork="true">
174 <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/>
175 <arg value="-DrepositoryId=${maven-repository-id}"/>
176 <arg value="-Durl=${maven-repository-url}"/>
177 <arg value="-DpomFile=${fb303.pom.xml}"/>
178 <arg value="-Dfile=@{file}"/>
179 <arg value="-Dclassifier=@{classifier}"/>
180 <arg value="-Dpackaging=@{packaging}"/>
181 <arg value="-Pgpg"/>
182 </artifact:mvn>
183 </sequential>
184 </macrodef>
185
186 <target name="publish" depends="clean,dist">
187 <!-- Compile, packages and then send release to apache maven repo -->
188 <!-- run with: ant -Drelease=true publish-->
189 <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier=""/>
190 <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier=""/>
pwyckoff99b000b2008-04-03 19:30:55 +0000191 </target>
192</project>