<commit_before><!--
  ~ $Id$
  ~ $Revision$
  ~ $Date$
  ~ $Author$
  ~
  ~ The DOMS project.
  ~ Copyright (C) 2007-2010  The State and University Library
  ~
  ~ 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.
  -->

<project name="dist">

    <property name="global.dir" value="${basedir}/.."/>

    <import file="build-macros.xml"/>

    <property name="dist.name" value="${ant.project.name}-${version}"/>
    <property name="dist.zip" value="${dist.name}.zip"/>
    <property name="dist.src.zip" value="${dist.name}-src.zip"/>
    <property name="dist.bin.zip" value="${dist.name}-bin.zip"/>
    <property name="dist.doc.zip" value="${dist.name}-doc.zip"/>


    <dirset id="project.modules" dir="${global.dir}/modules">
        <include name="*"/>
        <include name="*/*"/>
    </dirset>

    <target name="clean">
        <delete dir="dist"/>
        <delete dir="temp/*"/>
        <dependsloop target="clean" dependencies="project.modules"/>
    </target>


    <target name="distclean" depends="clean">
        <dependsloop target="distclean" dependencies="project.modules"/>

    </target>

    <target name="compile">
        <dependsloop target="compile" dependencies="project.modules"/>
    </target>

    <target name="test">
        <!--TODO real tests-->
        <dependsloop target="compile" dependencies="project.modules"/>
    </target>


    <target name="release.doc">
        <mkdir dir="temp/docstemp"/>
        <mkdir dir="dist"/>
        <path id="build.classpath">
            <fileset dir="${global.dir}/lib">
                <include name="**/*.jar"/>
            </fileset>
        </path>

        <convertPath dirset="project.modules" postfix="/src/**/*.java"
                     newfileset="project.modules.javafiles"/>
        <convertPath dirset="project.modules" postfix="/tempsrc/**/*.java"
                     newfileset="project.modules.javatempfiles"/>

        <javadoc destdir="temp/docstemp" classpathref="build.classpath">
            <sourcefiles>
                <fileset refid="project.modules.javafiles"/>
                <fileset refid="project.modules.javatempfiles"/>
            </sourcefiles>
        </javadoc>
        <zip destfile="dist/${dist.doc.zip}">
            <zipfileset dir="temp/docstemp" prefix="${dist.name}">
                <include name="**/*"/>
            </zipfileset>
        </zip>
        <delete dir="temp/docstemp"/>
    </target>


    <target name="release.bin">

        <mkdir dir="dist"/>
        <mkdir dir="temp/libtemp"/>
        <mkdir dir="temp/licensestemp"/>
        <mkdir dir="temp/usedlibs"/>

        <dependsloop target="all" dependencies="project.modules"/>
        <!--Collect the used project libs from all the ordinary modules -->
        <dependsloop target="-copyLibsForDist" dependencies="project.modules"/>

        <!--The list of produced jars-->
        <convertPath dirset="project.modules"
                     postfix="/dist/**/*.jar"
                     newfileset="project.modules.jars"/>

        <!--The list of produces wars-->
        <convertPath dirset="project.modules"
                     postfix="/dist/**/*.war"
                     newfileset="project.modules.wars"/>

        <!--The list of licenses from the individual modules-->
        <convertPath dirset="project.modules"
                     postfix="**/license/*"
                     newfileset="project.modules.licenses"/>

        <copy todir="temp/libtemp" flatten="true" failonerror="false">
            <fileset dir="temp/usedlibs">
                <include name="**/jars/*.jar"/>
            </fileset>
            <fileset refid="project.modules.jars"/>
        </copy>

        <copy todir="temp/wartemp" flatten="true" failonerror="false">
            <fileset refid="project.modules.wars"/>
        </copy>

        <copy todir="temp/licensestemp"><!--TODO licenses from module libs??-->
            <fileset refid="project.modules.licenses"/>
            <fileset dir="temp/usedlibs/">
                <include name="**/license/*"/>
            </fileset>
            <regexpmapper from="(.*)/license(/.*)" to="\1\2"/>
        </copy>


        <zip destfile="dist/${dist.bin.zip}">
            <zipfileset prefix="${dist.name}/jars" dir="temp/libtemp"/>
            <zipfileset prefix="${dist.name}/wars" dir="temp/wartemp"/>
            <zipfileset prefix="${dist.name}/license" dir="temp/licensestemp"/>
            <zipfileset prefix="${dist.name}/license" dir="${global.dir}">
                <include name="LICENSE"/>
                <include name="NOTICE"/>
                <include name="README"/>
            </zipfileset>
        </zip>

        <delete dir="temp/libtemp"/>
        <delete dir="temp/apidocstemp"/>
        <delete dir="temp/licensestemp"/>

    </target>


    <target name="release.src" depends="distclean">
        <mkdir dir="${global.dir}/dist"/>

        <zip destfile="dist/${dist.src.zip}">
            <zipfileset prefix="${dist.name}" dir=".">
            </zipfileset>
        </zip>
    </target>

    <target name="release" depends="release.src,release.bin,release.doc">
        <zip destfile="dist/${dist.zip}">
            <zipgroupfileset file="dist/${dist.bin.zip}"/>
            <zipfileset file="dist/${dist.src.zip}" prefix="${dist.name}/src"/><commit_msg>Proper cleanup in clean and in the various release builds<commit_after><!--
  ~ $Id$
  ~ $Revision$
  ~ $Date$
  ~ $Author$
  ~
  ~ The DOMS project.
  ~ Copyright (C) 2007-2010  The State and University Library
  ~
  ~ 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.
  -->

