Xml文件  |  138行  |  4.33 KB

<project name="testing-log4j-bridge" default="usage" basedir=".">

	<property name="lbversion" value="0.9.8-SNAPSHOT" />
    <property name="slf4jversion" value="1.4.2" />
	<property name="source.home" value="./src/main/java/" />
	<property name="javac.dest.12" value="./target/classes12/" />
	<property name="javac.dest.13" value="./target/classes13/" />
	<property name="lib" value="./lib" />

	<property name="deprecation" value="on" />

	<path id="basic.classpath">
		<pathelement location="${source.home}" />
		<pathelement location="${lib}/junit-3.8.1.jar" />
	</path>

	<path id="log4j12.classpath">
		<path refid="basic.classpath" />
		<pathelement location="${javac.dest.12}" />
		<pathelement location="${lib}/log4j-1.2.14.jar" />
	</path>

	<path id="log4j13.classpath">
		<path refid="basic.classpath" />
		<pathelement location="${javac.dest.13}" />
		<pathelement location="${lib}/log4j-1.3alpha-8.jar" />
	</path>

	<path id="los.classpath">
		<path refid="basic.classpath" />
		<pathelement location="${lib}/log4j-over-slf4j-${slf4jversion}.jar" />
		<pathelement location="${lib}/logback-classic-${lbversion}.jar" />
		<pathelement location="${lib}/logback-core-${lbversion}.jar" />
		<pathelement location="${lib}/slf4j-api-${slf4jversion}.jar" />
	</path>

	<!-- ================================================================= -->
	<!-- Default target                                                    -->
	<!-- ================================================================= -->
	<target name="usage">
		<echo>      
      These are some of the targets supported by this ANT build scpript:

      all - run all available tests
      refresh - copy required jar files to the lib directory
    </echo>
	</target>

  <delete>
    <fileset dir="." includes="**/*.bak"/>
  </delete>

  <target name="refresh">
    <delete>
      <fileset dir="lib">
        <include name="logback-*.jar"/>
        <include name="log4j-bridge-*.jar"/>
      </fileset>
    </delete>
    <copy file="../../slf4j-api/target/slf4j-api-${slf4jversion}.jar" todir="lib/"/>
    <copy file="../target/log4j-over-slf4j-${slf4jversion}.jar" todir="lib/"/>

  </target>


	<target name="init">
		<mkdir dir="${javac.dest.12}" />
		<mkdir dir="${javac.dest.13}" />
	</target>

	<target name="clean">
		<delete>
			<fileset dir="${javac.dest.12}" includes="**" />
			<fileset dir="${javac.dest.13}" includes="**" />
		</delete>
	</target>

	<target name="build_log4j12" depends="init">
		<javac srcdir="${source.home}" 
			     destdir="${javac.dest.12}" 
			     includes="**/Log4j12Calls.java" 
			     deprecation="${deprecation}" debug="on">
			<classpath refid="log4j12.classpath" />
		</javac>
	</target>

	<target name="build_log4j13" depends="init">
		<javac srcdir="${source.home}" 
			     destdir="${javac.dest.13}" 
			     includes="**/Log4j13Calls.java" deprecation="${deprecation}" debug="on">
			<classpath refid="log4j13.classpath" />
		</javac>
	</target>
	
	<target name="build_loggerTest" depends="init">
		<javac srcdir="${source.home}" 
			     destdir="${javac.dest.12}" 
			     includes="**/LoggerTest.java" 
			     deprecation="${deprecation}" debug="on">
			<classpath refid="los.classpath" />
		</javac>
	</target>

	<!-- ================================================================= -->
	<!-- Run tests                                                     -->
	<!-- ================================================================= -->
	<target name="all" depends="test12, test13, loggerTest" />


	<target name="loggerTest" depends="build_loggerTest">
		<junit printsummary="yes" fork="yes" haltonfailure="yes">
			<classpath refid="los.classpath" />
			<classpath location="${javac.dest.12}" />
			<formatter type="plain" usefile="false" />
			<test name="test.LoggerTest" />
		</junit>
	</target>
	
	<target name="test12" depends="build_log4j12">
		<junit printsummary="yes" fork="yes" haltonfailure="yes">
			<classpath refid="los.classpath" />
			<classpath location="${javac.dest.12}" />
			<formatter type="plain" usefile="false" />
			<test name="test.Log4j12Calls" />
		</junit>
	</target>

	<target name="test13" depends="build_log4j13">
		<junit printsummary="yes" fork="yes" haltonfailure="yes">
			<classpath refid="los.classpath" />
			<classpath location="${javac.dest.13}" />
			<formatter type="plain" usefile="false" />
			<test name="test.Log4j13Calls" />
		</junit>
	</target>

</project>