<?xml version="1.0" encoding="UTF-8" ?>
<!-- ======================================================================
     ブランクプロジェクトをビルドするスクリプト
     ====================================================================== -->
<project name="project" default="deploy" basedir="..">

  <!-- プロパティの読み込み -->
  <property file="./ant/build.properties" />

      <!-- クラスパスの設定 -->
        <property name="classpath.lib"
               value="${lib.dir}/aspectjweaver-1.6.12.jar;
                      ${lib.dir}/castor-1.0.5.jar;
                      ${lib.dir}/cglib-nodep-2.1_3.jar;
                      ${lib.dir}/commons-beanutils-1.8.3.jar;
                      ${lib.dir}/commons-collections-3.2.jar;
                      ${lib.dir}/commons-digester-1.8.jar;
                      ${lib.dir}/commons-fileupload-1.2.jar;
                      ${lib.dir}/commons-io-1.3.2.jar;
                      ${lib.dir}/commons-jxpath-1.3.jar;
                      ${lib.dir}/commons-lang-2.5.jar;
                      ${lib.dir}/commons-logging-1.1.1.jar;
                      ${lib.dir}/commons-validator-1.3.1.jar;
                      ${lib.dir}/jakarta-oro-2.0.8.jar;
                      ${lib.dir}/log4j-1.2.16.jar;
                      ${lib.dir}/mybatis-2.3.5.jar;
                      ${lib.dir}/spring-modules-validation-0.8.jar;
                      ${lib.dir}/terasoluna-commons-2.0.5.0.jar;
                      ${lib.dir}/terasoluna-dao-2.0.5.0.jar;
                      ${lib.dir}/terasoluna-ibatis-2.0.5.0.jar;
                      ${lib.dir}/terasoluna-oxm-2.0.5.0.jar;
                      ${lib.dir}/terasoluna-rich-2.0.5.0.jar;
                      ${lib.dir}/terasoluna-validator-2.0.5.0.jar;
                      ${lib.dir}/velocity-1.5.jar;
                      ${lib.dir}/velocity-tools-view-1.4.jar;
                      ${lib.dir}/xercesImpl-2.9.0.jar;
                      ${lib.dir}/spring-jdbc-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-orm-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-core-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-web-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-beans-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-tx-3.1.3.RELEASE.jar;
                      ${lib.dir}/aopalliance-1.0.jar;
                      ${lib.dir}/spring-aop-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-asm-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-webmvc-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-context-support-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-expression-3.1.3.RELEASE.jar;
                      ${lib.dir}/spring-context-3.1.3.RELEASE.jar;
                      ${webapsvr.lib.dir}/servlet-api.jar;"/>

  <!-- =================================
          Warファイル、コンパイルされたクラスファイルの削除を行う。
       ================================= -->
  <target name="clean" description="war、クラスファイルの削除">
    <delete file="${deploy.dir}/${context.name}.war" failonerror="false" />
    <delete includeEmptyDirs="true" failonerror="false">
      <fileset dir="${web.inf.dir}/classes" includes="**/*"/>
    </delete>
  </target>

  <!-- =================================
          コンパイルを行う。
       ================================= -->
  <target name="compile" depends="clean" description="コンパイル実行">
    <mkdir dir="${web.inf.dir}/classes" />
    <javac srcdir="${source.dir}"
        destdir="${web.inf.dir}/classes"
        classpath="${classpath.lib}"
        debug="on" />
    <copy todir="${web.inf.dir}/classes">
      <fileset dir="${source.dir}">
        <include name="**/*.xml" />
        <include name="**/*.xsd" />
      </fileset>
    </copy>
  </target>

  <!-- =================================
          native2asciiにてプロパティファイルのコード変換を行う。
       ================================= -->
  <target name="native2ascii" depends="compile"
      description="プロパティファイルのコード変換">
    <delete file="${web.inf.dir}/classes">
      <include name="*.properties"/>
    </delete>
    <native2ascii encoding="Windows-31J" src="${source.dir}" 
        dest="${web.inf.dir}/classes"
        includes="*.properties" ext=".properties" />
  </target>

  <!-- =================================
          プロジェクトのデプロイを行う。
       ================================= -->
  <target name="deploy" depends="native2ascii" description="デプロイ実行">
    <delete file="${deploy.dir}/${context.name}.war" failonerror="false" />
    <delete file="${context.name}.war" failonerror="false" />
    <jar jarfile="${context.name}.war" basedir="./webapps"/>
    <copy file="${context.name}.war" todir="${deploy.dir}"/>
    <delete file="${context.name}.war" failonerror="false" />
  </target>

  <!-- =================================
          JavaDocの生成を行う。
       ================================= -->
  <target name="createJavaDoc" description="JavaDoc生成">
    <delete dir="./doc/javadoc" />
    <mkdir dir="./doc/javadoc" />
    <javadoc classpath="${classpath.lib}" 
        sourcepath="${source.dir}" destdir="./doc/javadoc"
        doctitle="${context.name}" windowtitle="${context.name}"
        use="true" splitindex="true"
        encoding="Windows-31J"
        private="true"
        packagenames="**/*">
    </javadoc>
  </target>
</project>
