flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cza...@apache.org
Subject git commit: [flex-flexunit] [refs/heads/develop] - FLEX-33572 patch by Yennick Trevels and added a downloads.xml for thirdparty downloads
Date Tue, 03 Sep 2013 18:22:31 GMT
Updated Branches:
  refs/heads/develop 6b1ac4aa4 -> 82eb1b9df


FLEX-33572 patch by Yennick Trevels and added a downloads.xml for thirdparty downloads


Project: http://git-wip-us.apache.org/repos/asf/flex-flexunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-flexunit/commit/82eb1b9d
Tree: http://git-wip-us.apache.org/repos/asf/flex-flexunit/tree/82eb1b9d
Diff: http://git-wip-us.apache.org/repos/asf/flex-flexunit/diff/82eb1b9d

Branch: refs/heads/develop
Commit: 82eb1b9dffbce9ca3a4c4432299b8e1bea1425ac
Parents: 6b1ac4a
Author: cyrillzadra <cyrill.zadra@gmail.com>
Authored: Tue Sep 3 22:20:47 2013 +0400
Committer: cyrillzadra <cyrill.zadra@gmail.com>
Committed: Tue Sep 3 22:20:47 2013 +0400

----------------------------------------------------------------------
 .gitignore                           |   4 +
 FlexUnit4/build.xml                  |  47 +++++-----
 FlexUnit4AirCIListener/build.xml     |  21 +----
 FlexUnit4AntTasks/build.xml          |  22 +----
 FlexUnit4CIListener/build.xml        |  21 +----
 FlexUnit4FlexCoverListener/build.xml |  21 +----
 FlexUnit4FluintExtensions/build.xml  |  21 +----
 FlexUnit4UIListener/build.xml        |  23 +----
 build.xml                            |  13 ++-
 downloads.xml                        | 150 ++++++++++++++++++++++++++++++
 utils.xml                            | 136 ++++++++++++++++-----------
 11 files changed, 298 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1abd6d2..b9f0d4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@ FlexUnit4FluintExtensions/libs/*
 FlexUnit4CIListener/target/*
 FlexUnit4CIListener/libs/*
 FlexUnit4AirCIListener/bin/*
+FlexUnit4AirCIListener/target/*
+FlexUnit4AirCIListener/libs/*
 FlexUnit4FlexCoverListener/bin/*
 FlexUnit4FlexCoverListener/libs/*
 FlexUnit4FlexCoverListener/target/*
@@ -24,4 +26,6 @@ FlexUnit4UIListener/libs/*
 FlexUnit4UIListener/target/*
 .metadata
 .actionScriptProperties
+.idea
+*.iml
 */.settings
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4/build.xml b/FlexUnit4/build.xml
index de4b462..ff580c9 100644
--- a/FlexUnit4/build.xml
+++ b/FlexUnit4/build.xml
@@ -191,29 +191,28 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="flexunit*.swc" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}-" to="-" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
-         todir="${sonatype.loc}" 
-         pomTemplate="${basedir}/../pom.template" 
-         artifact="${build.artifactId}" 
-         type="${build.packaging}" 
-         name="${build.deploy.name}" 
-         version="${build.version}" 
-         description="${build.deploy.description}">
-         <includes>
-            <include name="flexunit*.swc" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      <!-- deploy flex swc to sonatype -->
+      <sonatype-deploy
+           binaryFile="${bin.loc}/${build.finalName.flex}.${build.packaging}"
+           todir="${sonatype.loc}/flex"
+           pomTemplate="${basedir}/../pom.template"
+           artifact="${build.artifactId}-flex"
+           type="${build.packaging}"
+           name="${build.deploy.name}"
+           version="${build.version}"
+           description="${build.deploy.description}">
+      </sonatype-deploy>
+
+       <!-- deploy as3 swc to sonatype -->
+       <sonatype-deploy
+           binaryFile="${bin.loc}/${build.finalName.as3}.${build.packaging}"
+           todir="${sonatype.loc}/as3"
+           pomTemplate="${basedir}/../pom.template"
+           artifact="${build.artifactId}-as3"
+           type="${build.packaging}"
+           name="${build.deploy.name}"
+           version="${build.version}"
+           description="${build.deploy.description}">
+       </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4AirCIListener/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4AirCIListener/build.xml b/FlexUnit4AirCIListener/build.xml
index c92da2d..24f4e3d 100644
--- a/FlexUnit4AirCIListener/build.xml
+++ b/FlexUnit4AirCIListener/build.xml
@@ -106,18 +106,9 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="*.swc" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}-" to="-" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
+      <!-- deploy to sonatype repo -->
+      <sonatype-deploy
+         binaryFile="${bin.loc}/${build.finalName}.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -125,10 +116,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-         <includes>
-            <include name="*.swc" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4AntTasks/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4AntTasks/build.xml b/FlexUnit4AntTasks/build.xml
index 7bb004e..1a4773a 100644
--- a/FlexUnit4AntTasks/build.xml
+++ b/FlexUnit4AntTasks/build.xml
@@ -94,18 +94,10 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="*.jar" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}" to="" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
+      <sonatype-deploy
+         binaryFile="${dist.loc}/${build.finalName}.${build.packaging}"
+         sourcesFile="${dist.loc}/${build.finalName}-sources.${build.packaging}"
+         docFile="${dist.loc}/${build.finalName}-javadoc.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -113,10 +105,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-         <includes>
-            <include name="*.jar" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4CIListener/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4CIListener/build.xml b/FlexUnit4CIListener/build.xml
index 73b8ad0..137760c 100644
--- a/FlexUnit4CIListener/build.xml
+++ b/FlexUnit4CIListener/build.xml
@@ -100,18 +100,9 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="*.swc" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}-" to="-" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
+      <!-- deploy to sonatype repo -->
+      <sonatype-deploy
+         binaryFile="${bin.loc}/${build.finalName}.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -119,10 +110,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-         <includes>
-            <include name="*.swc" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4FlexCoverListener/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4FlexCoverListener/build.xml b/FlexUnit4FlexCoverListener/build.xml
index daee11b..ef23325 100644
--- a/FlexUnit4FlexCoverListener/build.xml
+++ b/FlexUnit4FlexCoverListener/build.xml
@@ -113,18 +113,9 @@
 	</target>
 
 	<target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-		<!-- Copy artifacts w/o build number for use with sonatype -->
