Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
278 lines (211 sloc) 11.8 KB
<?xml version="1.0"?>
<!--
Copyright 2011, Deft Labs.
Licensed 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="mongo-java-logging" default="usage" basedir="./" xmlns:aspectj="antlib:org.aspectj" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- ******************************************************************* -->
<!-- Set the base attributes. -->
<!-- ******************************************************************* -->
<property name="dir.build" value="build"/>
<property name="dir.build.java" value="${dir.build}/java/classes"/>
<property name="dir.build.release" value="${dir.build}/mongo-java-logging"/>
<property name="dir.src" value="src"/>
<property name="dir.src.java" value="src/main"/>
<property name="dir.src.java.unit" value="src/unit"/>
<property name="dir.src.java.test" value="src/test"/>
<property name="dir.lib" value="lib"/>
<property name="dir.conf" value="conf"/>
<property file="build.properties" prefix="build.conf"/>
<property environment="env"/>
<path id="classpath.all">
<fileset dir="${dir.lib}"><include name="*.jar"/></fileset>
</path>
<path id="classpath.cp"><pathelement location="${dir.build.java}"/></path>
<!-- ******************************************************************* -->
<!-- Set the Maven attributes. -->
<!-- ******************************************************************* -->
<property name="groupId" value="com.deftlabs"/>
<property name="artifactId" value="mongo-java-logging"/>
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots-deftlabs"/>
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots"/>
<property name="maven-staging-repository-id" value="sonatype-nexus-staging-deftlabs"/>
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/"/>
<!-- ******************************************************************* -->
<!-- Remove the build directory. -->
<!-- ******************************************************************* -->
<target name="clean">
<delete dir="${dir.build}"/>
<delete file="conf/maven-mongo-java-logging.xml.asc"/>
</target>
<!-- ******************************************************************* -->
<!-- Compile the java classes. -->
<!-- ******************************************************************* -->
<target name="compile">
<mkdir dir="${dir.build.java}"/>
<javac destdir="${dir.build.java}"
target="${build.conf.javac.source}"
debug="true" encoding="UTF-8"
classpathref="classpath.cp"
source="${build.conf.javac.source}"
includeantruntime="false"
debuglevel="lines,vars,source">
<src path="${dir.src.java}"/>
<src path="${dir.src.java.unit}"/>
<src path="${dir.src.java.test}"/>
<compilerarg value="-Xlint:all,-fallthrough"/>
<classpath refid="classpath.all"/>
</javac>
</target>
<!-- ******************************************************************* -->
<!-- Create the jar file. -->
<!-- ******************************************************************* -->
<target name="jar" depends="clean, unit, compile">
<mkdir dir="${dir.build}/dist"/>
<copy file="src/main/META-INF/MANIFEST.MF" tofile="${dir.build}/MANIFEST.MF" filtering="true">
<filterset><filter token="VERSION" value="${build.conf.lib.version}"/></filterset>
</copy>
<jar destfile="${dir.build}/dist/mongo-java-logging.jar" basedir="${dir.build.java}" manifest="${dir.build}/MANIFEST.MF"></jar>
<copy file="conf/maven-mongo-java-logging.xml" tofile="${dir.build}/maven-mongo-java-logging.xml" filtering="true">
<filterset><filter token="VERSION" value="${build.conf.lib.version}"/></filterset>
</copy>
</target>
<!-- ******************************************************************* -->
<!-- Create the additional jars. -->
<!-- ******************************************************************* -->
<target name="jar.all" depends="jar, javadocs">
<jar jarfile="${dir.build}/dist/mongo-java-logging-sources-${build.conf.lib.version}.jar"><fileset dir="src/main"/></jar>
<jar jarfile="${dir.build}/dist/mongo-java-logging-javadoc-${build.conf.lib.version}.jar"><fileset dir="${dir.build}/javadocs"/></jar>
<copy file="${dir.build}/dist/mongo-java-logging.jar" tofile="${dir.build}/dist/mongo-java-logging-${build.conf.lib.version}.jar"/>
</target>
<!-- ******************************************************************* -->
<!-- Run the isolated unit tests. -->
<!-- ******************************************************************* -->
<target name="unit" depends="compile">
<junit fork="yes" haltonfailure="true">
<jvmarg value="-Duser.timezone=GMT"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath refid="classpath.all"/>
<classpath>
<pathelement path="${dir.build.java}"/>
<pathelement path="${dir.conf}"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest todir=".">
<fileset dir="${dir.build.java}">
<include name="**/*UnitTests.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ******************************************************************* -->
<!-- Run the integration tests. Server must be running to work. -->
<!-- ******************************************************************* -->
<target name="test" depends="compile">
<junit fork="yes" haltonfailure="true">
<jvmarg value="-Duser.timezone=GMT"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<classpath refid="classpath.all"/>
<classpath>
<pathelement path="${dir.build.java}"/>
<pathelement path="${dir.conf}"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest todir=".">
<fileset dir="${dir.build.java}">
<include name="**/*IntTests.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ******************************************************************* -->
<!-- Generate the Javadocs. -->
<!-- ******************************************************************* -->
<target name="javadocs" depends="compile" description="Generate Javadocs">
<delete dir="${dir.build}/javadocs/"/>
<javadoc
packagenames="com.deftlabs.logging.mongo"
sourcepath="src/main/"
defaultexcludes="yes"
destdir="${dir.build}/javadocs"
author="true"
version="true"
source="1.5"
use="true"
access="protected">
<link href="http://download.oracle.com/javase/1.5.0/docs/api/" />
<classpath refid="classpath.all"/>
</javadoc>
</target>
<!-- ******************************************************************* -->
<!-- Deploy to Maven repository. -->
<!-- ******************************************************************* -->
<target name="maven.snapshot" depends="jar.all" description="Deploy a snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file"/>
<arg value="-Durl=${maven-snapshots-repository-url}"/>
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-mongo-java-logging.xml"/>
<arg value="-Dfile=${dir.build}/dist/mongo-java-logging-${build.conf.lib.version}.jar"/>
</artifact:mvn>
</target>
<!-- ******************************************************************* -->
<!-- Stage in the Maven repository. -->
<!-- ******************************************************************* -->
<target name="maven.stage" depends="jar.all" description="Deploy release version to Maven staging repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-mongo-java-logging.xml"/>
<arg value="-Dfile=${dir.build}/dist/mongo-java-logging-${build.conf.lib.version}.jar"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg-deftlabs" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-mongo-java-logging.xml"/>
<arg value="-Dfile=${dir.build}/dist/mongo-java-logging-sources-${build.conf.lib.version}.jar"/>
<arg value="-Dclassifier=sources"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg-deftlabs"/>
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=${dir.build}/maven-mongo-java-logging.xml"/>
<arg value="-Dfile=${dir.build}/dist/mongo-java-logging-javadoc-${build.conf.lib.version}.jar"/>
<arg value="-Dclassifier=javadoc"/>
<arg value="-Dkeyname=665C1184"/>
<arg value="-Pgpg-deftlabs"/>
</artifact:mvn>
</target>
<!-- ******************************************************************* -->
<!-- Describe the build file usage. -->
<!-- ******************************************************************* -->
<target name="usage">
<echo>
----------------------------------------
- Compile the Java files ......................... compile
- Create the jar file ............................ jar
- Create ALL of the build jar files .............. jar.all
- Clean the source tree .......................... clean
- Run the unit tests ............................. unit
- Run the integration tests ...................... test
- Generate the Javadocs .......................... javadocs
----------------------------------------
</echo>
</target>
<!-- ******************************************************************* -->
</project>
Jump to Line
Something went wrong with that request. Please try again.