<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
 * Copyright 2014 Skynav, Inc. All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY SKYNAV, INC. AND ITS CONTRIBUTORS “AS IS” AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL SKYNAV, INC. OR ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project name="cap2tt" basedir="." default="clean-test">

<property environment="env"/>
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>

<property name="build.dir" value="${basedir}/bld"/>
<property name="ext.dir" value="${basedir}/ext"/>
<property name="release.dir" value="${basedir}/dst"/>
<property name="source.dir" value="${basedir}/src"/>

<property name="artifacts.dir" value="${build.dir}/artifacts"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="resources.dir" value="${build.dir}/resources"/>
<property name="ext.lib.dir" value="${ext.dir}/lib"/>
<property name="source.dir" value="${source.dir}"/>
<property name="test.dir" value="${basedir}/tst"/>
<property name="test.classes.dir" value="${build.dir}/test-classes"/>
<property name="test.resources.dir" value="${build.dir}/test-resources"/>

<property name="cap2tt.source.dir" value="${source.dir}/java"/>
<property name="cap2tt.classes.dir" value="${classes.dir}"/>
<property name="cap2tt.resources.source.dir" value="${source.dir}/resources"/>
<property name="cap2tt.resources.dir" value="${resources.dir}"/>
<property name="cap2tt.test.source.dir" value="${test.dir}/java"/>
<property name="cap2tt.test.resources.source.dir" value="${test.dir}/resources"/>
<property name="cap2tt.test.classes.dir" value="${test.classes.dir}"/>
<property name="cap2tt.test.resources.dir" value="${test.resources.dir}"/>

<property name="cap2tt.jar" value="cap2tt.jar"/>
<property name="cap2tt.source.jar" value="cap2tt-source.jar"/>
<property name="cap2tt.main.class" value="com/skynav/cap2tt/app/Converter"/>
<property name="cap2tt.main.classname" value="com.skynav.cap2tt.app.Converter"/>
<property name="cap2tt.target" value="${artifacts.dir}/${cap2tt.jar}"/>
<property name="cap2tt.source.target" value="${artifacts.dir}/${cap2tt.source.jar}"/>
<property name="cap2tt.title" value="CAP To TTML Converter"/>
<property name="cap2tt.version.major" value="1"/>
<property name="cap2tt.version.minor" value="0"/>
<property name="cap2tt.version.micro" value="0"/>
<property name="cap2tt.version.suffix" value="dev"/>
<property name="cap2tt.version" value="${cap2tt.version.major}.${cap2tt.version.minor}.${cap2tt.version.micro}${cap2tt.version.suffix}"/>
<property name="cap2tt.vendor" value="Skynav, Inc."/>
<property name="cap2tt.release.target" value="${release.dir}/cap2tt-bin-${cap2tt.version}.jar"/>

<property name="ttv.jar" value="${ext.lib.dir}/ttv.jar"/>

<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="true"/>
<property name="javac.fork" value="false"/>
<property name="javac.optimize" value="false"/>
<property name="javac.source" value="1.6"/>
<property name="javac.target" value="1.6"/>

<presetdef name="javac">
  <javac
    debug="${javac.debug}"
    deprecation="${javac.deprecation}"
    fork="${javac.fork}"
    includeantruntime="true"
    optimize="${javac.optimize}"
    source="${javac.source}"
    target="${javac.target}"
    encoding="utf-8"
  >
    <compilerarg value="-Xlint:unchecked"/>
  </javac>
</presetdef>

<property name="junit.errorproperty" value="junit.error"/>
<property name="junit.failureproperty" value="junit.failure"/>
<property name="junit.fork" value="true"/>
<property name="junit.forkmode" value="once"/>
<property name="junit.formatter.brief" value="false"/>
<property name="junit.haltonfailure" value="true"/>
<property name="junit.output.dir" value="${build.dir}/test-output"/>
<property name="junit.printsummary" value="true"/>

<path id="junit.libs.classpath">
  <fileset dir="${ext.lib.dir}">
    <include name="junit-4.11.jar"/>
    <include name="hamcrest-core-1.3.jar"/>
  </fileset>
</path>

<path id="default-junit-classpath">
  <path refid="junit.libs.classpath"/>
  <pathelement location="${cap2tt.target}"/>
  <pathelement location="${cap2tt.test.classes.dir}"/>
  <pathelement location="${cap2tt.test.resources.dir}"/>