-		<copy todir="${sonatype.loc}">
-			<fileset dir="${dist.loc}">
-				<include name="*.swc" />
-			</fileset>
-			<filtermapper>
-				<replacestring from="-${build.number}-" to="-" />
-			</filtermapper>
-		</copy>
-
-		<!-- prepare sonatype bundle -->
-		<sonatype-bundle dir="${sonatype.loc}" 
+      <!-- deploy to sonatype repo -->
+      <sonatype-deploy
+         binaryFile="${bin.loc}/${build.finalName}.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -132,10 +123,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-			<includes>
-				<include name="*.swc" />
-				<include name="pom.xml" />
-			</includes>
-		</sonatype-bundle>
+	  </sonatype-deploy>
 	</target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4FluintExtensions/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4FluintExtensions/build.xml b/FlexUnit4FluintExtensions/build.xml
index d1aeba9..a73d11e 100644
--- a/FlexUnit4FluintExtensions/build.xml
+++ b/FlexUnit4FluintExtensions/build.xml
@@ -107,18 +107,9 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="*.swc" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}-" to="-" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
+      <!-- deploy to sonatype repo -->
+      <sonatype-deploy
+         binaryFile="${bin.loc}/${build.finalName}.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -126,10 +117,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-         <includes>
-            <include name="*.swc" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/FlexUnit4UIListener/build.xml
----------------------------------------------------------------------
diff --git a/FlexUnit4UIListener/build.xml b/FlexUnit4UIListener/build.xml
index e24c618..1c71479 100644
--- a/FlexUnit4UIListener/build.xml
+++ b/FlexUnit4UIListener/build.xml
@@ -117,7 +117,7 @@
          <jvmarg value="-Xmx256M" />
          <arg line="+flexlib '${FLEX_HOME}/frameworks'" />
          <arg line="-compatibility-version=3.0.0" />
-         <arg line="-namespace http://www.adobe.com/2006/mxml ${FLEX_HOME}/frameworks/mxml-manifest.xml"
/>
+         <arg line="-namespace http://www.adobe.com/2006/mxml '${FLEX_HOME}/frameworks/mxml-manifest.xml'"
/>
          <arg line="-namespace ${build.namespace} ${src.loc}/FlexUnit4UIRunner-manifest.xml"
/>
          <arg line="-include-namespaces ${build.namespace}" />
          <arg line="-include-classes ${src.class-list}" />
@@ -160,18 +160,9 @@
    </target>
    
    <target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to