<project name="project">

    <property name="global.dir" value="${basedir}/.."/>

    <import file="build-macros.xml"/>

    <property name="dist.name" value="${ant.project.name}-${version}"/>
    <property name="dist.zip" value="${dist.name}.zip"/>
    <property name="dist.src.zip" value="${dist.name}-src.zip"/>
    <property name="dist.bin.zip" value="${dist.name}-bin.zip"/>
    <property name="dist.doc.zip" value="${dist.name}-doc.zip"/>


    <dirset id="project.modules" dir="${global.dir}/modules">
        <include name="*"/>
        <include name="*/*"/>
    </dirset>

    <target name="clean">
        <delete dir="dist"/>
        <delete dir="temp"/>
        <dependsloop target="clean" dependencies="project.modules"/>
    </target>


    <target name="distclean" depends="clean">
        <dependsloop target="distclean" dependencies="project.modules"/>

    </target>

    <target name="compile">
        <dependsloop target="compile" dependencies="project.modules"/>
    </target>

    <target name="test">
        <!--TODO real tests-->
        <dependsloop target="compile" dependencies="project.modules"/>
    </target>


    <target name="release.doc">
        <mkdir dir="temp/docstemp"/>
        <mkdir dir="dist"/>
        <path id="build.classpath">
            <fileset dir="${global.dir}/lib">
                <include name="**/*.jar"/>
            </fileset>
        </path>

        <convertPath dirset="project.modules" postfix="/src/**/*.java"
                     newfileset="project.modules.javafiles"/>
        <convertPath dirset="project.modules" postfix="/tempsrc/**/*.java"
                     newfileset="project.modules.javatempfiles"/>

        <javadoc destdir="temp/docstemp" classpathref="build.classpath">
            <sourcefiles>
                <fileset refid="project.modules.javafiles"/>
                <fileset refid="project.modules.javatempfiles"/>
            </sourcefiles>
        </javadoc>
        <zip destfile="dist/${dist.doc.zip}">
            <zipfileset dir="temp/docstemp" prefix="${dist.name}">
                <include name="**/*"/>
            </zipfileset>
        </zip>
        <delete dir="temp/docstemp"/>
    </target>


    <target name="release.bin">

        <mkdir dir="dist"/>

        <mkdir dir="temp/libtemp"/>
        <mkdir dir="temp/licensestemp"/>
        <mkdir dir="temp/usedlibs"/>
        <mkdir dir="temp/wartemp"/>

        <dependsloop target="all" dependencies="project.modules"/>
        <!--Collect the used project libs from all the ordinary modules -->
        <dependsloop target="-copyLibsForDist" dependencies="project.modules"/>

        <!--The list of produced jars-->
        <convertPath dirset="project.modules"
                     postfix="/dist/**/*.jar"
                     newfileset="project.modules.jars"/>

        <!--The list of produces wars-->
        <convertPath dirset="project.modules"
                     postfix="/dist/**/*.war"
                     newfileset="project.modules.wars"/>

        <!--The list of licenses from the individual modules-->
        <convertPath dirset="project.modules"
                     postfix="**/license/*"
                     newfileset="project.modules.licenses"/>

        <copy todir="temp/libtemp" flatten="true" failonerror="false">
            <fileset dir="temp/usedlibs">
                <include name="**/jars/*.jar"/>
            </fileset>
            <fileset refid="project.modules.jars"/>
        </copy>

        <copy todir="temp/wartemp" flatten="true" failonerror="false">
            <fileset refid="project.modules.wars"/>
        </copy>

        <copy todir="temp/licensestemp"><!--TODO licenses from module libs??-->
            <fileset refid="project.modules.licenses"/>
            <fileset dir="temp/usedlibs/">
                <include name="**/license/*"/>
            </fileset>
            <regexpmapper from="(.*)/license(/.*)" to="\1\2"/>
        </copy>


        <zip destfile="dist/${dist.bin.zip}">
            <zipfileset prefix="${dist.name}/jars" dir="temp/libtemp"/>
            <zipfileset prefix="${dist.name}/wars" dir="temp/wartemp"/>
            <zipfileset prefix="${dist.name}/license" dir="temp/licensestemp"/>
            <zipfileset prefix="${dist.name}/license" dir="${global.dir}">
                <include name="LICENSE"/>
                <include name="NOTICE"/>
                <include name="README"/>
            </zipfileset>
        </zip>

        <delete dir="temp/libtemp"/>
        <delete dir="temp/licensestemp"/>
        <delete dir="temp/usedlibs"/>
        <delete dir="temp/wartemp"/>

    </target>


    <target name="release.src" depends="distclean">
        <mkdir dir="${global.dir}/dist"/>

        <zip destfile="dist/${dist.src.zip}">
            <zipfileset prefix="${dist.name}" dir=".">
            </zipfileset>
        </zip>
    </target>

    <target name="release" depends="release.src,release.bin,release.doc">
        <zip destfile="dist/${dist.zip}">
            <zipgroupfileset file="dist/${dist.bin.zip}"/>
            <zipfileset file="dist/${dist.src.zip}" prefix="${dist.name}/src"/>
{'fraction_non_alphanumeric': 0.16538775510204082, 'fraction_numerical': 0.002285714285714286, 'mean_word_length': 2.303937432578209, 'pattern_counts': {'":': 0, '<': 219, '<?xml version=': 0, '>': 219, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '5180807', 'n_tokens_mistral': 3546, 'n_tokens_neox': 3411, 'n_words': 768}