</path>

<macrodef name="junit-run">
  <attribute name="testsuite"/>
  <attribute name="outfile"/>
  <attribute name="classpath" default="default-junit-classpath"/>
  <sequential>
    <condition property="junit.formatter.brief.use">
      <istrue value="${junit.formatter.brief}"/>
    </condition>
    <mkdir dir="${junit.output.dir}"/>
    <junit
      errorproperty="${junit.errorproperty}"
      failureproperty="${junit.failureproperty}"
      fork="${junit.fork}"
      forkmode="${junit.forkmode}"
      haltonfailure="${junit.haltonfailure}"
      includeantruntime="true"
      printsummary="${junit.printsummary}">
      <jvmarg value="-ea"/>
      <sysproperty key="java.awt.headless" value="true"/>
      <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
      <formatter type="plain" usefile="true"/>
      <formatter type="xml" usefile="true"/>
      <classpath>
        <path refid="@{classpath}"/>
      </classpath>
      <assertions>
        <enable/>
      </assertions>
      <test name="@{testsuite}" todir="${junit.output.dir}" outfile="@{outfile}"/>
    </junit>
  </sequential>
</macrodef>

<target name="generate-code"/>

<target name="compile-cap2tt">
  <mkdir dir="${cap2tt.classes.dir}"/>
  <javac destdir="${cap2tt.classes.dir}">
    <src path="${cap2tt.source.dir}"/>
    <classpath>
      <path location="${ttv.jar}"/>
    </classpath>
  </javac>
  <mkdir dir="${cap2tt.resources.dir}"/>
  <copy todir="${cap2tt.resources.dir}">
    <fileset dir="${cap2tt.resources.source.dir}"/>
  </copy>
</target>

<target name="compile-cap2tt-tests" depends="compile-cap2tt">
  <mkdir dir="${cap2tt.test.classes.dir}"/>
  <javac destdir="${cap2tt.test.classes.dir}">
    <src path="${cap2tt.test.source.dir}"/>
    <classpath>
      <path refid="junit.libs.classpath"/>
      <path location="${cap2tt.classes.dir}"/>
      <path location="${cap2tt.resources.dir}"/>
      <path location="${ttv.jar}"/>
    </classpath>
  </javac>
  <mkdir dir="${cap2tt.test.resources.dir}"/>
  <copy todir="${cap2tt.test.resources.dir}">
    <fileset dir="${cap2tt.test.resources.source.dir}"/>
  </copy>
</target>

<target name="ensure-artifacts-directory">
  <mkdir dir="${artifacts.dir}"/>
</target>

<target name="ensure-cap2tt-artifacts-directory" depends="ensure-artifacts-directory"/>

<target name="build-cap2tt-jars" depends="compile-cap2tt">
  <tstamp>
    <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  </tstamp>
  <property name="build.id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  <jar jarfile="${cap2tt.target}">
    <fileset dir="${cap2tt.classes.dir}"/>
    <fileset dir="${cap2tt.resources.dir}"/>
    <manifest>
      <attribute name="Implementation-Title" value="${cap2tt.title}"/>
      <attribute name="Implementation-Version" value="${cap2tt.version}"/>
      <attribute name="Implementation-Vendor" value="${cap2tt.vendor}"/>
      <attribute name="Build-Id" value="${build.id}"/>
      <attribute name="Main-Class" value="${cap2tt.main.class}"/>
    </manifest>
  </jar>
  <jar jarfile="${cap2tt.source.target}">
    <fileset dir="${basedir}">
      <include name="build.xml"/>
      <include name="README.md"/><commit_msg>Create both full and minimum binary jars.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
 * Copyright 2014 Skynav, Inc. All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY SKYNAV, INC. AND ITS CONTRIBUTORS “AS IS” AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL SKYNAV, INC. OR ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project name="cap2tt" basedir="." default="clean-test">

<property environment="env"/>
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>

<property name="build.dir" value="${basedir}/bld"/>
<property name="ext.dir" value="${basedir}/ext"/>
<property name="release.dir" value="${basedir}/dst"/>
<property name="source.dir" value="${basedir}/src"/>