work.">
-      <!-- Copy artifacts w/o build number for use with sonatype -->
-   	  <copy todir="${sonatype.loc}">
-   	  	<fileset dir="${dist.loc}">
-   	  	   <include name="*.swc" />
-   	  	</fileset>
-   	  	<filtermapper>
-      	  <replacestring from="-${build.number}-" to="-" />
-		</filtermapper>
-   	  </copy>
-   
-      <!-- prepare sonatype bundle -->
-      <sonatype-bundle dir="${sonatype.loc}" 
+      <!-- deploy to sonatype repo -->
+      <sonatype-deploy
+         binaryFile="${bin.loc}/${build.finalName}.${build.packaging}"
          todir="${sonatype.loc}" 
          pomTemplate="${basedir}/../pom.template" 
          artifact="${build.artifactId}" 
@@ -179,10 +170,6 @@
          name="${build.deploy.name}" 
          version="${build.version}" 
          description="${build.deploy.description}">
-         <includes>
-            <include name="*.swc" />
-            <include name="pom.xml" />
-         </includes>
-      </sonatype-bundle>
+      </sonatype-deploy>
    </target>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index fe36267..0e1ac56 100644
--- a/build.xml
+++ b/build.xml
@@ -49,6 +49,13 @@ to contribute to our CI process.
    <property name="turnkey.loc" location="${basedir}/FlexUnit4TurnKey" />
    <property name="sampleCI.loc" location="${basedir}/FlexUnit4SampleCIProject" />
    
+   <!-- xml namespace which is used to deploy the artifacts with maven -->
+   <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+            uri="antlib:org.apache.maven.artifact.ant"
+            classpath="lib/maven-ant-tasks-2.1.3.jar"/>
+   <taskdef resource="net/sf/antcontrib/antcontrib.properties"
+            classpath="lib/ant-contrib-1.0b3.jar"/>
+   
     <!--
         Optional jars but should be in place for a real release build.
 
@@ -82,6 +89,10 @@ to contribute to our CI process.
          </fileset>
       </delete>
    </target>
+   
+    <target name="prebuild">
+		<ant antfile="${basedir}/downloads.xml" dir="${basedir}" />
+    </target>
 
    <!-- Builds the FlexUnit4AntTasks project -->
    <target name="anttasks">
@@ -238,7 +249,7 @@ to contribute to our CI process.
       </zip>
    </target>
    
-   <target name="sonatype" description="Target used to generate bundles for deployment
to Sonatype.">
+   <target name="sonatype" depends="prebuild" description="Target used to generate bundles
for deployment to Sonatype.">
       <ant dir="${anttasks.loc}" target="deploy" inheritall="false">
          <propertyset>
             <propertyref prefix="build" />

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/downloads.xml
----------------------------------------------------------------------
diff --git a/downloads.xml b/downloads.xml
new file mode 100644
index 0000000..4890a8b
--- /dev/null
+++ b/downloads.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file 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
+
+  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="downloads" default="main" basedir=".">
+	
+    <pathconvert property="compiler.tests" dirsep="/">
+        <path location="${basedir}"/>
+    </pathconvert>
+
+    <property name="lib.dir" value="${compiler.tests}/lib"/>
+    
+	<property name="download.dir" value="${compiler.tests}/in"/>
+    
+	<!-- 
+	   Notes:
+	       For Apache, the JARS must be removed from the repository.
+	       
+	       Licenses:
+            Maven Ant Tasks (2.1.3) - ?
+			Ant Contrib (1.0b3) - ?
+	-->
+		     
+    <!-- 
+        Because the downloads requires a network connection and the JARs don't change very
often, 
+        they are each downloaded only if they don't already exist. 
+    -->
+    
+	<target name="main" depends="prepare, maven-ant-tasks-jar, ant-contrib-jar"
+		    description="Downloads all the required thirdparty JARs"/>
+
+    <target name="prepare" >
+        <mkdir dir="${lib.dir}" />
+    </target>
+    
+    <!--
+		Cleanup
+	-->
+	
+    <target name="clean" 
+            description="Removes thirdparty downloads.">
+        <delete includeEmptyDirs="true" failonerror="false">
+            <fileset dir="${download.dir}">
+                <include name="junit*/**"/>
+				<include name="ant*/**"/>
+				<include name="dom4j*/**"/>
+				<include name="jaxen*/**"/>
+            </fileset>
+        </delete>
+    </target>
+    
+    <!--
+	    Download thirdparty JARs    
+	-->
+
+    <!--
+        Download a jar file and optionally verify the checksum.
+        If the checksum fails, this script fails.
+        
+        Params are:
+            srcUrl
+            srcJarFile
+            destJarFile
+            [md5]
+    -->
+    <target name="download-jar" 
+            description="Downloads jar, and optionally verifies checksum.">          
         
