<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project xmlns:jacoco="antlib:org.jacoco.ant"
         name="digidoc4j builder" basedir="."
         default="base">

  <property environment="env"/>
  <property name="build.dir" value="build"/>
  <property name="junit.dir" value="junit_report"/>
  <property name="coverage.dir" value="coverage"/>
  <property name="dist.dir" value="dist"/>

  <condition property="version" value="0.2.${env.BUILD_NUMBER}-beta" else="0.2.LOCAL_BUILD-beta">
    <isset property="env.BUILD_NUMBER"/>
  </condition>

  <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
    <classpath path="lib/jacocoant.jar"/>
  </taskdef>

  <path id="javac.classpath">
    <pathelement location="sd-dss/apps/dss/core/dss-common/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-document/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-service/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-spi/target/classes"/>
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="javac.alljar.classpath">
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <property name="classpath" value="javac.alljar.classpath"/>

  <path id="run.classpath">
    <pathelement location="${build.dir}"/>
  </path>

  <target name="javadoc">
    <mkdir dir="javadoc"/>
    <javadoc packagenames="org.digidoc4j.api" destdir="javadoc" encoding="UTF-8">
      <packageset dir="src" defaultexcludes="yes">
        <include name="org/digidoc4j/api/**"/>
        <exclude name="org/digidoc4j/api/*Impl.java"/>
      </packageset>
    </javadoc>
    <jar destfile="${dist.dir}/digidoc4j-${version}-javadoc.jar" basedir="javadoc"/>
  </target>

  <target name="compile">
    <mkdir dir="${build.dir}"/>
    <copy todir="${build.dir}">
      <fileset dir="resources"/>
    </copy>
    <javac destdir="${build.dir}" includeantruntime="false" source="1.6" debug="on" target="1.6" encoding="UTF-8">
      <src path="src"/>
      <src path="test"/>
      <classpath refid="${classpath}"/>
    </javac>
    <jar destfile="${dist.dir}/digidoc4j-${version}.jar">
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Implementation-Vendor" value="Republic of Estonia Information System Authority"/>
        <attribute name="Implementation-Title" value="Java BDoc/DigiDoc library"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
      <fileset dir="${build.dir}">
        <exclude name="prototype/"/>
        <exclude name="**/*Test.class"/>
      </fileset>
      <fileset dir="sd-dss/apps/dss/core/dss-common/target/classes"/>
      <fileset dir="sd-dss/apps/dss/core/dss-document/target/classes">
        <exclude name="**/sun-jaxb.episode"/>
      </fileset>
      <fileset dir="sd-dss/apps/dss/core/dss-service/target/classes"/>
      <fileset dir="sd-dss/apps/dss/core/dss-spi/target/classes"/>
      <fileset dir=".">
        <include name="conf/*.*"/>
      </fileset>
    </jar>
  </target>

  <target name="utility" depends="compile">
    <mkdir dir="${build.dir}/util"/>
    <jar jarfile="${build.dir}/util/temp.jar">
      <zipgroupfileset dir="dist" includes="**/digidoc4j-*.jar" excludes="*-javadoc.jar *-sources.jar"/>
      <zipgroupfileset dir="lib" includes="**/*.jar"
                       excludes="*-source.jar *-sources.jar *-javadoc.jar bcprov-*.jar jacoco*.jar mockito*.jar"/>
    </jar>

    <jar destfile="${build.dir}/util/digidoc4j-util.jar">
      <zipfileset src="${build.dir}/util/temp.jar" excludes="META-INF/*.SF META-INF/*.RSA META-INF/*.DSA"/>
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Implementation-Vendor" value="Republic of Estonia Information System Authority"/>
        <attribute name="Implementation-Title" value="Java BDoc/DigiDoc utility"/>
        <attribute name="Implementation-Version" value="${version}"/>
        <attribute name="Main-Class" value="org.digidoc4j.main.DigiDoc4J"/>
        <attribute name="Class-Path" value="./bcprov-jdk15on-1.49.jar"/>
      </manifest>
    </jar>
    <delete file="${build.dir}/util/temp.jar"/>
    <copy todir="${build.dir}/util">
      <fileset dir="lib" includes="**/bcprov-*.jar"/>
    </copy>
    <zip destfile="${dist.dir}/digidioc4j-util-${version}.zip"
         basedir="${build.dir}/util"/>
    <delete dir="${build.dir}/util"/>
  </target>

  <target name="source">
    <jar destfile="${dist.dir}/digidoc4j-${version}-sources.jar" basedir="src"/>
  </target>

  <target name="base" depends="clean, javadoc, source, compile"/>

  <target name="all">
    <property name="classpath" value="javac.classpath"/>
    <antcall target="base"/>
    <antcall target="test"/>
    <antcall target="coverage.report"/>
    <antcall target="utility"/><commit_msg>ant all now also creates zip with all required libraries<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project xmlns:jacoco="antlib:org.jacoco.ant"
         name="digidoc4j builder" basedir="."
         default="base">

  <property environment="env"/>
  <property name="build.dir" value="build"/>
  <property name="junit.dir" value="junit_report"/>
  <property name="coverage.dir" value="coverage"/>
  <property name="dist.dir" value="dist"/>

  <condition property="version" value="0.2.${env.BUILD_NUMBER}-beta" else="0.2.LOCAL_BUILD-beta">
    <isset property="env.BUILD_NUMBER"/>
  </condition>

  <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
    <classpath path="lib/jacocoant.jar"/>
  </taskdef>

  <path id="javac.classpath">
    <pathelement location="sd-dss/apps/dss/core/dss-common/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-document/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-service/target/classes"/>
    <pathelement location="sd-dss/apps/dss/core/dss-spi/target/classes"/>
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="javac.alljar.classpath">
    <fileset dir="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <property name="classpath" value="javac.alljar.classpath"/>

  <path id="run.classpath">
    <pathelement location="${build.dir}"/>
  </path>

  <target name="javadoc">
    <mkdir dir="javadoc"/>
    <javadoc packagenames="org.digidoc4j.api" destdir="javadoc" encoding="UTF-8">
      <packageset dir="src" defaultexcludes="yes">
        <include name="org/digidoc4j/api/**"/>
        <exclude name="org/digidoc4j/api/*Impl.java"/>
      </packageset>
    </javadoc>
    <jar destfile="${dist.dir}/digidoc4j-${version}-javadoc.jar" basedir="javadoc"/>
  </target>

  <target name="compile">
    <mkdir dir="${build.dir}"/>
    <copy todir="${build.dir}">
      <fileset dir="resources"/>
    </copy>
    <javac destdir="${build.dir}" includeantruntime="false" source="1.6" debug="on" target="1.6" encoding="UTF-8">
      <src path="src"/>
      <src path="test"/>
      <classpath refid="${classpath}"/>
    </javac>
    <jar destfile="${dist.dir}/digidoc4j-${version}.jar">
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Implementation-Vendor" value="Republic of Estonia Information System Authority"/>
        <attribute name="Implementation-Title" value="Java BDoc/DigiDoc library"/>
        <attribute name="Implementation-Version" value="${version}"/>
      </manifest>
      <fileset dir="${build.dir}">
        <exclude name="prototype/"/>
        <exclude name="**/*Test.class"/>
      </fileset>
      <fileset dir="sd-dss/apps/dss/core/dss-common/target/classes"/>
      <fileset dir="sd-dss/apps/dss/core/dss-document/target/classes">
        <exclude name="**/sun-jaxb.episode"/>
      </fileset>
      <fileset dir="sd-dss/apps/dss/core/dss-service/target/classes"/>
      <fileset dir="sd-dss/apps/dss/core/dss-spi/target/classes"/>
      <fileset dir=".">
        <include name="conf/*.*"/>
      </fileset>
    </jar>
  </target>

  <target name="library">
    <zip destfile="${dist.dir}/digidioc4j-library-${version}.zip"
         basedir="lib"
         includes="*.jar"
         excludes="*-source.jar *-sources.jar *-javadoc.jar"/>
  </target>

  <target name="utility" depends="compile">
    <mkdir dir="${build.dir}/util"/>
    <jar jarfile="${build.dir}/util/temp.jar">
      <zipgroupfileset dir="dist" includes="**/digidoc4j-*.jar" excludes="*-javadoc.jar *-sources.jar"/>
      <zipgroupfileset dir="lib" includes="**/*.jar"
                       excludes="*-source.jar *-sources.jar *-javadoc.jar bcprov-*.jar jacoco*.jar mockito*.jar"/>
    </jar>

    <jar destfile="${build.dir}/util/digidoc4j-util.jar">
      <zipfileset src="${build.dir}/util/temp.jar" excludes="META-INF/*.SF META-INF/*.RSA META-INF/*.DSA"/>
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Implementation-Vendor" value="Republic of Estonia Information System Authority"/>
        <attribute name="Implementation-Title" value="Java BDoc/DigiDoc utility"/>
        <attribute name="Implementation-Version" value="${version}"/>
        <attribute name="Main-Class" value="org.digidoc4j.main.DigiDoc4J"/>
        <attribute name="Class-Path" value="./bcprov-jdk15on-1.49.jar"/>
      </manifest>
    </jar>
    <delete file="${build.dir}/util/temp.jar"/>
    <copy todir="${build.dir}/util">
      <fileset dir="lib" includes="**/bcprov-*.jar"/>
    </copy>
    <zip destfile="${dist.dir}/digidioc4j-util-${version}.zip"
         basedir="${build.dir}/util"/>
    <delete dir="${build.dir}/util"/>
  </target>

  <target name="source">
    <jar destfile="${dist.dir}/digidoc4j-${version}-sources.jar" basedir="src"/>
  </target>

  <target name="base" depends="clean, javadoc, source, compile"/>

  <target name="all">
    <property name="classpath" value="javac.classpath"/>
    <antcall target="base"/>
    <antcall target="test"/>
    <antcall target="coverage.report"/>
    <antcall target="utility"/>
    <antcall target="library"/>
{'fraction_non_alphanumeric': 0.20545920378399685, 'fraction_numerical': 0.006011036657469452, 'mean_word_length': 3.429943256219991, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 2, '>': 221, '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': '3330472', 'n_tokens_mistral': 3513, 'n_tokens_neox': 3398, 'n_words': 532}