diff options
author | Robert Gemmell <robbie@apache.org> | 2012-05-06 22:59:04 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2012-05-06 22:59:04 +0000 |
commit | e4c35d5b84d5a900124af468f3576fed84409da7 (patch) | |
tree | 784ed80b25f69f16765624368f1747aded926a3d | |
parent | 9fdddeeddcc2368683b379e59ab8480aaf058b48 (diff) | |
download | qpid-python-e4c35d5b84d5a900124af468f3576fed84409da7.tar.gz |
NO-JIRA: use Ivy to download the dependencies
- Merge upload.xml into main common.xml/build.xml file, functionality is now the upload target.
- Update the global build target to automatically download Ivy if required and retrieve dependencys (can be overriden).
- Add configurable support for resolving against an m2 repo (default, central repo), or a flat folder of jars in the filesystem (as previously used).
- Update build process to allow using full filename for the javacc dependency.
- Update jython version to allow downloading the dependency, clarify that its the 'standalone' version in use.
- Update ivy files to use variables instead of hard coded values for project version etc.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/dep_removal@1334816 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/build.xml | 22 | ||||
-rw-r--r-- | qpid/java/common.xml | 71 | ||||
-rw-r--r-- | qpid/java/common/build.xml | 7 | ||||
-rw-r--r-- | qpid/java/ivy.nexus.xml (renamed from qpid/java/ivy.xml) | 2 | ||||
-rw-r--r-- | qpid/java/ivy.retrieve.xml | 56 | ||||
-rw-r--r-- | qpid/java/ivysettings.nexus.xml (renamed from qpid/java/ivysettings-nexus.xml) | 3 | ||||
-rw-r--r-- | qpid/java/ivysettings.retrieve.xml | 32 | ||||
-rw-r--r-- | qpid/java/upload.xml | 90 |
8 files changed, 185 insertions, 98 deletions
diff --git a/qpid/java/build.xml b/qpid/java/build.xml index 1de6c8f49c..0905d650d4 100644 --- a/qpid/java/build.xml +++ b/qpid/java/build.xml @@ -18,7 +18,7 @@ - under the License. - --> -<project name="AMQ Java" default="build"> +<project name="AMQ Java" xmlns:ivy="antlib:org.apache.ivy.ant" default="build"> <import file="common.xml"/> @@ -156,7 +156,7 @@ <touch file="${qpid.jar}"/> </target> - <target name="build" description="build the project"> + <target name="build" depends="retrieve-dependencies" description="build the project"> <iterate target="build"/> <antcall target="manifest"/> </target> @@ -296,4 +296,22 @@ <target name="eclipse" description="build eclipse project and classpath files"> <iterate target="eclipse"/> </target> + + <!-- check the following properties which must be specified by the user--> + <target name="check-upload-props-exist" description="check that the required properties have been set"> + <fail unless="nexus.user" message="You must supply the 'nexus.user' property"/> + <fail unless="nexus.password" message="You must supply the 'nexus.password' property"/> + <fail unless="maven.artifact.dir" message="You must supply the 'maven.artifact.dir' property"/> + </target> + + <target name="perform-nexus-upload"> + <ivy:configure file="ivysettings.nexus.xml"/> + <ivy:resolve file="ivy.nexus.xml"/> + <ivy:deliver/> + <ivy:publish publishivy="false" resolver="nexus" + artifactspattern="${maven.artifact.dir}/[organisation]/[module]/[artifact]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/> + </target> + + <target name="upload" depends="load-ivy, check-upload-props-exist, perform-nexus-upload"/> + </project> diff --git a/qpid/java/common.xml b/qpid/java/common.xml index 2059e0aeb9..1ce5db04f3 100644 --- a/qpid/java/common.xml +++ b/qpid/java/common.xml @@ -18,7 +18,7 @@ - under the License. - --> -<project name="common"> +<project xmlns:ivy="antlib:org.apache.ivy.ant" name="common"> <dirname property="project.root" file="${ant.file.common}"/> @@ -82,6 +82,7 @@ </fileset> </path> + <!-- properties for generating the maven artifacts --> <property name="maven.local.repo" value="${build.scratch}/maven-local-repo"/> <property name="maven.settings.xml" value="${project.root}/maven-settings.xml"/> <property name="maven.unique.version" value="false"/> @@ -90,6 +91,44 @@ <isfalse value="${maven.snapshot}"/> </condition> + <!-- properties for uploading our Maven artifacts to Nexus using Ivy --> + <property name="ivy.organisation" value="org/apache"/> + <property name="nexus.organisation" value="org.apache"/> + <property name="nexus.host" value="repository.apache.org"/> + <property name="nexus.upload.url" value="https://${nexus.host}/service/local/staging/deploy/maven2"/> + + <!-- properties for downloading ivy, and then our dependencies --> + <property name="ivy.jar.dir" value="lib/ivy" /> + <property name="ivy.install.version" value="2.2.0" /> + <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" /> + <property name="ivy.repo.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy"/> + <property name="ivy.jar.url" value="${ivy.repo.url}/${ivy.install.version}/ivy-${ivy.install.version}.jar"/> + + <available property="ivy.jar.file.exists" file="${ivy.jar.file}"/> + + <condition property="dont.download.ivy"> + <!-- Set prop to stop Ivy download if asked not to retrieve + the dependencies, or the ivy jar is already present --> + <or> + <and> + <isset property="retrieve.dependencies"/> + <isfalse value="${retrieve.dependencies}"/> + </and> + <and> + <isset property="ivy.jar.file.exists"/> + <istrue value="${ivy.jar.file.exists}"/> + </and> + </or> + </condition> + + <condition property="ivy.dont.retrieve"> + <and> + <isset property="retrieve.dependencies"/> + <isfalse value="${retrieve.dependencies}"/> + </and> + </condition> + + <macrodef name="indirect"> <attribute name="name"/> <attribute name="variable"/> @@ -141,7 +180,7 @@ <attribute name="path"/> <element name="args"/> <sequential> - <java jar="${project.root}/lib/jython-2.5.0.jar" fork="true" failonerror="true"> + <java jar="${project.root}/lib/jython-standalone-2.5.2.jar" fork="true" failonerror="true"> <arg value="-Dpython.path=@{path}"/> <args/> </java> @@ -221,6 +260,34 @@ <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.dir}/findbugs-ant.jar"/> </target> + + <!-- targets for downloading ivy and retrieving dependencies --> + <target name="retrieve-dependencies" depends="load-ivy" unless="${ivy.dont.retrieve}"> + <echo message="Resolving and retrieving dependencies..."/> + <ivy:configure file="ivysettings.retrieve.xml"/> + <ivy:resolve type="jar,bundle" file="ivy.retrieve.xml"/> + <ivy:retrieve type="jar,bundle"/> + </target> + + <target name="load-ivy" depends="download-ivy" unless="${ivy.dont.retrieve}"> + <!-- Try to load Ivy from local ivy dir, in case the user has not already dropped it into + Ant's lib dir (note that the latter copy will always take precedence). Won't + fail so long as Ivy is in at least one of the locations. --> + <mkdir dir="${ivy.jar.dir}"/> + <path id="ivy.lib.path"> + <fileset dir="${ivy.jar.dir}" includes="*.jar"/> + </path> + <taskdef resource="org/apache/ivy/ant/antlib.xml" + uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> + </target> + + <target name="download-ivy" unless="${dont.download.ivy}"> + <mkdir dir="${ivy.jar.dir}"/> + <echo message="Downloading ivy..."/> + <get src="${ivy.jar.url}" dest="${ivy.jar.file}" usetimestamp="true"/> + </target> + + <target name="help" description="display detailed build documentation"> <echo> ant build diff --git a/qpid/java/common/build.xml b/qpid/java/common/build.xml index fe96f384d5..4cb565ca42 100644 --- a/qpid/java/common/build.xml +++ b/qpid/java/common/build.xml @@ -98,10 +98,15 @@ public class QpidBuildVersion </target> <target name="jms-selector"> + <copy tofile="${module.build}/javacc.jar" failonerror="true"> + <fileset dir="${project.root}/lib"> + <include name="javacc-*.jar"/> + </fileset> + </copy> <mkdir dir="${selector.output.dir}"/> <javacc target="src/main/grammar/SelectorParser.jj" outputdirectory="${selector.output.dir}" - javacchome="${project.root}/lib"/> + javacchome="${module.build}"/> </target> <target name="precompile" depends="gentools,jython,create-version,build-version,jms-selector"/> diff --git a/qpid/java/ivy.xml b/qpid/java/ivy.nexus.xml index cc891094a3..61ae9f315b 100644 --- a/qpid/java/ivy.xml +++ b/qpid/java/ivy.nexus.xml @@ -18,7 +18,7 @@ <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> - <info organisation="org/apache" module="qpid" revision="0.17"/> + <info organisation="${ivy.organisation}" module="${project.name}" revision="${project.version}"/> <publications xmlns:e="urn:ant.apache.org:ivy-extras"> <artifact name="qpid-client" type="pom" ext="pom"/> diff --git a/qpid/java/ivy.retrieve.xml b/qpid/java/ivy.retrieve.xml new file mode 100644 index 0000000000..6b7d1dfa18 --- /dev/null +++ b/qpid/java/ivy.retrieve.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> + + <info organisation="${ivy.organisation}" module="${project.name}" revision="${project.version}"/> + + <publications xmlns:e="urn:ant.apache.org:ivy-extras"/> + + <dependencies> + <dependency org="biz.aQute" name="bnd" rev="0.0.384" transitive="false"/> + <dependency org="commons-beanutils" name="commons-beanutils-core" rev="1.8.0" transitive="false"/> + <dependency org="commons-cli" name="commons-cli" rev="1.0" transitive="false"/> + <dependency org="commons-codec" name="commons-codec" rev="1.3" transitive="false"/> + <dependency org="commons-collections" name="commons-collections" rev="3.2" transitive="false"/> + <dependency org="commons-configuration" name="commons-configuration" rev="1.6" transitive="false"/> + <dependency org="commons-digester" name="commons-digester" rev="1.8.1" transitive="false"/> + <dependency org="commons-lang" name="commons-lang" rev="2.2" transitive="false"/> + <dependency org="commons-logging" name="commons-logging" rev="1.0.4" transitive="false"/> + <dependency org="org.apache.derby" name="derby" rev="10.6.1.0" transitive="false"/> + <dependency org="org.apache.geronimo.framework" name="geronimo-kernel" rev="2.2.1" transitive="false"/> + <dependency org="org.apache.geronimo.specs" name="geronimo-ejb_3.0_spec" rev="1.0.1" transitive="false"/> + <dependency org="org.apache.geronimo.specs" name="geronimo-j2ee-connector_1.5_spec" rev="2.0.0" transitive="false"/> + <dependency org="org.apache.geronimo.specs" name="geronimo-jms_1.1_spec" rev="1.0" transitive="false"/> + <dependency org="org.apache.geronimo.specs" name="geronimo-jta_1.1_spec" rev="1.1.1" transitive="false"/> + <dependency org="org.apache.geronimo.specs" name="geronimo-servlet_2.5_spec" rev="1.2" transitive="false"/> + <dependency org="com.google.code.gson" name="gson" rev="2.0" transitive="false"/> + <dependency org="org.codehaus.jackson" name="jackson-core-asl" rev="1.9.0" transitive="false"/> + <dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.9.0" transitive="false"/> + <dependency org="net.java.dev.javacc" name="javacc" rev="5.0" transitive="false"/> + <dependency org="junit" name="junit" rev="3.8.1" transitive="false"/> + <dependency org="org.python" name="jython-standalone" rev="2.5.2" transitive="false"/> + <dependency org="log4j" name="log4j" rev="1.2.12" transitive="false"/> + <dependency org="org.apache.maven" name="maven-ant-tasks" rev="2.1.1" transitive="false"/> + <dependency org="org.mockito" name="mockito-all" rev="1.9.0" transitive="false"/> + <dependency org="org.apache.felix" name="org.apache.felix.main" rev="2.0.5" transitive="false"/> + <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" transitive="false"/> + <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.1" transitive="false"/> + <dependency org="xalan" name="xalan" rev="2.7.0" transitive="false"/> + </dependencies> +</ivy-module> diff --git a/qpid/java/ivysettings-nexus.xml b/qpid/java/ivysettings.nexus.xml index 1d9c393e23..03f84f9f7c 100644 --- a/qpid/java/ivysettings-nexus.xml +++ b/qpid/java/ivysettings.nexus.xml @@ -18,7 +18,6 @@ <credentials host="${nexus.host}" realm="Sonatype Nexus Repository Manager" username="${nexus.user}" passwd="${nexus.password}"/> <caches defaultCacheDir="${user.home}/.ivy2/cache"/> <resolvers> - <ibiblio name="public" m2compatible="true"/> <url name="nexus"> <artifact pattern="${nexus.upload.url}/[organisation]/[module]/[artifact]/[revision]/[artifact]-[revision](-[classifier]).[ext]" /> </url> @@ -26,5 +25,5 @@ <modules> <module organisation="${nexus.organisation}" name="qpid" resolver="nexus"/> </modules> - <settings defaultResolver="public"/> + <settings defaultResolver="nexus"/> </ivysettings> diff --git a/qpid/java/ivysettings.retrieve.xml b/qpid/java/ivysettings.retrieve.xml new file mode 100644 index 0000000000..c4287cee16 --- /dev/null +++ b/qpid/java/ivysettings.retrieve.xml @@ -0,0 +1,32 @@ +<!-- + 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. +--> +<ivysettings> + <property name="ivy.default.resolver" value="m2repo" override="false"/> + <property name="ivy.localfs.root" value="${project.root}/localfs_repo" override="false"/> + <property name="ivy.localfs.pattern" value="[artifact]-[revision](-[classifier]).[ext]" override="false"/> + <property name="ivy.m2repo.url" value="http://repo1.maven.org/maven2" override="false"/> + + <settings defaultResolver="${ivy.default.resolver}"/> + <resolvers> + <filesystem name="localfs"> + <artifact pattern="${ivy.localfs.root}/${ivy.localfs.pattern}" /> + </filesystem> + <url name="m2repo" m2compatible="true"> + <artifact pattern="${ivy.m2repo.url}/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/> + </url> + </resolvers> +</ivysettings> diff --git a/qpid/java/upload.xml b/qpid/java/upload.xml deleted file mode 100644 index 9f2fd6819b..0000000000 --- a/qpid/java/upload.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?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="upload" default="upload" xmlns:ivy="antlib:org.apache.ivy.ant"> - <description>Targets for uploading releases to ASF's Nexus instance</description> - - <property name="nexus.organisation" value="org.apache"/> - <property name="nexus.host" value="repository.apache.org"/> - <property name="nexus.upload.url" value="https://repository.apache.org/service/local/staging/deploy/maven2"/> - - <!-- properties for downloading ivy if required --> - <property name="ivy.jar.dir" value="lib/ivy" /> - <property name="ivy.install.version" value="2.2.0" /> - <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" /> - <property name="ivy.repo.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy"/> - - <target name="download-ivy"> - <mkdir dir="${ivy.jar.dir}"/> - <!-- download Ivy from web site so that it can be used without any special installation --> - <echo message="Downloading ivy..."/> - <get src="${ivy.repo.url}/${ivy.install.version}/ivy-${ivy.install.version}.jar" - dest="${ivy.jar.file}" usetimestamp="true"/> - </target> - - <target name="load-ivy"> - <!-- Try to load Ivy from local ivy dir, in case the user has not already dropped it into - Ant's lib dir (note that the latter copy will always take precedence). Won't - fail so long as Ivy is in at least one of the locations. --> - <mkdir dir="${ivy.jar.dir}"/> - <path id="ivy.lib.path"> - <fileset dir="${ivy.jar.dir}" includes="*.jar"/> - </path> - <taskdef resource="org/apache/ivy/ant/antlib.xml" - uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> - </target> - - <!-- check the following properties which must be specified by the user--> - <target name="check-props-exist" description="check that the required properties have been set"> - <fail unless="nexus.user" message="You must supply the 'nexus.user' property"/> - <fail unless="nexus.password" message="You must supply the 'nexus.password' property"/> - <fail unless="maven.artifact.dir" message="You must supply the 'maven.artifact.dir' property"/> - </target> - - <target name="perform-nexus-upload" description="really requires the prepare-upload target to be run first"> - <ivy:configure file="ivysettings-nexus.xml"/> - <ivy:resolve file="ivy.xml"/> - <ivy:retrieve/> - <ivy:deliver/> - <ivy:publish publishivy="false" resolver="nexus" - artifactspattern="${maven.artifact.dir}/[organisation]/[module]/[artifact]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/> - </target> - - <target name="upload" depends="load-ivy, check-props-exist, perform-nexus-upload"/> - - <target name="help" description="display detailed build documentation"> - <echo> -Ivy can be leveraged either by installing it in the Ant lib dir yourself, -or by running the following command in qpid/java to place it in the -qpid/java/lib/ivy lib folder: - - ant -buildfile upload.xml download-ivy - -The publishing task should be run once the release process has otherwise -been completed and the artifacts signed. It can be performed from the -qpid/java directory with a command as follows: - - ant -buildfile upload.xml -Dnexus.user=<apache_username> -Dnexus.password=<password> - -Dmaven.artifact.dir=<path to maven repo structure from release process> - -Note: if you are behind a proxy server it is necessary to give Ant the -proxy settings by doing something like: - -export ANT_OPTS="-Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port>" - </echo> - </target> -</project> |