+        <get src="${srcUrl}/${srcJarFile}" dest="${destJarFile}"/>
+        <checksum file="${destJarFile}" algorithm="MD5" property="${we.failed}"/>
+        <antcall target="fail-with-message">
+            <param name="message" value="Checksum mismatch for ${destJarFile}"/>
+        </antcall>
+    </target>
+
+    <target name="fail-with-message" if="we.failed" 
+            description="Conditionally fails with the specified message">            
   
+        <fail message="${message}"/>
+    </target>
+        
+    <!--
+        junit
+    -->
+    
+    <target name="maven-ant-tasks-jar-check" description="Checks if Maven Ant Tasks JAR
exists.">
+    	<condition property="maven.ant.tasks.jar.exists">
+    	    <and>
+    	        <available file="${lib.dir}/maven-ant-tasks-2.1.3.jar"/>
+    	    </and>
+        </condition>
+    </target>
+    
+    <target name="maven-ant-tasks-jar" depends="maven-ant-tasks-jar-check" unless="maven.ant.tasks.jar.exists"
+            description="Copies the Maven Ant Tasks JAR to the lib directory.">
+        <echo message="Obtaining lib/maven-ant-tasks-2.1.3.jar"/>
+        <antcall target="maven-ant-tasks-download-jar"/>
+    </target>
+    
+    <target name="maven-ant-tasks-download-jar" depends="maven-ant-tasks-jar-check" unless="maven.ant.tasks.jar.exists"
+            description="Downloads the Maven Ant Tasks jar.">
+        <antcall target="download-jar">
+            <param name="srcUrl" value="http://search.maven.org/remotecontent?filepath=org/apache/maven/maven-ant-tasks/2.1.3"/>
+            <param name="srcJarFile" value="maven-ant-tasks-2.1.3.jar"/>
+            <param name="destJarFile" value="${lib.dir}/maven-ant-tasks-2.1.3.jar"/>
+        </antcall>
+    </target>
+	
+	<!--
+        ant contrib
+    -->
+    
+    <target name="ant-contrib-check" description="Checks if AntContrib JAR exists.">
+    	<condition property="ant.contrib.jar.exists">
+    	    <and>
+    	        <available file="${lib.dir}/ant-contrib-1.0b3.jar"/>
+    	    </and>
+        </condition>
+    </target>
+    
+    <target name="ant-contrib-jar" depends="ant-contrib-check" unless="ant.contrib.jar.exists"
+            description="Copies the Ant Contrib JAR to the lib directory.">
+        <echo message="Obtaining lib/ant-contrib-1.0b3.jar"/>
+        <antcall target="ant-contrib-download-jar"/>
+    </target>
+    
+    <target name="ant-contrib-download-jar" depends="ant-contrib-check" unless="ant.contrib.jar.exists"
+            description="Downloads the Ant Contrib jar.">
+        <antcall target="download-jar">
+            <param name="srcUrl" value="http://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3"/>
+            <param name="srcJarFile" value="ant-contrib-1.0b3.jar"/>
+            <param name="destJarFile" value="${lib.dir}/ant-contrib-1.0b3.jar"/>
+        </antcall>
+    </target>
+	
+</project>

http://git-wip-us.apache.org/repos/asf/flex-flexunit/blob/82eb1b9d/utils.xml
----------------------------------------------------------------------
diff --git a/utils.xml b/utils.xml
index b4915cb..803fe33 100644
--- a/utils.xml
+++ b/utils.xml
@@ -15,58 +15,88 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project>
-   <macrodef name="gpg">
-      <attribute name="todir" />
-      <attribute name="file" />
-      <sequential>
-         <exec executable="gpg" dir="@{todir}">
-            <arg line="-ab @{file}" />
-         </exec>
-      </sequential>
-   </macrodef>
-   
-   <macrodef name="sonatype-bundle">
-      <attribute name="dir" />
-      <attribute name="todir" />
-      <attribute name="pomTemplate" />
-      <attribute name="artifact" />
-      <attribute name="type" />
-      <attribute name="name" />
-      <attribute name="version" />
-      <attribute name="description" />
-      <element name="includes" />
-      
-      <sequential>
-         <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+<project xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+    <!-- xml namespace which is used to deploy the artifacts with maven -->
+    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+             uri="antlib:org.apache.maven.artifact.ant"
+             classpath="lib/maven-ant-tasks-2.1.3.jar"/>
+
+    <taskdef resource="net/sf/antcontrib/antcontrib.properties"
+             classpath="lib/ant-contrib-0.6.jar"/>
+
+    <!-- defined maven snapshots and staging repository id and url -->
+    <property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
+    <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/"
/>
+
+    <macrodef name="sonatype-deploy">
+        <attribute name="binaryFile"/>
+        <attribute name="sourcesFile" default=""/>
+        <attribute name="docFile" default=""/>
+        <attribute name="todir"/>
+        <attribute name="pomTemplate"/>
+        <attribute name="artifact"/>
+        <attribute name="type"/>
+        <attribute name="name"/>
+        <attribute name="version"/>
+        <attribute name="description"/>
+
+        <sequential>
+            <!-- Create POM from template -->
+            <copy file="@{pomTemplate}" tofile="@{todir}/pom.xml"/>
+            <replace file="@{todir}/pom.xml">
+                <replacefilter token="@ARTIFACT@" value="@{artifact}"/>
+                <replacefilter token="@TYPE@" value="@{type}"/>
+                <replacefilter token="@NAME@" value="@{name}"/>
+                <replacefilter token="@VERSION@" value="@{version}"/>
+                <replacefilter token="@DESCRIPTION@" value="@{description}"/>
+            </replace>
             
