blob: cc91b76c0173a59c9e0f850f8d1482557c9f3f69 [file] [log] [blame]
<!--/*******************************************************************************
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
* Ant naming conventions:
* - regardless of the actual OS platform,'/' is the directory separator
* (Ant will convert as appropriate).
* - multi-word properties use periods '.'
* - multi-word targets use hyphens '-'
* - multi-word macros use underscores '_'
* - multi-word macro attributes are concatinated
* e.g. 'runpathref'
* - multi-word tasks (taskdef) names are concatinated
* e.g. 'validateconnection'
* - OS environment variables are in ALLCAPS and have 'env' as a prefix
* e.g. ${env.XXX}.
* - Ant properties are lower case.
*
* Contributors:
* mmeswani - initial API and implementation (checked in by tware)
* egwin - updated variables as they have changed in the rest of the system
* updated svnversion to not break build, and default if exec fails
#******************************************************************************/-->
<!-- Variables Needed:
* release.version - need three tokens: Major.Minor.Service
* build.date - in format YYYYMMDD
* build.type - should be set to "SNAPSHOT, "M##", or "RELEASE"
*
*********************************************************************************-->
<project name="Upload EclipseLink artifacts to Maven repository" basedir="." xmlns:artifact="urn:maven-artifact-ant" default="upload-maven-all">
<path id="maven-ant-tasks.classpath" path="${build.deps.dir}/mavenant/maven-ant-tasks-2.0.8.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
classpathref="maven-ant-tasks.classpath" />
<!-- The repository where maven artifacts will be uploaded -->
<artifact:remoteRepository id="eclipselink.repository" url="file:///home/data/httpd/download.eclipse.org/rt/eclipselink/maven.repo" />
<target name = "upload-maven-init">
<fail message="Cannot upload to Maven without a release.version defined!" unless="release.version"/>
<fail message="Cannot upload to Maven without a build.date defined!" unless="build.date"/>
<fail message="Cannot upload to Maven without a build.type defined!" unless="build.type"/>
<!-- Get the subversion version for current working copy. A freshly -->
<!-- checked out copy of workspace is guaranteed to not have mixed -->
<!-- revisions -->
<exec outputproperty="svn.revision"
failonerror="false"
failifexecutionfails="false"
errorproperty="svnversion.failed"
executable="svnversion">
<arg line="."/>
</exec>
<property name="svn.revision" value="NA"/>
<!-- fail message="Cannot upload to Maven a build with an unknown revision!" if="svnversion.failed"/ -->
<!-- Set version.string appropriately depending upon build.type and if svn -->
<!-- is present. variable should only be used for uploaded filenames -->
<!-- or manifest entries. -->
<condition property="version.qualifier" value="qualifier" else="v${build.date}-r${svn.revision}">
<equals arg1="${svn.revision}" arg2="NA"/>
</condition>
<property name="version.string" value="${release.version}.${version.qualifier}"/>
<!-- Set maven.version appropriately depending upon ${build.type}. -->
<!-- variable should only be used for maven version element in POM. -->
<condition property="maven.version" value="${release.version}-${build.type}">
<equals arg1="${build.type}" arg2="SNAPSHOT"/>
</condition>
<condition property="maven.version" value="${release.version}">
<equals arg1="${build.type}" arg2="RELEASE"/>
</condition>
<property name="maven.version" value="${release.version}-${build.type}"/>
<echo message="release.version: ${release.version}"/>
<echo message="build.date: ${build.date}"/>
<echo message="build.type: ${build.type}"/>
<echo message="svn.revision: ${svn.revision}"/>
<echo message="version.string: ${version.string}"/>
<echo message="maven.version: ${maven.version}"/>
</target>
<target name = "upload-maven-all" depends = "upload-maven-init">
<!-- call upload for each artifact we want to upload -->
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.core"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.core.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.core.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink Core"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.jpa"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.jpa.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.jpa.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink JPA"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.equinox"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.equinox.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.equinox.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink JPA Equinox Fragment"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.weaving"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.weaving.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.weaving.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink JPA Weaving for Equinox Fragment"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.moxy"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.moxy.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.moxy.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink Moxy"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.sdo"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.sdo.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.sdo.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink SDO"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.oracle"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.oracle.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.oracle.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink Oracle Extensions"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.antlr"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.antlr.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.antlr.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink ANTLR"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.asm"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.asm.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.asm.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink ASM"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="org.eclipse.persistence.dbws"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.plugins}/${eclipselink.dbws.bndl.prefix}_${version.string}.jar"/>
<param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.dbws.bndl.prefix}.source_${version.string}.jar"/>
<param name="artifactName" value="EclipseLink DBWS"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="eclipselink"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.jar.name}"/>
<param name="artifactSrc" value="${eclipselink.src.install.prefix}${eclipselink.zip.suffix}"/>
<param name="artifactName" value="EclipseLink"/>
</antcall>
<antcall target="upload-artifact">
<param name="groupId" value="org.eclipse.persistence"/>
<param name="artifactId" value="javax.persistence"/>
<param name="artifactVersion" value="${maven.version}"/>
<param name="artifact" value="${eclipselink.jpa.base}/${plugins.dir}/javax.persistence_1.99.0.v200906021518.jar"/>
<param name="artifactSrc" value="${eclipselink.jpa.base}/${plugins.dir}/javax.persistence.source_1.99.0.v200906021518.jar"/>
<param name="artifactName" value="Javax Persistence 1.99.0"/>
</antcall>
</target>
<!-- Uploads a single artifact to maven repository -->
<target name="upload-artifact" >
<!-- Copy pom.template to pom.xml filtering various properties -->
<copy file="pom.xml.template" tofile="pom.xml" overwrite="true">
<filterset>
<filter token="groupId" value="${groupId}"/>
<filter token="version" value="${artifactVersion}"/>
<filter token="svn.revision" value="${svn.revision}"/>
<filter token="artifactId" value="${artifactId}"/>
<filter token="artifactName" value="${artifactName}"/>
</filterset>
</copy>
<!-- Delploy the jar to maven repository along with sources -->
<artifact:pom id="maven.project" file="pom.xml" />
<artifact:deploy file="${artifact}">
<remoteRepository refid="eclipselink.repository"/>
<pom refid="maven.project"/>
<artifact:attach file="${artifactSrc}" classifier="sources"/>
</artifact:deploy>
<!-- cleanup -->
<delete file="pom.xml"/>
</target>
</project>