blob: 591a4cbd0aa327c2e60b8ccb9ededf60eb2fcde1 [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
Alex Volanis7004a612018-01-24 10:30:13 -050010
Jake Farrell680114d2011-04-19 21:15:17 +000011 http://www.apache.org/licenses/LICENSE-2.0
Alex Volanis7004a612018-01-24 10:30:13 -050012
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/"/>
Alex Volanis7004a612018-01-24 10:30:13 -050029 <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/>
30 <property file="${basedir}/build.properties"/>
pwyckoff99b000b2008-04-03 19:30:55 +000031
Jake Farrell680114d2011-04-19 21:15:17 +000032 <!-- inherit from the java build file for version and other properties -->
Alex Volanis7004a612018-01-24 10:30:13 -050033 <property file="${thrift.java.dir}/gradle.properties" />
Jake Farrell680114d2011-04-19 21:15:17 +000034
35 <property environment="env"/>
36
37 <condition property="version" value="${thrift.version}">
38 <isset property="release"/>
39 </condition>
Alex Volanis7004a612018-01-24 10:30:13 -050040 <property name="version" value="${thrift.version}-SNAPSHOT"/>
Jake Farrell680114d2011-04-19 21:15:17 +000041
42 <property name="fb303.final.name" value="${fb303.artifactid}-${version}"/>
Jake Farrell680114d2011-04-19 21:15:17 +000043
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>
Alex Volanis7004a612018-01-24 10:30:13 -050077 <fileset dir="${thrift.java.dir}/build/libs">
78 <include name="libthrift*.jar" />
79 <exclude name="libthrift*javadoc.jar" />
80 <exclude name="libthrift*sources.jar" />
81 </fileset>
82 <fileset dir="${thrift.java.dir}/build/deps">
Jake Farrell680114d2011-04-19 21:15:17 +000083 <include name="*.jar"/>
Todd Lipcon61934782010-09-21 18:01:43 +000084 </fileset>
pwyckoff99b000b2008-04-03 19:30:55 +000085 </classpath>
Jake Farrell680114d2011-04-19 21:15:17 +000086 <src path="${src}"/>
87 <src path="${gen}"/>
88 <include name="**/*.java"/>
pwyckoff99b000b2008-04-03 19:30:55 +000089 </javac>
Jake Farrell680114d2011-04-19 21:15:17 +000090 <jar jarfile="${build.dir}/${fb303.final.name}.jar" basedir="${build.classes.dir}">
pwyckoff99b000b2008-04-03 19:30:55 +000091 </jar>
92 </target>
93
94 <!-- copy the build jar to the distribution library directory -->
95 <target name="install" depends="dist">
Jake Farrell680114d2011-04-19 21:15:17 +000096 <copy todir="${install.path}">
97 <fileset dir="${build.lib.dir}" includes="*.jar"/>
98 <fileset dir="${build.lib.dir}" includes="${fb303.final.name}.jar"/>
pwyckoff99b000b2008-04-03 19:30:55 +000099 </copy>
100 </target>
101
102 <target name="clean">
pwyckoff99b000b2008-04-03 19:30:55 +0000103 <delete dir="${build.dir}"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000104 <delete dir="${gen}"/>
105 </target>
106
Jake Farrellc023d902011-05-20 19:04:13 +0000107 <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 +0000108 <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/>
109 </target>
110
111 <target name="mvn.ant.tasks.check">
112 <condition property="mvn.ant.tasks.found">
113 <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/>
114 </condition>
115 </target>
116
117 <target name="mvn.init" depends="mvn.ant.tasks.download" unless="mvn.finished">
118 <echo message="${mvn.ant.task.jar}"/>
119 <!-- Download mvn ant tasks, download dependencies, and setup pom file -->
120 <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${build.tools.dir}/${mvn.ant.task.jar}"/>
121
122 <!-- remote repositories used to download dependencies from -->
123 <artifact:remoteRepository id="central" url="${mvn.repo}"/>
124 <artifact:remoteRepository id="apache" url="${apache.repo}"/>
125
126 <!-- Pom file information -->
Alex Volanis7004a612018-01-24 10:30:13 -0500127 <artifact:pom id="pom"
128 groupId="${thrift.groupid}"
Jake Farrell680114d2011-04-19 21:15:17 +0000129 artifactId="${fb303.artifactid}"
Alex Volanis7004a612018-01-24 10:30:13 -0500130 version="${version}"
Jake Farrell680114d2011-04-19 21:15:17 +0000131 url="http://thrift.apache.org"
132 name="Apache Thrift"
133 description="Thrift is a software framework for scalable cross-language services development."
Alex Volanis7004a612018-01-24 10:30:13 -0500134 packaging="jar"
Jake Farrell680114d2011-04-19 21:15:17 +0000135 >
136 <remoteRepository refid="central"/>
137 <remoteRepository refid="apache"/>
138 <license name="The Apache Software License, Version 2.0" url="${license}"/>
Alex Volanis7004a612018-01-24 10:30:13 -0500139 <scm connection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
Roger Meier565517a2013-03-22 21:08:39 +0100140 developerConnection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git"
141 url="https://git-wip-us.apache.org/repos/asf?p=thrift.git"
Jake Farrell680114d2011-04-19 21:15:17 +0000142 />
143 <!-- Thrift Developers -->
144 <developer id="mcslee" name="Mark Slee"/>
145 <developer id="dreiss" name="David Reiss"/>
146 <developer id="aditya" name="Aditya Agarwal"/>
147 <developer id="marck" name="Marc Kwiatkowski"/>
148 <developer id="jwang" name="James Wang"/>
149 <developer id="cpiro" name="Chris Piro"/>
150 <developer id="bmaurer" name="Ben Maurer"/>
151 <developer id="kclark" name="Kevin Clark"/>
152 <developer id="jake" name="Jake Luciani"/>
153 <developer id="bryanduxbury" name="Bryan Duxbury"/>
154 <developer id="esteve" name="Esteve Fernandez"/>
155 <developer id="todd" name="Todd Lipcon"/>
156 <developer id="geechorama" name="Andrew McGeachie"/>
157 <developer id="molinaro" name="Anthony Molinaro"/>
158 <developer id="roger" name="Roger Meier"/>
159 <developer id="jfarrell" name="Jake Farrell"/>
Jens Geyer111d8f22013-06-03 16:49:55 +0200160 <developer id="jensg" name="Jens Geyer"/>
Carl Yeksigian350860f2013-06-01 22:48:52 -0400161 <developer id="carl" name="Carl Yeksigian"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000162
163 <!-- Thrift dependencies list -->
164 <dependency groupId="org.apache.thrift" artifactId="libthrift" version="${version}"/>
165 </artifact:pom>
166
167 <!-- Generate the pom file -->
168 <artifact:writepom pomRefId="pom" file="${fb303.pom.xml}"/>
169
170 <property name="mvn.finished" value="true"/>
171 </target>
172
173 <macrodef name="signAndDeploy">
174 <!-- Sign and deploy jars to apache repo -->
175 <attribute name="file"/>
176 <attribute name="classifier" default=""/>
177 <attribute name="packaging" default="jar"/>
Jake Farrellc023d902011-05-20 19:04:13 +0000178 <attribute name="pom" default=""/>
Jake Farrell680114d2011-04-19 21:15:17 +0000179 <sequential>
180 <artifact:mvn fork="true">
181 <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/>
182 <arg value="-DrepositoryId=${maven-repository-id}"/>
183 <arg value="-Durl=${maven-repository-url}"/>
Jake Farrellc023d902011-05-20 19:04:13 +0000184 <arg value="-DpomFile=@{pom}"/>
Jake Farrell680114d2011-04-19 21:15:17 +0000185 <arg value="-Dfile=@{file}"/>
186 <arg value="-Dclassifier=@{classifier}"/>
187 <arg value="-Dpackaging=@{packaging}"/>
188 <arg value="-Pgpg"/>
189 </artifact:mvn>
190 </sequential>
191 </macrodef>
192
193 <target name="publish" depends="clean,dist">
194 <!-- Compile, packages and then send release to apache maven repo -->
195 <!-- run with: ant -Drelease=true publish-->
Jake Farrellc023d902011-05-20 19:04:13 +0000196 <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier="" pom="${fb303.pom.xml}"/>
197 <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier="" pom="${fb303.pom.xml}"/>
pwyckoff99b000b2008-04-03 19:30:55 +0000198 </target>
199</project>