Bye bye Ivy. Even though I like you better, building with Maven makes
publishing to the public Maven repositories much simpler. Being published to the public Maven repositories makes life easier for everyone who wants to depend on samskivert. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2864 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -36,12 +36,12 @@ following principles:
|
||||
Building
|
||||
--------
|
||||
|
||||
The library is built using ant. If you aren't already using ant for other
|
||||
projects, it can be found here:
|
||||
The library is built using Ant or Maven, pick your poison. If you use ant, you
|
||||
will need to obtain the jar files enumerated in etc/libs-incl.xml and place
|
||||
them in the lib/ directory. If you use Maven, the dependencies will be
|
||||
automatically fetched.
|
||||
|
||||
http://ant.apache.org/
|
||||
|
||||
Invoke ant with any of the following targets:
|
||||
Invoke Ant with any of the following targets:
|
||||
|
||||
all: builds the class files and javadoc documentation
|
||||
compile: builds only the class files (dist/classes)
|
||||
@@ -49,11 +49,11 @@ Invoke ant with any of the following targets:
|
||||
tests: builds and runs the unit tests
|
||||
dist: builds the distribution jar file (dist/samskivert.jar)
|
||||
|
||||
It is highly recommended to use the Ivy-based build file, which will
|
||||
automatically download any dependencies. The build file will also download Ivy
|
||||
if needed. For example, to build everything invoke:
|
||||
Invoke Maven with the following targets:
|
||||
|
||||
% ant -f build-ivy.xml all
|
||||
mvn test: builds the code and runs the tests
|
||||
mvn package: builds the code and creates target/samskivert-X.X.jar
|
||||
mvn install: builds and installs samskivert into your local Maven repository
|
||||
|
||||
Distribution
|
||||
------------
|
||||
|
||||
-204
@@ -1,204 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="samskivert" default="compile" basedir=".">
|
||||
<!-- things you may want to change -->
|
||||
<property name="lib.name" value="samskivert"/>
|
||||
<property name="doc.packages" value="com.samskivert.*"/>
|
||||
<property name="doc.overview" value="com/samskivert/overview.html"/>
|
||||
<property name="copyright.holder" value="Michael Bayne, et al."/>
|
||||
|
||||
<!-- the next release version -->
|
||||
<property name="revision" value="1.0"/>
|
||||
|
||||
<!-- things you probably don't want to change -->
|
||||
<property name="src.dir" value="src/main/java"/>
|
||||
<property name="test.dir" value="src/test/java"/>
|
||||
<property name="deploy.dir" value="dist"/>
|
||||
<property name="classes.dir" value="${deploy.dir}/classes"/>
|
||||
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
|
||||
<property name="javadoc.dir" value="${deploy.dir}/docs"/>
|
||||
<property name="libs.dir" value="lib"/>
|
||||
<property name="gwtjar.dir" value="${deploy.dir}/gwt-jar"/>
|
||||
|
||||
<!-- downloads ivy if necessary and sets everything up -->
|
||||
<property name="ivy.vers" value="2.1.0-rc2" />
|
||||
<property name="ivy.jar.dir" value="${user.home}/.ant/lib" />
|
||||
<condition property="ivy.exists"><available file="${ivy.jar.dir}/ivy.jar"/></condition>
|
||||
<target name="-download-ivy" unless="ivy.exists">
|
||||
<mkdir dir="${ivy.jar.dir}"/>
|
||||
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.vers}/ivy-${ivy.vers}.jar"
|
||||
dest="${ivy.jar.dir}/ivy.jar" usetimestamp="true"/>
|
||||
</target>
|
||||
<target name="-init-ivy" depends="-download-ivy">
|
||||
<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"/>
|
||||
<ivy:cachepath pathid="compile.classpath" conf="compile" log="download-only"/>
|
||||
<ivy:cachepath pathid="test.classpath" conf="test" log="download-only"/>
|
||||
</target>
|
||||
|
||||
<target name="-prepare" depends="-init-ivy">
|
||||
<tstamp><format property="year" pattern="yyyy" /></tstamp>
|
||||
<mkdir dir="${deploy.dir}"/>
|
||||
<mkdir dir="${deploy.dir}/jar"/>
|
||||
<mkdir dir="${deploy.dir}/source"/>
|
||||
<mkdir dir="${deploy.dir}/javadoc"/>
|
||||
<mkdir dir="${classes.dir}"/>
|
||||
<mkdir dir="${tclasses.dir}"/>
|
||||
<mkdir dir="${javadoc.dir}"/>
|
||||
<copy todir="${classes.dir}"><fileset dir="src/main/resources" includes="**"/></copy>
|
||||
<copy todir="${tclasses.dir}"><fileset dir="src/test/resources" includes="**"/></copy>
|
||||
</target>
|
||||
|
||||
<target name="check-ivy" depends="-init-ivy" description="Computes and prints Ivy classpath.">
|
||||
<pathconvert pathsep="${line.separator} " property="compile.str" refid="compile.classpath"/>
|
||||
<echo>Compile classpath:</echo>
|
||||
<echo> ${compile.str}</echo>
|
||||
<echo>Test classpath:</echo>
|
||||
<pathconvert pathsep="${line.separator} " property="test.str" refid="test.classpath"/>
|
||||
<echo> ${test.str}</echo>
|
||||
</target>
|
||||
|
||||
<target name="clean" description="Cleans out most build results.">
|
||||
<delete dir="${classes.dir}"/>
|
||||
<delete dir="${tclasses.dir}"/>
|
||||
<delete dir="${deploy.dir}/docs"/>
|
||||
<delete dir="${gwtjar.dir}"/>
|
||||
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.jar"/></delete>
|
||||
</target>
|
||||
|
||||
<target name="distclean" description="Completely cleans out build results.">
|
||||
<delete dir="${deploy.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="-prepare" description="Compiles main classes.">
|
||||
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
|
||||
debug="on" optimize="${build.optimize}" source="1.5" target="1.5" encoding="utf-8">
|
||||
<classpath refid="compile.classpath"/>
|
||||
<exclude name="com/samskivert/velocity/**"/>
|
||||
<exclude name="com/samskivert/xml/**"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<compilerarg value="-Xlint:-serial"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="test-compile" depends="compile" description="Compiles test classes.">
|
||||
<javac srcdir="${test.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
|
||||
debug="on" optimize="${build.optimize}" source="1.5" target="1.5" encoding="utf-8">
|
||||
<classpath>
|
||||
<pathelement location="${classes.dir}"/>
|
||||
<path refid="test.classpath"/>
|
||||
</classpath>
|
||||
<exclude name="com/samskivert/velocity/**"/>
|
||||
<exclude name="com/samskivert/xml/**"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<compilerarg value="-Xlint:-serial"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="javadoc" depends="-prepare" description="Builds javadocs.">
|
||||
<javadoc windowtitle="${lib.name} API"
|
||||
doctitle="${lib.name} API"
|
||||
overview="${src.dir}/${doc.overview}"
|
||||
destdir="${javadoc.dir}"
|
||||
additionalparam="-breakiterator"
|
||||
link="http://samskivert.com/code/samskivert/samskivert/docs/api/">
|
||||
<classpath refid="compile.classpath"/>
|
||||
<packageset dir="${src.dir}">
|
||||
<exclude name="com/samskivert/velocity/**"/>
|
||||
<exclude name="com/samskivert/xml/**"/>
|
||||
</packageset>
|
||||
<bottom>Copyright © 2000-${year} ${copyright.holder}. All Rights Reserved.</bottom>
|
||||
<link href="http://java.sun.com/j2se/1.4/docs/api/"/>
|
||||
</javadoc>
|
||||
<jar destfile="${deploy.dir}/javadoc/${lib.name}.jar" basedir="${javadoc.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="all" depends="clean,compile,javadoc,dist" description="Rebuilds everything."/>
|
||||
|
||||
<property name="test" value=""/>
|
||||
<target name="tests" depends="test-compile"
|
||||
description="Runs unit tests. Use -Dtest=Foo to run only FooTest.">
|
||||
<taskdef name="unit" classpathref="test.classpath"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
|
||||
<unit printsummary="off" haltonfailure="yes" fork="${junit.fork}">
|
||||
<classpath>
|
||||
<pathelement location="${classes.dir}"/>
|
||||
<pathelement location="${tclasses.dir}"/>
|
||||
<path refid="test.classpath"/>
|
||||
<fileset dir="lib/test" includes="*.jar"/>
|
||||
</classpath>
|
||||
<sysproperty key="test_dir" value="${tclasses.dir}"/>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<batchtest>
|
||||
<fileset dir="${test.dir}">
|
||||
<include name="**/*${test}*Test.java"/>
|
||||
<exclude name="com/samskivert/velocity/**"/>
|
||||
<exclude name="com/samskivert/xml/**"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</unit>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile" description="Builds jar files.">
|
||||
<jar destfile="${deploy.dir}/jar/${lib.name}.jar" basedir="${classes.dir}"/>
|
||||
<jar destfile="${deploy.dir}/source/${lib.name}.jar" basedir="${src.dir}"/>
|
||||
<!-- we export a small selection of classes for use by GWT -->
|
||||
<!-- TODO: what to do about this -gwt jar? Is there a way to publish it via Ivy
|
||||
that won't take six hours of my life to determine?
|
||||
<mkdir dir="${gwtjar.dir}"/>
|
||||
<copy todir="${gwtjar.dir}">
|
||||
<fileset dir="${src.dir}" includes="com/samskivert/Utils.gwt.xml"/>
|
||||
<fileset dir="${src.dir}" includes="com/samskivert/text/MessageUtil.java"/>
|
||||
<fileset dir="${src.dir}" includes="com/samskivert/util/ByteEnum.java"/>
|
||||
<fileset dir="${src.dir}" includes="com/samskivert/util/ByteEnumUtil.java"/>
|
||||
</copy>
|
||||
<jar basedir="${gwtjar.dir}" destfile="${deploy.dir}/${lib.name}-gwt.jar"/>
|
||||
<delete dir="${gwtjar.dir}"/>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<target name="gen-pom" depends="-prepare" description="Generates a POM file.">
|
||||
<ivy:makepom ivyfile="ivy.xml" pomfile="${deploy.dir}/${lib.name}.pom">
|
||||
<!-- this is kind of a hack, but we use 'compile' to indicate dependencies that -->
|
||||
<!-- will be "provided" and "runtime" to indicate our transitive dependencies -->
|
||||
<mapping conf="compile" scope="provided"/>
|
||||
<mapping conf="runtime" scope="compile"/>
|
||||
<mapping conf="test" scope="test"/>
|
||||
</ivy:makepom>
|
||||
</target>
|
||||
|
||||
<target name="publish" depends="dist,javadoc" description="Publishes jar to local repository.">
|
||||
<ivy:publish resolver="local" pubrevision="${revision}" forcedeliver="true">
|
||||
<artifacts pattern="${deploy.dir}/[type]/[artifact].[ext]"/>
|
||||
</ivy:publish>
|
||||
</target>
|
||||
|
||||
<target name="publish-remote" depends="publish" description="Publishes a public release.">
|
||||
<exec executable="svn">
|
||||
<arg value="checkout"/>
|
||||
<arg value="-N"/>
|
||||
<arg value="https://${lib.name}.googlecode.com/svn/releases/com.samskivert/${lib.name}"/>
|
||||
<arg value="temp"/>
|
||||
</exec>
|
||||
<mkdir dir="temp/${revision}"/>
|
||||
<copy todir="temp/${revision}">
|
||||
<fileset dir="${user.home}/.ivy2/local/com.samskivert/${lib.name}/${revision}">
|
||||
<include name="ivys/ivy.jar"/>
|
||||
<include name="jars/${lib.name}.jar"/>
|
||||
<include name="sources/${lib.name}.jar"/>
|
||||
<include name="javadocs/${lib.name}.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<exec executable="svn">
|
||||
<arg value="add"/>
|
||||
<arg value="temp/${revision}"/>
|
||||
</exec>
|
||||
<exec executable="svn">
|
||||
<arg value="commit"/>
|
||||
<arg value="-m"/>
|
||||
<arg value="Published release ${revision}."/>
|
||||
<arg value="temp"/>
|
||||
</exec>
|
||||
<delete dir="temp"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivy-module version="2.0" xmlns:mvn="http://ant.apache.org/ivy/maven">
|
||||
<info organisation="com.samskivert" module="samskivert" revision="${revision}">
|
||||
<description homepage="http://code.google.com/p/samskivert"/>
|
||||
</info>
|
||||
<configurations>
|
||||
<conf name="default" visibility="public" extends="runtime,master"/>
|
||||
<conf name="master" visibility="public"/>
|
||||
<conf name="provided" visibility="public"/>
|
||||
<conf name="runtime" visibility="public"/>
|
||||
<conf name="sources" visibility="public"/>
|
||||
<conf name="javadoc" visibility="public"/>
|
||||
<conf name="optional" visibility="public"/>
|
||||
<conf name="compile" visibility="private" extends="runtime,provided,optional"/>
|
||||
<conf name="test" visibility="private" extends="compile"/>
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact type="jar"/>
|
||||
<artifact type="source" ext="jar" mvn:classifier="sources"/>
|
||||
<artifact type="javadoc" ext="jar" mvn:classifier="javadoc"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="provided->master(*)"/>
|
||||
<dependency org="log4j" name="log4j" rev="1.2.15" conf="optional->master(*)"/>
|
||||
<dependency org="javax.mail" name="mail" rev="1.4.1" conf="optional->master(*)"/>
|
||||
<dependency org="junit" name="junit" rev="4.8.1" conf="test->master(*)"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
Reference in New Issue
Block a user