<property name="artifacts.dir" value="${build.dir}/artifacts"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="resources.dir" value="${build.dir}/resources"/>
<property name="ext.lib.dir" value="${ext.dir}/lib"/>
<property name="source.dir" value="${source.dir}"/>
<property name="test.dir" value="${basedir}/tst"/>
<property name="test.classes.dir" value="${build.dir}/test-classes"/>
<property name="test.resources.dir" value="${build.dir}/test-resources"/>

<property name="cap2tt.source.dir" value="${source.dir}/java"/>
<property name="cap2tt.classes.dir" value="${classes.dir}"/>
<property name="cap2tt.resources.source.dir" value="${source.dir}/resources"/>
<property name="cap2tt.resources.dir" value="${resources.dir}"/>
<property name="cap2tt.test.source.dir" value="${test.dir}/java"/>
<property name="cap2tt.test.resources.source.dir" value="${test.dir}/resources"/>
<property name="cap2tt.test.classes.dir" value="${test.classes.dir}"/>
<property name="cap2tt.test.resources.dir" value="${test.resources.dir}"/>

<property name="cap2tt.jar" value="cap2tt.jar"/>
<property name="cap2tt.min.jar" value="cap2tt-minimum.jar"/>
<property name="cap2tt.source.jar" value="cap2tt-source.jar"/>
<property name="cap2tt.main.class" value="com/skynav/cap2tt/app/Converter"/>
<property name="cap2tt.main.classname" value="com.skynav.cap2tt.app.Converter"/>
<property name="cap2tt.target" value="${artifacts.dir}/${cap2tt.jar}"/>
<property name="cap2tt.min.target" value="${artifacts.dir}/${cap2tt.min.jar}"/>
<property name="cap2tt.source.target" value="${artifacts.dir}/${cap2tt.source.jar}"/>
<property name="cap2tt.title" value="CAP To TTML Converter"/>
<property name="cap2tt.version.major" value="1"/>
<property name="cap2tt.version.minor" value="0"/>
<property name="cap2tt.version.micro" value="0"/>
<property name="cap2tt.version.suffix" value="dev"/>
<property name="cap2tt.version" value="${cap2tt.version.major}.${cap2tt.version.minor}.${cap2tt.version.micro}${cap2tt.version.suffix}"/>
<property name="cap2tt.vendor" value="Skynav, Inc."/>
<property name="cap2tt.release.target" value="${release.dir}/cap2tt-bin-${cap2tt.version}.jar"/>

<property name="ttv.jar" value="${ext.lib.dir}/ttv.jar"/>

<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="true"/>
<property name="javac.fork" value="false"/>
<property name="javac.optimize" value="false"/>
<property name="javac.source" value="1.6"/>
<property name="javac.target" value="1.6"/>

<presetdef name="javac">
  <javac
    debug="${javac.debug}"
    deprecation="${javac.deprecation}"
    fork="${javac.fork}"
    includeantruntime="true"
    optimize="${javac.optimize}"
    source="${javac.source}"
    target="${javac.target}"
    encoding="utf-8"
  >
    <compilerarg value="-Xlint:unchecked"/>
  </javac>
</presetdef>

<property name="junit.errorproperty" value="junit.error"/>
<property name="junit.failureproperty" value="junit.failure"/>
<property name="junit.fork" value="true"/>
<property name="junit.forkmode" value="once"/>
<property name="junit.formatter.brief" value="false"/>
<property name="junit.haltonfailure" value="true"/>
<property name="junit.output.dir" value="${build.dir}/test-output"/>
<property name="junit.printsummary" value="true"/>

<path id="junit.libs.classpath">
  <fileset dir="${ext.lib.dir}">
    <include name="junit-4.11.jar"/>
    <include name="hamcrest-core-1.3.jar"/>
  </fileset>
</path>

<path id="default-junit-classpath">
  <path refid="junit.libs.classpath"/>
  <pathelement location="${cap2tt.target}"/>
  <pathelement location="${cap2tt.test.classes.dir}"/>
  <pathelement location="${cap2tt.test.resources.dir}"/>
</path>

