summaryrefslogtreecommitdiff
path: root/contrib/fb303
diff options
context:
space:
mode:
authorJake Farrell <jfarrell@apache.org>2011-04-19 21:15:17 +0000
committerJake Farrell <jfarrell@apache.org>2011-04-19 21:15:17 +0000
commit680114defb1ce478a0adf98606d427cea76fcff5 (patch)
tree19ecaaab6de3906748d1170020f7fd7a30f4fcca /contrib/fb303
parent4b8faf9e20dcd8716c456a6ddc1a58c0911ed958 (diff)
downloadthrift-680114defb1ce478a0adf98606d427cea76fcff5.tar.gz
Thrift-1109: Deploy fb303 along side libthrift to maven repo
patch: jfarrell client: contrib fb303 java depends on: Thrift-363 Adding the ability to publish the fb303 java library as an artifact alongside libthrift to the apache maven repository. git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1095218 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'contrib/fb303')
-rwxr-xr-xcontrib/fb303/java/build.xml188
-rw-r--r--contrib/fb303/java/src/FacebookBase.java (renamed from contrib/fb303/java/FacebookBase.java)0
2 files changed, 146 insertions, 42 deletions
diff --git a/contrib/fb303/java/build.xml b/contrib/fb303/java/build.xml
index 48e747097..62699a436 100755
--- a/contrib/fb303/java/build.xml
+++ b/contrib/fb303/java/build.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -6,83 +7,186 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--->
-<project name="libfb303" default="dist" basedir="..">
+ -->
+<project name="libfb303" default="dist" basedir="."
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- project wide settings. All directories relative to basedir -->
- <property name="src.dir" value="java"/>
- <property name="if.dir" value="if"/>
- <property name="thrift_compiler" value="../../compiler/cpp/thrift" />
- <property name="thrift_lib" value="../../lib/java/libthrift.jar" />
+ <property name="thrift.root" location="${basedir}/../../../"/>
+ <property name="fb303.artifactid" value="libfb303"/>
+ <property name="interface.dir" value="${basedir}/../if"/>
+ <property name="thrift.java.dir" location="${thrift.root}/lib/java"/>
+ <property name="build.tools.dir" location="${thrift.java.dir}/build/tools/"/>
+ <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/>
- <!-- temp build directories -->
- <property name="build.dir" value="${src.dir}/build"/>
- <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <!-- inherit from the java build file for version and other properties -->
+ <property file="${thrift.java.dir}/build.properties" />
+
+ <property environment="env"/>
+
+ <condition property="version" value="${thrift.version}">
+ <isset property="release"/>
+ </condition>
+ <property name="version" value="${thrift.version}-snapshot"/>
+
+ <property name="fb303.final.name" value="${fb303.artifactid}-${version}"/>
+ <property name="thrift.java.libthrift" value="${thrift.java.dir}/build/libthrift-${version}.jar"/>
+
+ <property name="src" value="${basedir}/src"/>
+ <property name="gen" value="${basedir}/gen-java"/>
+ <property name="build.dir" value="${basedir}/build"/>
<property name="build.lib.dir" value="${build.dir}/lib"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+
+ <property name="fb303.jar.file" location="${build.dir}/${fb303.final.name}.jar"/>
+ <property name="fb303.pom.xml" location="${build.dir}/${fb303.final.name}.pom"/>
- <!-- final distribution directories -->
- <property name="dist.dir" value="/usr/local"/>
- <property name="dist.lib.dir" value="${dist.dir}/lib"/>
+ <target name="init" depends="setup.init,mvn.init" unless="init.finished">
+ <property name="init.finished" value="true"/>
+ </target>
- <!-- make temporary and distribution directories -->
- <target name="prepare">
+ <target name="setup.init">
+ <tstamp/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${build.lib.dir}"/>
- <mkdir dir="${dist.dir}"/>
- <mkdir dir="${dist.lib.dir}"/>
</target>
<!-- generate fb303 thrift code -->
- <target name="thriftbuild">
- <echo>generating thrift fb303 files</echo>
- <exec executable="${thrift_compiler}" failonerror="true">
- <arg line="--gen java -o ${src.dir} ${src.dir}/../if/fb303.thrift" />
+ <target name="generate">
+ <echo message="generating thrift fb303 files"/>
+ <exec executable="${thrift_compiler}" failonerror="true">
+ <arg line="--gen java -o ${basedir} ${interface.dir}/fb303.thrift"/>
</exec>
- <move todir="${src.dir}">
- <fileset dir="${src.dir}/gen-java/com/facebook/fb303">
- <include name="**/*.java"/>
- </fileset>
- </move>
</target>
<!-- compile the base and thrift generated code and jar them -->
- <target name="dist" depends="prepare,thriftbuild">
- <echo>Building libfb303.jar .... </echo>
- <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on">
+ <target name="dist" depends="init,generate">
+ <echo message="Building ${fb303.final.name}.jar"/>
+ <javac destdir="${build.classes.dir}" debug="on">
<classpath>
- <pathelement location="${thrift_lib}"/>
- <fileset dir="../../lib/java/build/ivy/lib">
- <include name="*.jar" />
+ <pathelement location="${thrift.java.libthrift}"/>
+ <fileset dir="${thrift.root}/lib/java/build/lib">
+ <include name="*.jar"/>
</fileset>
</classpath>
- <include name="*.java"/>
- <include name="${build.dir}/gen-java/com/facebook/fb303"/>
+ <src path="${src}"/>
+ <src path="${gen}"/>
+ <include name="**/*.java"/>
</javac>
- <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}">
+ <jar jarfile="${build.dir}/${fb303.final.name}.jar" basedir="${build.classes.dir}">
</jar>
</target>
<!-- copy the build jar to the distribution library directory -->
<target name="install" depends="dist">
- <copy todir="${dist.lib.dir}">
- <fileset dir="${build.lib.dir}" includes="libfb303.jar"/>
+ <copy todir="${install.path}">
+ <fileset dir="${build.lib.dir}" includes="*.jar"/>
+ <fileset dir="${build.lib.dir}" includes="${fb303.final.name}.jar"/>
</copy>
</target>
<target name="clean">
- <echo>Cleaning old stuff .... </echo>
- <delete dir="${build.dir}/classes/com"/>
- <delete dir="${build.dir}/lib"/>
<delete dir="${build.dir}"/>
+ <delete dir="${gen}"/>
+ </target>
+
+ <target name="mvn.ant.tasks.download" depends="setup.init" unless="mvn.ant.tasks.found">
+ <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/>
+ </target>
+
+ <target name="mvn.ant.tasks.check">
+ <condition property="mvn.ant.tasks.found">
+ <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/>
+ </condition>
+ </target>
+
+ <target name="mvn.init" depends="mvn.ant.tasks.download" unless="mvn.finished">
+ <echo message="${mvn.ant.task.jar}"/>
+ <!-- Download mvn ant tasks, download dependencies, and setup pom file -->
+ <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${build.tools.dir}/${mvn.ant.task.jar}"/>
+
+ <!-- remote repositories used to download dependencies from -->
+ <artifact:remoteRepository id="central" url="${mvn.repo}"/>
+ <artifact:remoteRepository id="apache" url="${apache.repo}"/>
+
+ <!-- Pom file information -->
+ <artifact:pom id="pom"
+ groupId="${thrift.groupid}"
+ artifactId="${fb303.artifactid}"
+ version="${version}"
+ url="http://thrift.apache.org"
+ name="Apache Thrift"
+ description="Thrift is a software framework for scalable cross-language services development."
+ packaging="pom"
+ >
+ <remoteRepository refid="central"/>
+ <remoteRepository refid="apache"/>
+ <license name="The Apache Software License, Version 2.0" url="${license}"/>
+ <scm connection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/"
+ developerConnection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/"
+ url="http://svn.apache.org/viewcvs.cgi/thrift"
+ />
+ <!-- Thrift Developers -->
+ <developer id="mcslee" name="Mark Slee"/>
+ <developer id="dreiss" name="David Reiss"/>
+ <developer id="aditya" name="Aditya Agarwal"/>
+ <developer id="marck" name="Marc Kwiatkowski"/>
+ <developer id="jwang" name="James Wang"/>
+ <developer id="cpiro" name="Chris Piro"/>
+ <developer id="bmaurer" name="Ben Maurer"/>
+ <developer id="kclark" name="Kevin Clark"/>
+ <developer id="jake" name="Jake Luciani"/>
+ <developer id="bryanduxbury" name="Bryan Duxbury"/>
+ <developer id="esteve" name="Esteve Fernandez"/>
+ <developer id="todd" name="Todd Lipcon"/>
+ <developer id="geechorama" name="Andrew McGeachie"/>
+ <developer id="molinaro" name="Anthony Molinaro"/>
+ <developer id="roger" name="Roger Meier"/>
+ <developer id="jfarrell" name="Jake Farrell"/>
+
+ <!-- Thrift dependencies list -->
+ <dependency groupId="org.apache.thrift" artifactId="libthrift" version="${version}"/>
+ </artifact:pom>
+
+ <!-- Generate the pom file -->
+ <artifact:writepom pomRefId="pom" file="${fb303.pom.xml}"/>
+
+ <property name="mvn.finished" value="true"/>
+ </target>
+
+ <macrodef name="signAndDeploy">
+ <!-- Sign and deploy jars to apache repo -->
+ <attribute name="file"/>
+ <attribute name="classifier" default=""/>
+ <attribute name="packaging" default="jar"/>
+ <sequential>
+ <artifact:mvn fork="true">
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/>
+ <arg value="-DrepositoryId=${maven-repository-id}"/>
+ <arg value="-Durl=${maven-repository-url}"/>
+ <arg value="-DpomFile=${fb303.pom.xml}"/>
+ <arg value="-Dfile=@{file}"/>
+ <arg value="-Dclassifier=@{classifier}"/>
+ <arg value="-Dpackaging=@{packaging}"/>
+ <arg value="-Pgpg"/>
+ </artifact:mvn>
+ </sequential>
+ </macrodef>
+
+ <target name="publish" depends="clean,dist">
+ <!-- Compile, packages and then send release to apache maven repo -->
+ <!-- run with: ant -Drelease=true publish-->
+ <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier=""/>
+ <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier=""/>
</target>
</project>
diff --git a/contrib/fb303/java/FacebookBase.java b/contrib/fb303/java/src/FacebookBase.java
index f84e98bb1..f84e98bb1 100644
--- a/contrib/fb303/java/FacebookBase.java
+++ b/contrib/fb303/java/src/FacebookBase.java