<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!-- ====================================================================== 
     JBoss to Geronimo Migration Samples
     ====================================================================== -->
<project name="College" default="all">
    <property name="src.dir" value="src"/>
    <property name="dest.dir" value="releases"/>
    <property name="web.dir" value="web"/>
    <property name="config.dir" value="config"/>
    
    <property file="${config.dir}/build.properties"/>
    
    <target name="all" depends="geronimo,jboss">
        <!-- Delete whole file structure -->
        <delete dir="${dest.dir}/war"/>     
    </target>
    
    <target name="compile-geronimo" depends="init">
        <copy todir="${dest.dir}/war/geronimo">
            <fileset dir="${web.dir}"/>
        </copy>
        
        <!-- Delete unnecessary file for Geronimo deployment from WAR file -->
        <delete file="${dest.dir}/war/geronimo/WEB-INF/jboss-web.xml"/>
        
        <mkdir dir="${dest.dir}/war/geronimo/WEB-INF/classes"/>
        <javac srcdir="${src.dir}"
            destdir="${dest.dir}/war/geronimo/WEB-INF/classes">
            <classpath
                path="${geronimo.home}/repository/org/apache/geronimo/specs/geronimo-j2ee_1.4_spec/1.1/geronimo-j2ee_1.4_spec-1.1.jar"/>
        </javac>
    </target>
    
    <target name="compile-jboss" depends="init">
        <copy todir="${dest.dir}/war/jboss">
            <fileset dir="${web.dir}" />
        </copy>
        
        <!-- Delete unnecessary file for JBoss deployment from WAR file -->
        <delete file="${dest.dir}/war/jboss/WEB-INF/geronimo-web.xml"/>
        
        <mkdir dir="${dest.dir}/war/jboss/WEB-INF/classes"/>
        <javac srcdir="${src.dir}"
            destdir="${dest.dir}/war/jboss/WEB-INF/classes">
            <classpath
                path="${geronimo.home}/repository/org/apache/geronimo/specs/geronimo-j2ee_1.4_spec/1.1/geronimo-j2ee_1.4_spec-1.1.jar"/>
        </javac>
    </target>

    <target name="geronimo" depends="compile-geronimo">
      <jar destfile="${dest.dir}/geronimo/college_fest.war">
            <zipfileset dir="${dest.dir}/war/geronimo"/>
       </jar>
    </target>
    
    <target name="jboss" depends="compile-jboss">
        <jar destfile="${dest.dir}/jboss/college_fest.war">
            <zipfileset dir="${dest.dir}/war/jboss"/>
        </jar>  
    </target>
    
    <target name="init">
        <mkdir dir="${dest.dir}/war"/>
        <mkdir dir="${dest.dir}/war/geronimo"/>
        <mkdir dir="${dest.dir}/war/jboss"/>
        <mkdir dir="${dest.dir}/geronimo"/>
        <mkdir dir="${dest.dir}/jboss"/>
    </target>   

</project>