<macrodef name="junit-run">
  <attribute name="testsuite"/>
  <attribute name="outfile"/>
  <attribute name="classpath" default="default-junit-classpath"/>
  <sequential>
    <condition property="junit.formatter.brief.use">
      <istrue value="${junit.formatter.brief}"/>
    </condition>
    <mkdir dir="${junit.output.dir}"/>
    <junit
      errorproperty="${junit.errorproperty}"
      failureproperty="${junit.failureproperty}"
      fork="${junit.fork}"
      forkmode="${junit.forkmode}"
      haltonfailure="${junit.haltonfailure}"
      includeantruntime="true"
      printsummary="${junit.printsummary}">
      <jvmarg value="-ea"/>
      <sysproperty key="java.awt.headless" value="true"/>
      <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
      <formatter type="plain" usefile="true"/>
      <formatter type="xml" usefile="true"/>
      <classpath>
        <path refid="@{classpath}"/>
      </classpath>
      <assertions>
        <enable/>
      </assertions>
      <test name="@{testsuite}" todir="${junit.output.dir}" outfile="@{outfile}"/>
    </junit>
  </sequential>
</macrodef>

<target name="generate-code"/>

<target name="compile-cap2tt">
  <mkdir dir="${cap2tt.classes.dir}"/>
  <javac destdir="${cap2tt.classes.dir}">
    <src path="${cap2tt.source.dir}"/>
    <classpath>
      <path location="${ttv.jar}"/>
    </classpath>
  </javac>
  <mkdir dir="${cap2tt.resources.dir}"/>
  <copy todir="${cap2tt.resources.dir}">
    <fileset dir="${cap2tt.resources.source.dir}"/>
  </copy>
</target>

<target name="compile-cap2tt-tests" depends="compile-cap2tt">
  <mkdir dir="${cap2tt.test.classes.dir}"/>
  <javac destdir="${cap2tt.test.classes.dir}">
    <src path="${cap2tt.test.source.dir}"/>
    <classpath>
      <path refid="junit.libs.classpath"/>
      <path location="${cap2tt.classes.dir}"/>
      <path location="${cap2tt.resources.dir}"/>
      <path location="${ttv.jar}"/>
    </classpath>
  </javac>
  <mkdir dir="${cap2tt.test.resources.dir}"/>
  <copy todir="${cap2tt.test.resources.dir}">
    <fileset dir="${cap2tt.test.resources.source.dir}"/>
  </copy>
</target>

<target name="ensure-artifacts-directory">
  <mkdir dir="${artifacts.dir}"/>
</target>

<target name="ensure-cap2tt-artifacts-directory" depends="ensure-artifacts-directory"/>

<target name="build-cap2tt-jars" depends="compile-cap2tt">
  <tstamp>
    <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  </tstamp>
  <property name="build.id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  <jar jarfile="${cap2tt.target}">
    <fileset dir="${cap2tt.classes.dir}"/>
    <fileset dir="${cap2tt.resources.dir}"/>
    <zipfileset src="${ttv.jar}">
      <include name="**/*.class"/>
      <include name="**/*.xsd"/>
    </zipfileset>
    <manifest>
      <attribute name="Implementation-Title" value="${cap2tt.title}"/>
      <attribute name="Implementation-Version" value="${cap2tt.version}"/>
      <attribute name="Implementation-Vendor" value="${cap2tt.vendor}"/>
      <attribute name="Build-Id" value="${build.id}"/>
      <attribute name="Main-Class" value="${cap2tt.main.class}"/>
    </manifest>
  </jar>
  <jar jarfile="${cap2tt.min.target}">
    <fileset dir="${cap2tt.classes.dir}"/>
    <fileset dir="${cap2tt.resources.dir}"/>
    <manifest>
      <attribute name="Implementation-Title" value="${cap2tt.title}"/>
      <attribute name="Implementation-Version" value="${cap2tt.version}"/>
      <attribute name="Implementation-Vendor" value="${cap2tt.vendor}"/>
      <attribute name="Build-Id" value="${build.id}"/>
      <attribute name="Main-Class" value="${cap2tt.main.class}"/>
    </manifest>
  </jar>
  <jar jarfile="${cap2tt.source.target}">
    <fileset dir="${basedir}">
      <include name="build.xml"/>
      <include name="README.md"/>
{'fraction_non_alphanumeric': 0.1971127151582454, 'fraction_numerical': 0.010383120488617436, 'mean_word_length': 4.899443170651818, 'pattern_counts': {'":': 0, '<': 322, '<?xml version=': 2, '>': 322, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1581986', 'n_tokens_mistral': 5880, 'n_tokens_neox': 5692, 'n_words': 1156}