-         <!-- Create POM from template -->
-         <copy file="@{pomTemplate}" tofile="@{todir}/pom.xml" />
-         <replace file="@{todir}/pom.xml">
-            <replacefilter token="@ARTIFACT@" value="@{artifact}" />
-            <replacefilter token="@TYPE@" value="@{type}" />
-            <replacefilter token="@NAME@" value="@{name}" />
-            <replacefilter token="@VERSION@" value="@{version}" />
-            <replacefilter token="@DESCRIPTION@" value="@{description}" />
-         </replace>
-      
-         <!-- Sign all files using GPG, assumes GPG is installed and configured -->
-         <for param="fileToSign">
-            <fileset dir="@{todir}">
-               <includes />
-            </fileset>
-            <sequential>
-               <gpg todir="@{todir}" file="@{fileToSign}" />
-            </sequential>
-         </for>
-      
-         <!-- Zip into bundle for manual upload -->
-         <zip destfile="@{todir}/sonatype-@{artifact}-@{version}.zip">
-            <zipfileset dir="@{todir}">
-               <includes />
-               <include name="*.asc" />
-            </zipfileset>
-         </zip>
-      </sequential>
-   </macrodef>
+            <copy file="@{binaryFile}" tofile="@{todir}/@{artifact}-@{version}.@{type}"
/>
+            <if>
+                <equals arg1="@{type}" arg2="jar" />
+                <then>
+                    <copy file="@{sourcesFile}" tofile="@{todir}/@{artifact}-@{version}-sources.@{type}"
/>
+                    <copy file="@{docFile}" tofile="@{todir}/@{artifact}-@{version}-javadoc.@{type}"
/>
+                </then>
+            </if>
+
+            <!-- sign and deploy the main artifact -->
+            <artifact:mvn>
+                <artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
+                <artifact:arg value="-Durl=${maven-staging-repository-url}"/>
+                <artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
+                <artifact:arg value="-DpomFile=@{todir}/pom.xml"/>
+                <artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}.@{type}"/>
+                <artifact:arg value="-Pgpg"/>
+            </artifact:mvn>
+
+            <if>
+                <equals arg1="@{type}" arg2="jar" />
+                <then>
+                    <!-- sign and deploy the sources artifact -->
+                    <artifact:mvn>
+                        <artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
+                        <artifact:arg value="-Durl=${maven-staging-repository-url}"/>
+                        <artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
+                        <artifact:arg value="-DpomFile=@{todir}/pom.xml"/>
+                        <artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}-sources.@{type}"/>
+                        <artifact:arg value="-Dclassifier=sources"/>
+                        <artifact:arg value="-Pgpg"/>
+                    </artifact:mvn>
+
+                    <!-- sign and deploy the javadoc artifact -->
+                    <artifact:mvn>
+                        <artifact:arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
+                        <artifact:arg value="-Durl=${maven-staging-repository-url}"/>
+                        <artifact:arg value="-DrepositoryId=${maven-staging-repository-id}"/>
+                        <artifact:arg value="-DpomFile=@{todir}/pom.xml"/>
+                        <artifact:arg value="-Dfile=@{todir}/@{artifact}-@{version}-javadoc.@{type}"/>
+                        <artifact:arg value="-Dclassifier=javadoc"/>
+                        <artifact:arg value="-Pgpg"/>
+                    </artifact:mvn>
+                </then>
+            </if>
+        </sequential>
+    </macrodef>
 </project>
\ No newline at end of file


Mime
View raw message