<project name="lbcore" default="usage" basedir=".">

	<property file="build.properties" />

	<!-- The base directory relative to which most targets are built -->
	<property name="base" value="." />

	<property name="source.home" value="./src/main/java/" />
	<property name="javac.dest" value="./target/classes" />
	
	<property name="deprecation" value="on" />
	<property name="debug" value="on" />

	<!-- The stem where most LB core source code is located. -->
	<property name="stem" value="com/logback/core" />



	<path id="core.classpath">
		<pathelement location="${source.home}" />
		<pathelement location="${javac.dest}" />
		<pathelement location="lib/janino.jar"/>
	</path>


	<!-- ================================================================= -->
	<!--                        TARGETS                                    -->
	<!-- ================================================================= -->



	<!-- ================================================================= -->
	<!-- Default target                                                    -->
	<!-- ================================================================= -->

	<target name="usage">
		<echo>
      
      These are the targets supported by this ANT build scpript:
      
      build - compile all project files, if a certain library is missing, 
              then the compilation of its dependents are skipped.
    </echo>
	</target>

	<target name="prepare">
		<mkdir dir="${javac.dest}" />
	</target>

	<!-- ================================================================= -->
	<!-- Remove all generated files such as compiled class files and test  -->
	<!-- case output.                                                     -->
	<!-- ================================================================= -->
	<target name="clean">
		<delete dir="${javac.dest}/" />
	</target>

	<!-- ================================================================= -->
	<!-- Compile test cases and related source files.                      -->
	<!-- ================================================================= -->
	<target name="build" depends="prepare">
		<javac srcdir="${source.home}" destdir="${javac.dest}" 
			excludes="${stem}/xynz/toto.java" 
			deprecation="${deprecation}" 
			debug="${debug}">
			<classpath refid="core.classpath" />
		</javac>
	</target>


	 <target name="logback-core.jar" depends="build">
	    <delete>
	      <fileset dir=".">
	        <include name="logback-core*.jar"/>
	      </fileset>
	    </delete>

	    <jar jarfile="logback-core-${version}.jar" basedir="${javac.dest}"
	         includes="${stem}/**/*.class"
	          excludes="**/*Test**">

	      <manifest>
	        <section name="com/logback/core">
	          <attribute name="Implementation-Title" value="LOGBack-core"/>
	          <attribute name="Implementation-Version" value="${version}"/>
	          <attribute name="Implementation-Vendor" value="LOGBack.com"/>
	        </section>
	      </manifest>
	    </jar>
	  </target>


</project>
