| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| $HeadURL$ |
| $Revision$ |
| $Date$ |
| |
| ==================================================================== |
| 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. |
| ==================================================================== |
| |
| This software consists of voluntary contributions made by many |
| individuals on behalf of the Apache Software Foundation. For more |
| information on the Apache Software Foundation, please see |
| <http://www.apache.org/>. |
| --> |
| |
| <project name="HttpClient" basedir="." default="package-src"> |
| <description> |
| HttpClient: Jakarta HttpComponents Client |
| </description> |
| |
| |
| <!-- Definition of the local environment. |
| The default location of the build.properties assumes that you are |
| building from the full tree of all HTTP components, and have a |
| single build.properties file located in ${root}/project/. If this is |
| not the case, override property local.properties when calling Ant. |
| |
| Use this file to specify the location of external dependencies, |
| and to override other properties defined below if you have to. |
| |
| External dependencies for which there is a default location: |
| httpcore.jar - always |
| javadoc.j2sdk.link - for javadoc |
| dist.core.api - for javadoc |
| |
| External dependencies for which there is no default location: |
| commons-logging.jar - for logging |
| commons-codec.jar - for URL encoding and authentication |
| junit.jar - for test and clover targets |
| clover.jar - for clover target |
| --> |
| <property name="local.properties" location="../project/build.properties" /> |
| <property file="${local.properties}" /> |
| |
| |
| <!-- component and version information --> |
| <property name="comp.client.name" |
| value="httpclient"/> |
| <property name="comp.client.title" |
| value="Jakarta HttpComponents Client"/> |
| <property name="comp.client.version" |
| value="SNAPSHOT"/> |
| |
| <!-- external dependencies |
| These are prime candidates for overriding in local.properties. |
| The defaults assume again that you are building from the full tree |
| of HTTP components, and that other components use the default |
| build settings. |
| The '.jar properties must be set to either to a JAR file in which |
| the classes are packaged, or to a directory tree holding them. |
| --> |
| |
| <property name="httpcore.home" location="../httpcore" /> |
| <property name="httpcore.jar" |
| location="${httpcore.home}/module-main/target/classes" /> |
| <property name="dist.core.api" |
| location="${httpcore.home}/dist/docs/api/" /> |
| |
| <path id="classpath.client.compile"> |
| <pathelement location="${httpcore.jar}"/> |
| <pathelement location="${commons-logging.jar}"/> |
| <pathelement location="${commons-codec.jar}"/> |
| </path> |
| |
| <path id="classpath.client.javadoc"> |
| <path refid="classpath.client.compile" /> |
| <!-- add dependencies for contrib classes for which to JavaDoc --> |
| </path> |
| |
| |
| <!-- directory structure of the source tree --> |
| <property name="comp.client.home" value="${basedir}"/> |
| <property name="comp.client.src" |
| value="${comp.client.home}/module-client/src/main/java"/> |
| <property name="comp.client.tests" |
| value="${comp.client.home}/module-client/src/test/java"/> |
| <property name="comp.client.xmpls" |
| value="${comp.client.home}/module-client/src/examples"/> |
| <property name="comp.client.contr" |
| value="${comp.client.home}/contrib"/> |
| |
| |
| <!-- locations for intermediate and final build results |
| For consistency with other builds, the temporary files are |
| located by default below "target/", final results below "dist/". |
| --> |
| <property name="build.client.home" value="${comp.client.home}/target"/> |
| <property name="build.client.classes" value="${build.client.home}/classes"/> |
| <property name="build.client.tests" value="${build.client.home}/tests"/> |
| <property name="build.client.xmpls" value="${build.client.home}/examples"/> |
| <property name="build.client.contr" value="${build.client.home}/contrib"/> |
| <property name="build.client.clover" value="${build.client.home}/clover"/> |
| |
| <property name="dist.client.home" value="${comp.client.home}/dist"/> |
| <property name="dist.client.docs" value="${dist.client.home}/docs"/> |
| <property name="dist.client.api" value="${dist.client.docs}/api"/> |
| |
| <property name="jar.client.src.name" |
| value="jakarta-${comp.client.name}-${comp.client.version}.jar" /> |
| <property name="jar.client.addon.name" |
| value="jakarta-${comp.client.name}-addon-${comp.client.version}.jar" /> |
| |
| |
| <!-- compiler and javadoc setup --> |
| <property name="compile.debug" value="true"/> |
| <property name="compile.deprecation" value="true"/> |
| <property name="compile.optimize" value="true"/> |
| <property name="compile.source" value="1.4"/> |
| <property name="compile.target" value="1.4"/> |
| <property name="javadoc.access" value="protected"/> |
| |
| <property name="javadoc.j2sdk.link" |
| value="http://java.sun.com/j2se/1.4.2/docs/api/" /> |
| |
| |
| <!-- build targets ======================================================== --> |
| |
| <target name="echo-properties" |
| description="echo properties to verify the build setup" |
| > |
| <echo> |
| General |
| component ${comp.client.name} |
| component title ${comp.client.title} |
| component version ${comp.client.version} |
| base directory ${basedir} |
| local properties ${local.properties} |
| |
| Dependencies |
| HttpCore ${httpcore.jar} |
| Commons Logging ${commons-logging.jar} |
| Commons Codec ${commons-codec.jar} |
| JUnit ${junit.jar} |
| Clover ${clover.jar} |
| |
| Source Tree |
| base ${comp.client.home} |
| main ${comp.client.src} |
| tests ${comp.client.tests} |
| examples ${comp.client.xmpls} |
| contrib ${comp.client.contr} |
| |
| Output |
| temp ${build.client.home} |
| final ${dist.client.home} |
| javadoc ${dist.client.api} |
| </echo> |
| </target> |
| |
| |
| <!-- traditional targets ====================================================== |
| These targets match the ones before the build restructuring, except: |
| - "javadoc" does not depend on "compile" |
| - "clover" will always recompile the source and tests |
| --> |
| |
| <target name="compile" depends="compile-src" /> |
| <target name="package" depends="package-src" /> |
| <target name="javadoc" depends="javadoc-src" /> |
| <target name="test" depends="compile-src,run-tests" /> |
| <target name="clover" depends="run-clover" /> |
| <target name="clean" depends="clean-build,clean-dist" /> |
| |
| |
| <!-- combined compilation targets ============================================= |
| For external invocation. |
| See also the packaging and test/verification targets below |
| --> |
| |
| <target name="compile-all" |
| depends="compile-src,compile-tests, |
| compile-examples,compile-contrib" |
| description="compiles everything, not from scratch" |
| /> |
| <target name="clean-compile" |
| depends="clean-src,clean-tests, |
| clean-examples,clean-contrib" |
| description="cleans intermediate files from compilation" |
| /> |
| <target name="compile-all-fs" |
| depends="clean-compile,compile-all" |
| description="compiles everything from scratch" |
| /> |
| |
| |
| <!-- compile and clean targets ================================================ |
| For compiling and recompiling specific parts of HttpClient code. |
| These targets do NOT define dependencies between eachother. |
| Direct invocation of these targets is for those who know what they do! |
| --> |
| |
| <target name="compile-src" depends="build-init"> |
| |
| <mkdir dir="${build.client.classes}" /> |
| <javac destdir ="${build.client.classes}" |
| debug ="${compile.debug}" |
| deprecation ="${compile.deprecation}" |
| optimize ="${compile.optimize}" |
| encoding ="UTF-8" |
| source ="${compile.source}" |
| target ="${compile.target}" |
| > |
| <src> |
| <pathelement location="${comp.client.src}"/> |
| </src> |
| <classpath> |
| <path refid="classpath.client.compile"/> |
| </classpath> |
| </javac> |
| </target> |
| <target name="clean-src"> |
| <delete dir="${build.client.classes}" quiet="true" /> |
| </target> |
| |
| |
| <target name="compile-tests" depends="build-init"> |
| <mkdir dir="${build.client.tests}" /> |
| <javac destdir ="${build.client.tests}" |
| debug ="${compile.debug}" |
| deprecation ="${compile.deprecation}" |
| optimize ="${compile.optimize}" |
| encoding ="UTF-8" |
| source ="${compile.source}" |
| target ="${compile.target}" |
| > |
| <src> |
| <pathelement path="${comp.client.tests}"/> |
| </src> |
| <classpath> |
| <path refid="classpath.client.compile"/> |
| <pathelement location="${build.client.classes}"/> |
| <pathelement location="${junit.jar}"/> |
| </classpath> |
| </javac> |
| </target> |
| <target name="clean-tests"> |
| <delete dir="${build.client.tests}" quiet="true" /> |
| </target> |
| |
| |
| <target name="compile-examples" depends="build-init"> |
| <mkdir dir="${build.client.xmpls}" /> |
| <javac destdir ="${build.client.xmpls}" |
| debug ="${compile.debug}" |
| deprecation ="${compile.deprecation}" |
| optimize ="${compile.optimize}" |
| encoding ="UTF-8" |
| source ="${compile.source}" |
| target ="${compile.target}" |
| > |
| <src> |
| <pathelement path="${comp.client.xmpls}"/> |
| </src> |
| <classpath> |
| <path refid="classpath.client.compile"/> |
| <pathelement location="${build.client.classes}"/> |
| </classpath> |
| </javac> |
| </target> |
| <target name="clean-examples"> |
| <delete dir="${build.client.xmpls}" quiet="true" /> |
| </target> |
| |
| |
| <target name="compile-contrib" depends="build-init"> |
| <mkdir dir="${build.client.contr}" /> |
| <javac destdir ="${build.client.contr}" |
| debug ="${compile.debug}" |
| deprecation ="${compile.deprecation}" |
| optimize ="${compile.optimize}" |
| encoding ="UTF-8" |
| source ="${compile.source}" |
| target ="${compile.target}" |
| > |
| <src> |
| <pathelement path="${comp.client.contr}"/> |
| </src> |
| <classpath> |
| <path refid="classpath.client.compile"/> |
| <pathelement location="${build.client.classes}"/> |
| </classpath> |
| </javac> |
| </target> |
| <target name="clean-contrib"> |
| <delete dir="${build.client.contr}" quiet="true" /> |
| </target> |
| |
| |
| <!-- packaging and verification targets ======================================= |
| For building JARs and running tests. |
| |
| Targets for building JARs define dependencies on compilation targets. |
| Unlike with Maven, running tests is not a dependency for packaging. |
| |
| The plain test target defines dependencies on the test classes, but |
| not on the classes to be tested. It should be possible to run a test |
| target without affecting the subject of the test. The "from scratch" |
| test target defines transitive dependencies on the subject classes. |
| --> |
| |
| <target name="package-src" |
| depends="dist-init,compile-src" |
| description="builds the JAR with HttpClient classes" |
| > |
| <jar destfile="${dist.client.home}/${jar.client.src.name}"> |
| <!-- manifest? --> |
| <!-- timestamp in meta-inf? --> |
| <fileset dir="${build.client.classes}" includes="**" /> |
| </jar> |
| </target> |
| <target name="package-src-fs" |
| depends="clean-src,package-src" |
| description="builds the JAR with HttpClient classes, compiling from scratch" |
| /> |
| |
| |
| <target name="package-addon" |
| depends="dist-init,compile-src, |
| compile-examples,compile-contrib" |
| description="builds the JAR with HttpClient examples and contributions" |
| > |
| <jar destfile="${dist.client.home}/${jar.client.addon.name}"> |
| <!-- manifest? --> |
| <!-- timestamp in meta-inf? --> |
| <fileset dir="${build.client.xmpls}" includes="**" /> |
| <fileset dir="${build.client.contr}" includes="**" /> |
| </jar> |
| </target> |
| <target name="package-addon-fs" |
| depends="clean-examples,clean-contrib,package-addon" |
| description="builds the JAR with HttpClient examples and contributions, compiling them from scratch" |
| /> |
| |
| |
| <target name="run-tests" |
| depends="build-init,compile-tests" |
| description="runs unit tests on HttpClient classes" |
| > |
| <copy todir="${build.client.tests}" filtering="on"> |
| <fileset dir="${comp.client.tests}" excludes="**/*.java" /> |
| </copy> |
| <!-- don't use Ant optional JUnit tasks here --> |
| <java classname="junit.textui.TestRunner" |
| fork="yes" failonerror="yes" |
| > |
| <arg value="org.apache.http.client.TestAll"/> |
| <classpath> |
| <path refid="classpath.client.compile"/> |
| <pathelement location="${junit.jar}"/> |
| <pathelement location="${clover.jar}"/> |
| <pathelement location="${build.client.classes}"/> |
| <pathelement location="${build.client.tests}"/> |
| </classpath> |
| </java> |
| </target> |
| <target name="run-tests-fs" |
| depends="clean-build,compile-src,run-tests" |
| /> |
| |
| |
| <!-- Clover always needs a recompile to instrument the source code. |
| clean-build enforces the recompilation, clover-init prepares |
| the Ant environment for Clover instrumentation. |
| --> |
| <target name="run-clover" |
| depends="clean-build,clover-init,compile-src,run-tests" |
| description="runs Clover on HttpClient, recompiling everything from scratch" |
| > |
| <echoproperties prefix="clover"/> |
| <mkdir dir="${build.client.clover}"/> |
| <clover-report> |
| <current outfile="${build.client.clover}/coverage-report"> |
| <format type="html"/> |
| </current> |
| </clover-report> |
| </target> |
| |
| |
| <target name="javadoc-src" |
| description="generates JavaDoc for the HttpClient classes" |
| > |
| <mkdir dir="${dist.client.api}" /> |
| <javadoc destdir="${dist.client.api}" |
| encoding="UTF-8" |
| access="${javadoc.access}" |
| version="true" |
| author="true" |
| windowtitle="${comp.client.title} (Version ${comp.client.version})" |
| > |
| <packageset dir="${comp.client.src}"> |
| <include name="org/apache/http/**" /> |
| </packageset> |
| |
| <group title="API"> |
| <package name="org.apache.http.auth*" /> |
| <package name="org.apache.http.conn*" /> |
| <package name="org.apache.http.cookie*" /> |
| <package name="org.apache.http.client*" /> |
| </group> |
| <group title="Implementation"> |
| <package name="org.apache.http.impl.*" /> |
| </group> |
| |
| <classpath refid="classpath.client.javadoc"/> |
| <link href="${javadoc.j2sdk.link}"/> |
| <link href="${dist.core.api}"/> |
| |
| <doctitle>${comp.client.title}</doctitle> |
| <bottom>Copyright (c) 2005-2007 - Apache Software Foundation</bottom> |
| </javadoc> |
| </target> |
| |
| |
| <target name="javadoc-addon" |
| description="generates JavaDoc including examples and contributions" |
| > |
| <mkdir dir="${dist.client.api}" /> |
| <javadoc destdir="${dist.client.api}" |
| encoding="UTF-8" |
| access="${javadoc.access}" |
| version="true" |
| author="true" |
| windowtitle="${comp.client.title} (Version ${comp.client.version})" |
| > |
| <packageset dir="${comp.client.src}"> |
| <include name="org/apache/http/**" /> |
| </packageset> |
| <packageset dir="${comp.client.xmpls}"> |
| <include name="org/apache/http/**" /> |
| </packageset> |
| <packageset dir="${comp.client.contr}"> |
| <include name="org/apache/http/**" /> |
| </packageset> |
| |
| |
| <group title="API"> |
| <package name="org.apache.http.auth*" /> |
| <package name="org.apache.http.conn*" /> |
| <package name="org.apache.http.cookie*" /> |
| <package name="org.apache.http.client*" /> |
| </group> |
| <group title="Implementation"> |
| <package name="org.apache.http.impl.*" /> |
| </group> |
| |
| <group title="Examples"> |
| <package name="org.apache.http.examples*" /> |
| <package name="org.apache.http.client.examples*" /> |
| </group> |
| <group title="Contributions (unsupported)"> |
| <package name="org.apache.http.contrib*" /> |
| <package name="org.apache.http.client.contrib*" /> |
| </group> |
| |
| <classpath refid="classpath.client.javadoc"/> |
| <link href="${javadoc.j2sdk.link}"/> |
| <link href="${dist.core.api}"/> |
| |
| <doctitle>${comp.client.title}</doctitle> |
| <bottom>Copyright (c) 2005-2007 - Apache Software Foundation</bottom> |
| </javadoc> |
| </target> |
| |
| |
| <!-- generic and helper targets =========================================== --> |
| |
| <target name="build-init"> |
| <mkdir dir="${build.client.home}" /> |
| </target> |
| <target name="clean-build" |
| description="cleans all intermediate files, including test reports" |
| > |
| <delete dir="${build.client.home}" quiet="true" /> |
| </target> |
| |
| <target name="dist-init"> |
| <mkdir dir="${dist.client.home}" /> |
| <!-- timestamp? (in build directory!) --> |
| <!-- manifest? (in build directory!) --> |
| </target> |
| <target name="clean-dist" |
| description="cleans all final build results" |
| > |
| <!-- By default, dist.client.docs and dist.client.api are located |
| below dist.client.home and will be cleaned here. If their |
| location is redefined to be somewhere else, they will not |
| be cleaned here. Use the targets dist-docs-clean or |
| dist-api-clean to achieve that. |
| --> |
| <delete dir="${dist.client.home}" quiet="true" /> |
| <!-- delete timestamps and manifests from build.client.home? --> |
| </target> |
| <target name="dist-docs-clean"> |
| <delete dir="${dist.client.docs}" quiet="true" /> |
| </target> |
| <target name="dist-api-clean"> |
| <delete dir="${dist.client.api}" quiet="true" /> |
| </target> |
| |
| |
| <target name="clover-init"> |
| <taskdef resource="clovertasks" /> |
| <property name="build.client.clover.db" |
| location="${build.client.clover}/database" /> |
| <mkdir dir="${build.client.clover.db}"/> |
| <!-- This task prepares the Ant environment for Clover instrumentation. |
| Everything compiled afterwards will be instrumented if it matches |
| the fileset(s) defined here. |
| --> |
| <clover-setup initString="${build.client.clover.db}/coverage.db" > |
| <fileset dir="${comp.client.src}" includes="**" /> |
| </clover-setup> |
| </target> |
| |
| |
| </project><!-- HttpClient --> |