blob: 8f2fa51c7a43e8a249b2a4f3a19a6a2e0470cbef [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
Jake Farrellc023d902011-05-20 19:04:13 +0000103 <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" unless="mvn.ant.tasks.found">
Jake Farrell680114d2011-04-19 21:15:17 +0000104 <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}"/>
Roger Meier565517a2013-03-22 21:08:39 +0100135 <scm connection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
136 developerConnection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
137 url="https://git-wip-us.apache.org/repos/asf?p=thrift.git"
Jake Farrell680114d2011-04-19 21:15:17 +0000138 />
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"/>
Jens Geyer111d8f22013-06-03 16:49:55 +0200156 <developer id="jensg" name="Jens Geyer"/>
Carl Yeksigian350860f2013-06-01 22:48:52 -0400157 <developer id="carl" name="Carl Yeksigian"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000158
159 <!-- Thrift dependencies list -->
160 <dependency groupId="org.apache.thrift" artifactId="libthrift" version="${version}"/>
161 </artifact:pom>
162
163 <!-- Generate the pom file -->
164 <artifact:writepom pomRefId="pom" file="${fb303.pom.xml}"/>
165
166 <property name="mvn.finished" value="true"/>
167 </target>
168
169 <macrodef name="signAndDeploy">
170 <!-- Sign and deploy jars to apache repo -->
171 <attribute name="file"/>
172 <attribute name="classifier" default=""/>
173 <attribute name="packaging" default="jar"/>
Jake Farrellc023d902011-05-20 19:04:13 +0000174 <attribute name="pom" default=""/>
Jake Farrell680114d2011-04-19 21:15:17 +0000175 <sequential>
176 <artifact:mvn fork="true">
177 <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/>
178 <arg value="-DrepositoryId=${maven-repository-id}"/>
179 <arg value="-Durl=${maven-repository-url}"/>
Jake Farrellc023d902011-05-20 19:04:13 +0000180 <arg value="-DpomFile=@{pom}"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000181 <arg value="-Dfile=@{file}"/>
182 <arg value="-Dclassifier=@{classifier}"/>
183 <arg value="-Dpackaging=@{packaging}"/>
184 <arg value="-Pgpg"/>
185 </artifact:mvn>
186 </sequential>
187 </macrodef>
188
189 <target name="publish" depends="clean,dist">
190 <!-- Compile, packages and then send release to apache maven repo -->
191 <!-- run with: ant -Drelease=true publish-->
Jake Farrellc023d902011-05-20 19:04:13 +0000192 <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier="" pom="${fb303.pom.xml}"/>
193 <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier="" pom="${fb303.pom.xml}"/>
pwyckoff99b000b2008-04-03 19:30:55 +0000194 </target>
195</project>