Files
spring-ldap/common-build/jdiff-targets.xml

204 lines
9.6 KiB
XML

<?xml version="1.0"?>
<!--
Copyright 2002-2005 the original author or authors.
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.
- - -
Author: Ulrik Sandberg
Ant XML fragment that contains useful targets for working with jdiff.
This ant XML fragment is meant to be imported into a project build file, along with
common-targets.xml. This is an optional module, and due to the way the ant import works,
there is no way to automatically hook this up into the build. The importing project
must override appropropriate 'hook' targets from common-targets.xml, and then have
the override targets depend on both the targets from common-targets and those from here.
Note, for jdiff to work:
- Make sure the jdiff.home property points to where JDiff is installed.
- Make sure the old.dir property points to where the previous source is.
-->
<project name="jdiff-targets" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<import file="common-targets.xml" />
<target name="svn.tasks" depends="retrieve">
<typedef resource="svntask.properties" classpathref="compile.classpath" />
</target>
<target name="-check.svn" depends="svn.tasks">
<available property="svn.installed" classname="org.tigris.subversion.svnant.SvnTask" classpathref="compile.classpath" />
</target>
<target name="guard.nosvn" depends="-check.svn" unless="svn.installed">
<fail message="The target you are attempting to run requires Subversion for Ant (svnant), which doesn't appear to be installed." />
</target>
<target name="-check.jdiff">
<available property="jdiff.installed" classname="jdiff.JDiff" classpath="${jdiff.home}/lib/jdiff.jar" />
</target>
<target name="guard.nojdiff" depends="-check.jdiff" unless="jdiff.installed">
<fail message="The target you are attempting to run requires JDiff, which doesn't appear to be installed." />
</target>
<!-- ======================================================= -->
<!-- Run all the steps used to produce Javadoc and JDiff HTML reports -->
<!-- ======================================================= -->
<!-- war: Creates primary web-app in war format -->
<target name="jdiff" depends="jdiff.main, jdiff.stage" description="Create the jdiff in .zip format" />
<target name="jdiff.main" depends="init-jdiff,guard.nojdiff,checkout.old.src,compile,javadoc_old,javadoc_new,jdiff_old_api,jdiff_new_api,jdiff_compare_apis"/>
<target name="jdiff.stage">
<mkdir dir="${target.artifacts.dir}/jdiff"/>
<property name="jdiff.name" value="jdiff-${project.old.version}-${project.version}"/>
<zip destfile="${target.artifacts.dir}/jdiff/${jdiff.name}.zip">
<zipfileset prefix="${jdiff.name}" dir="${target.javadocs.new.dir}" />
<zipfileset prefix="${jdiff.name}" dir="${target.javadocs.old.dir}" />
</zip>
</target>
<target name="init-jdiff">
<property name="build.home" location="${basedir}/../build-spring-ldap" />
<property name="jdiff.home" location="${build.home}/jdiff" />
<property name="target.jdiff.dir" location="${target.dir}/jdiff"/>
<property name="target.jdiff.reports.dir" location="${target.jdiff.dir}/reports"/>
<property name="project.old.title" value="Spring LDAP" />
<property name="project.old.version" value="1.1.2" />
<property name="old.src.dir" location="${target.jdiff.dir}/spring-ldap-${project.old.version}" />
<property name="old.url" value="https://svn.sourceforge.net/svnroot/springframework/spring-ldap/tags/spring-ldap-${project.old.version}/spring-ldap/spring-ldap" />
<property name="old.src.url" value="${old.url}/src/main/java" />
<property name="old.packages" value="org.springframework.ldap.*" />
<property name="target.javadocs.old.dir" location="${target.jdiff.dir}/javadocs.old" />
<property name="new.src.dir" location="${src.java.main.dir}" />
<property name="new.packages" value="org.springframework.ldap.*" />
<property name="target.javadocs.new.dir" location="${target.jdiff.dir}/javadocs" />
<property name="base.uri" value="http://www.w3.org" />
</target>
<target name="-check.old.src">
<available property="old.src.already.available" type="dir" file="${old.src.dir}" />
</target>
<target name="checkout.old.src" unless="old.src.already.available" depends="guard.nosvn,-check.old.src">
<svn>
<checkout url="${old.src.url}" destPath="${old.src.dir}" />
</svn>
</target>
<!-- ======================================================= -->
<!-- Create the directories for the Javadoc output -->
<!-- ======================================================= -->
<target name="create_javadoc_dirs" depends="init">
<mkdir dir="${target.javadocs.old.dir}" />
<mkdir dir="${target.javadocs.new.dir}" />
<mkdir dir="${target.jdiff.reports.dir}" />
</target>
<!-- ======================================================= -->
<!-- Produce Javadoc HTML for the old API -->
<!-- ======================================================= -->
<target name="javadoc_old" depends="create_javadoc_dirs">
<javadoc private="yes" sourcepath="${old.src.dir}" destdir="${target.javadocs.old.dir}" verbose="no" packagenames="${old.packages}" doctitle="${project.old.title} ${project.old.version}" windowtitle="${project.old.title} ${project.old.version} API" bottom="${project.copyright}">
<classpath>
<path refid="compile.classpath" />
<path location="${target.classes.dir}" />
</classpath>
</javadoc>
</target>
<!-- ======================================================= -->
<!-- Produce Javadoc HTML for the new API -->
<!-- ======================================================= -->
<target name="javadoc_new" depends="create_javadoc_dirs">
<antcall target="javadoc">
<param name="target.javadocs.dir" location="${target.javadocs.new.dir}"/>
</antcall>
</target>
<!-- ======================================================= -->
<!-- Use Javadoc with the JDiff doclet to generate an XML file -->
<!-- representing the old API -->
<!-- ======================================================= -->
<target name="jdiff_old_api" depends="create_javadoc_dirs">
<javadoc sourcepath="${old.src.dir}" packagenames="${old.packages}">
<doclet name="jdiff.JDiff" path="${jdiff.home}/lib/jdiff.jar:${jdiff.home}/lib/xerces.jar">
<param name="-apiname" value="${project.old.title} ${project.old.version}" />
<param name="-apidir" value="${target.jdiff.reports.dir}" />
<param name="-baseURI" value="${base.uri}" />
</doclet>
<classpath>
<path refid="compile.classpath" />
<path location="${target.classes.dir}" />
</classpath>
</javadoc>
</target>
<!-- ======================================================= -->
<!-- Use Javadoc with the JDiff doclet to generate an XML file -->
<!-- representing the new API -->
<!-- ======================================================= -->
<target name="jdiff_new_api" depends="create_javadoc_dirs">
<javadoc sourcepath="${new.src.dir}" packagenames="${new.packages}">
<doclet name="jdiff.JDiff" path="${jdiff.home}/lib/jdiff.jar:${jdiff.home}/lib/xerces.jar">
<param name="-apiname" value="${project.title} ${project.version}" />
<param name="-apidir" value="${target.jdiff.reports.dir}" />
<param name="-baseURI" value="${base.uri}" />
</doclet>
<classpath>
<path refid="compile.classpath" />
<path location="${target.classes.dir}" />
</classpath>
</javadoc>
</target>
<!-- ======================================================= -->
<!-- Use Javadoc with the JDiff doclet to compare the two XML files -->
<!-- representing the old and new APIs, and generate an HTML report -->
<!-- describing the differences between the two APIs -->
<!-- ======================================================= -->
<target name="jdiff_compare_apis" depends="create_javadoc_dirs">
<!-- To use this task with JDK 1.4, use ANT 1.5 and change -->
<!-- packagenames to sourcefiles. -->
<javadoc private="yes" sourcepath="${jdiff.home}" destdir="${target.javadocs.new.dir}" sourcefiles="${jdiff.home}/lib/Null.java">
<doclet name="jdiff.JDiff" path="${jdiff.home}/lib/jdiff.jar:${jdiff.home}/lib/xerces.jar">
<param name="-stats" />
<param name="-oldapidir" value="${target.jdiff.reports.dir}" />
<param name="-oldapi" value="${project.old.title} ${project.old.version}" />
<param name="-newapidir" value="${target.jdiff.reports.dir}" />
<param name="-newapi" value="${project.title} ${project.version}" />
<!-- We could use a file:/// prefix to refer to Javadoc files, or -->
<!-- we could make them relative to the changes directory. -->
<!-- Remember to add a trailing forward slash. -->
<param name="-javadocold" value="../../javadocs.old/" />
<param name="-javadocnew" value="../" />
</doclet>
<classpath>
<path refid="compile.classpath" />
</classpath>
</javadoc>
<!-- Copy two image files. black.gif is only needed because -stats was -->
<!-- used -->
<copy file="${jdiff.home}/lib/background.gif" todir="${target.javadocs.new.dir}" />
<copy file="${jdiff.home}/lib/black.gif" todir="${target.javadocs.new.dir}" />
</target>
</project>