| <!--/******************************************************************************* |
| * 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 concatenated |
| * e.g. 'runpathref' |
| * - multi-word tasks (taskdef) names are concatenated |
| * 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="Upload2Maven" 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" /> |
| |
| <!-- root of "download dir" defined so can be overridden for testing --> |
| <property name="eclipselink.root.download.dir" value="home/data/httpd/download.eclipse.org/rt/eclipselink"/> |
| <!-- "maven dir" defined for later use ensuring only single upload occurs --> |
| <property name="maven.repo.dir" value="${eclipselink.root.download.dir}/maven.repo"/> |
| <!-- The repository where maven artifacts will be uploaded --> |
| <artifact:remoteRepository id="eclipselink.repository" url="file:///${maven.repo.dir}" /> |
| |
| <target name="upload-maven-all" depends="upload-eclipselink"/> |
| |
| <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.string" value="${release.version}.qualifier" |
| else="${release.version}.v${build.date}-r${svn.revision}"> |
| <equals arg1="${svn.revision}" arg2="NA"/> |
| </condition> |
| |
| <!-- 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}"/> |
| |
| <!-- Setup static dependency definitions --> |
| <!-- Would be nice to setup in the beginning, but the library definitions need version.string defined --> |
| |
| <!-- These need to be used in order --> |
| <property name="deps.head" value="<dependencies>"/> |
| <property name="dep.grp" value="<dependency><groupId>"/> |
| <property name="dep.art" value="</groupId><artifactId>"/> |
| <property name="dep.ver" value="</artifactId><version>"/> |
| <property name="dep.type" value="</version><type>"/> |
| <property name="dep.scope" value="</type><scope>"/> |
| <property name="dep.opt" value="</scope><optional>"/> |
| <property name="dep.foot" value="</optional></dependency>"/> |
| <property name="deps.foot" value="</dependencies>"/> |
| |
| <!-- These use above, in order, to define a single library for an artifact dependency --> |
| <property name="dep.antlr" value="${dep.grp}org.eclipse.persistence${dep.art}org.eclipse.persistence.antlr${dep.ver}${maven.version}${dep.type}jar${dep.scope}compile${dep.opt}false${dep.foot}"/> |
| <property name="dep.asm" value="${dep.grp}org.eclipse.persistence${dep.art}org.eclipse.persistence.asm${dep.ver}${maven.version}${dep.type}jar${dep.scope}compile${dep.opt}false${dep.foot}"/> |
| <property name="dep.core" value="${dep.grp}org.eclipse.persistence${dep.art}org.eclipse.persistence.core${dep.ver}${maven.version}${dep.type}jar${dep.scope}compile${dep.opt}false${dep.foot}"/> |
| <property name="dep.moxy" value="${dep.grp}org.eclipse.persistence${dep.art}org.eclipse.persistence.moxy${dep.ver}${maven.version}${dep.type}jar${dep.scope}compile${dep.opt}false${dep.foot}"/> |
| |
| <!-- These define the dependency block for a given artifact --> |
| <!-- * JPA does have a dependency upon javax.persistence, but it is left unstated because while 2.0 functionality --> |
| <!-- depends upon javax.persistence_2.0.x jpa 1.0 functionality can run with just javax.persistence_1.0 --> |
| <!-- * The modelgen processor is a jar containing a single data resource used by the compiler to establish a --> |
| <!-- canonical modelgen processor during compilation. It has no real dependencies, nor is anything really --> |
| <!-- dependant upon it, but it is needed for this compiler functionality to work. (think of it as a compiler --> |
| <!-- add-on). It will need to be downloaded independently for this feature (modelgen) to work. --> |
| <property name="core.dependencies" value="${deps.head}${dep.asm}${dep.antlr}${deps.foot}"/> |
| <property name="oracle.dependencies" value="${deps.head}${dep.asm}${dep.core}${deps.foot}"/> |
| <property name="jpa.dependencies" value="${deps.head}${dep.asm}${dep.core}${deps.foot}"/> |
| <property name="moxy.dependencies" value="${deps.head}${dep.core}${deps.foot}"/> |
| <property name="sdo.dependencies" value="${deps.head}${dep.moxy}${dep.core}${deps.foot}"/> |
| </target> |
| |
| <target name="upload-eclipselink" 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="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 (non-OSGi)"/> |
| <param name="dependencies" value=""/> |
| </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"/> |
| <param name="dependencies" value=""/> |
| </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"/> |
| <param name="dependencies" value=""/> |
| </antcall> |
| <antcall target="upload-artifact"> |
| <!-- eventually this will ship separately, comments for future use --> |
| <param name="groupId" value="org.eclipse.persistence"/> |
| <!-- param name="groupId" value="javax.persistence"/ --> |
| <param name="artifactId" value="javax.persistence"/> |
| <param name="artifactVersion" value="${maven.version}"/> |
| <!-- param name="artifactVersion" value="2.0-SNAPSHOT"/ --> |
| <param name="artifact" value="${eclipselink.jpa.base}/${plugins.dir}/javax.persistence_2.0_preview.jar"/> |
| <param name="artifactSrc" value="${eclipselink.jpa.base}/${plugins.dir}/javax.persistence.source_2.0_preview.jar"/> |
| <param name="artifactName" value="Javax Persistence 2.0 Preview"/> |
| <param name="dependencies" value=""/> |
| </antcall> |
| <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"/> |
| <param name="dependencies" value="${core.dependencies}"/> |
| </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.extension.oracle.bndl.prefix}_${version.string}.jar"/> |
| <param name="artifactSrc" value="${eclipselink.plugins}/${eclipselink.extension.oracle.bndl.prefix}.source_${version.string}.jar"/> |
| <param name="artifactName" value="EclipseLink Oracle Extensions"/> |
| <param name="dependencies" value="${oracle.dependencies}"/> |
| </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"/> |
| <param name="dependencies" value="${jpa.dependencies}"/> |
| </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"/> |
| <param name="dependencies" value="${moxy.dependencies}"/> |
| </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"/> |
| <param name="dependencies" value="${sdo.dependencies}"/> |
| </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}"/> |
| <filter token="dependencies" value="${dependencies}"/> |
| </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> |
| |