Thrift-1174: Publish as3 client implementation via Maven for use by flex-mojos users
Client: as3
Adds the ability to publish the as3 client to maven central repo along side the java and fb303 libs.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1125511 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/fb303/java/build.xml b/contrib/fb303/java/build.xml
index 62699a4..c96e4be 100755
--- a/contrib/fb303/java/build.xml
+++ b/contrib/fb303/java/build.xml
@@ -100,7 +100,7 @@
<delete dir="${gen}"/>
</target>
- <target name="mvn.ant.tasks.download" depends="setup.init" unless="mvn.ant.tasks.found">
+ <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" 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>
@@ -169,12 +169,13 @@
<attribute name="file"/>
<attribute name="classifier" default=""/>
<attribute name="packaging" default="jar"/>
+ <attribute name="pom" default=""/>
<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="-DpomFile=@{pom}"/>
<arg value="-Dfile=@{file}"/>
<arg value="-Dclassifier=@{classifier}"/>
<arg value="-Dpackaging=@{packaging}"/>
@@ -186,7 +187,7 @@
<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=""/>
+ <signAndDeploy file="${fb303.pom.xml}" packaging="pom" classifier="" pom="${fb303.pom.xml}"/>
+ <signAndDeploy file="${fb303.jar.file}" packaging="jar" classifier="" pom="${fb303.pom.xml}"/>
</target>
</project>
diff --git a/lib/as3/build.xml b/lib/as3/build.xml
index 1b7a544..aa523f0 100644
--- a/lib/as3/build.xml
+++ b/lib/as3/build.xml
@@ -7,60 +7,172 @@
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="libthrift" default="compile" basedir=".">
+ -->
+<project name="libthrift-as3" default="compile" basedir="."
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <property name="as3.artifactid" value="${ant.project.name}"/>
+
+ <property name="thrift.root" location="${basedir}/../../"/>
+ <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"/>
- <description>Thrift Build File</description>
+ <!-- inherit from the java build file for version and other properties -->
+ <property file="${thrift.java.dir}/build.properties" />
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <property environment="env"/>
- <property name="src" value="${basedir}/src" />
- <property name="build" value="${basedir}/build" />
+ <condition property="version" value="${thrift.version}">
+ <isset property="release"/>
+ </condition>
+ <property name="version" value="${thrift.version}-snapshot"/>
- <target name="checkFlexHome" unless="FLEX_HOME">
- <fail message='You must set the property FLEX_HOME with the path to your flex SDK, eg. ant -DFLEX_HOME="/Applications/Adobe Flex Builder 3/sdks/3.2.0"'/>
+ <property name="as3.final.name" value="${as3.artifactid}-${version}"/>
+
+ <property name="src" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+
+ <property name="as3.swc.file" location="${build.dir}/${as3.final.name}.swc"/>
+ <property name="as3.pom.xml" location="${build.dir}/${as3.final.name}.pom"/>
+
+ <target name="init" depends="setup.init,flex.init" unless="init.finished">
+ <property name="init.finished" value="true"/>
</target>
- <target name="compile" depends="checkFlexHome">
+ <target name="setup.init">
+ <tstamp/>
+ <mkdir dir="${build.dir}"/>
+ </target>
- <mkdir dir="${build}"/>
+ <target name="flex.check" unless="FLEX_HOME">
+ <fail message='You must set the FLEX_HOME property pointing to your flex SDK, eg. ant -DFLEX_HOME="/Applications/Adobe Flex Builder 3/sdks/3.2.0"'/>
+ </target>
+
+ <target name="flex.init" depends="flex.check" unless="flex.finished">
+ <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+ <property name="flex.finished" value="true"/>
+ </target>
- <!-- compc takes a list of classes separated by spaces, eg. "pkg.Class pkg.Class2"
- To generate this, we have to create an ant path, then convert it using
- pathconvert, removing the prefix with a map and removing the .as suffix using
- a mapper. From http://snippets.dzone.com/posts/show/3627.
- -->
- <path id="classesRaw">
+ <target name="compile" depends="init">
+ <path id="as.src.files">
<fileset dir="${src}/">
- <include name="**/*.as"/>
+ <include name="**/*.as"/>
</fileset>
</path>
<pathconvert
- property="classesClean"
+ property="as.src.classes"
pathsep=" "
dirsep="."
- refid="classesRaw">
+ refid="as.src.files"
+ >
<map from="${src}/" to=""/>
<mapper type="glob" from="*.as" to="*"/>
</pathconvert>
- <compc output="${build}/libthrift.swc" include-classes="${classesClean}">
+ <compc output="${as3.swc.file}" include-classes="${as.src.classes}">
<source-path path-element="${src}"/>
</compc>
-
</target>
<target name="clean">
- <delete dir="${build}" />
+ <delete dir="${build.dir}" />
</target>
+ <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" 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="${as3.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"/>
+ </artifact:pom>
+
+ <!-- Generate the pom file -->
+ <artifact:writepom pomRefId="pom" file="${as3.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"/>
+ <attribute name="pom" default=""/>
+ <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=@{pom}"/>
+ <arg value="-Dfile=@{file}"/>
+ <arg value="-Dclassifier=@{classifier}"/>
+ <arg value="-Dpackaging=@{packaging}"/>
+ <arg value="-Pgpg"/>
+ </artifact:mvn>
+ </sequential>
+ </macrodef>
+
+ <target name="publish" depends="clean,compile,mvn.init">
+ <!-- Compile, packages and then send release to apache maven repo -->
+ <!-- run with: ant -Drelease=true publish -->
+ <signAndDeploy file="${as3.pom.xml}" packaging="pom" classifier="" pom="${as3.pom.xml}"/>
+ <signAndDeploy file="${as3.swc.file}" packaging="swc" classifier="" pom="${as3.pom.xml}"/>
+ </target>
</project>
diff --git a/lib/java/build.xml b/lib/java/build.xml
index e7bf639..7ad5a49 100644
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -229,7 +229,7 @@
</exec>
</target>
- <target name="mvn.ant.tasks.download" depends="setup.init" unless="mvn.ant.tasks.found">
+ <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" 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>
@@ -321,12 +321,13 @@
<attribute name="file"/>
<attribute name="classifier" default=""/>
<attribute name="packaging" default="jar"/>
+ <attribute name="pom" default=""/>
<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=${pom.xml}"/>
+ <arg value="-DpomFile=@{pom}"/>
<arg value="-Dfile=@{file}"/>
<arg value="-Dclassifier=@{classifier}"/>
<arg value="-Dpackaging=@{packaging}"/>
@@ -338,9 +339,9 @@
<target name="publish" depends="clean,init,test,dist,javadoc,pack.src">
<!-- Compile, package, test and then send release to apache maven repo -->
<!-- run with: ant -Drelease=true publish-->
- <signAndDeploy file="${pom.xml}" packaging="pom" classifier=""/>
- <signAndDeploy file="${jar.file}" packaging="jar" classifier=""/>
- <signAndDeploy file="${javadoc.jar.file}" packaging="jar" classifier="javadoc"/>
- <signAndDeploy file="${source.tar.gz}" packaging="src" classifier="tar.gz"/>
+ <signAndDeploy file="${pom.xml}" packaging="pom" classifier="" pom="${pom.xml}"/>
+ <signAndDeploy file="${jar.file}" packaging="jar" classifier="" pom="${pom.xml}"/>
+ <signAndDeploy file="${javadoc.jar.file}" packaging="jar" classifier="javadoc" pom="${pom.xml}"/>
+ <signAndDeploy file="${source.tar.gz}" packaging="src" classifier="tar.gz" pom="${pom.xml}"/>
</target>
</project>