<commit_before><project name="Amplitude Android SDK" basedir="." default="dist" xmlns:artifact="urn:maven-artifact-ant">

    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
             uri="urn:maven-artifact-ant"
             classpath="lib/maven-ant-tasks-2.1.3.jar" />

    <description />
    <!-- set global properties for this build -->

    <property name="src" location="src" />
    <property name="build" location="build" />
    <property name="dist" location="dist" />

    <property name="test.src" location="test" />
    <property name="test.reports" location="${dist}/reports"/>

    <property environment="env" />
    <property name="android-sdk-path" value="${env.ANDROID_SDK}" />
    <property name="android-target" value="${env.ANDROID_TARGET}" />

    <property name="groupId" value="com.amplitude" />
    <property name="artifactId" value="amplitude-android" />
    <property name="version" value="1.6.1" />

    <property name="jar" value="${dist}/lib/${artifactId}-${version}.jar" />
    <property name="uberjar" value="${dist}/lib/${artifactId}-${version}-with-dependencies.jar" />
    <property name="unity-jar" value="amplitude-unity-${version}.jar" />
    <property name="javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
    <property name="sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />

    <tstamp>
      <format property="long-date" pattern="MMMM dd, yyyy"/>
    </tstamp>

    <!-- Load dependencies from pom -->
    <artifact:dependencies pathId="dependency.classpath" useScope="runtime">
        <artifact:pom file="pom.xml" />
    </artifact:dependencies>

    <path id="project.classpath">
        <path refid="dependency.classpath"/>
        <pathelement path="${android-sdk-path}/platforms/android-${android-target}/android.jar" />
    </path>

    <!-- Prepare dependency path jar list for inclusion in uberjar -->
    <pathconvert refid="dependency.classpath" property="dependency.list" pathsep="," dirsep="/">
        <map from="/" to=""/>
    </pathconvert>

    <!-- Load test dependency classpath from pom-->
    <artifact:dependencies pathId="dependency.testclasspath" useScope="test">
        <artifact:pom file="pom.xml" />
    </artifact:dependencies>

    <path id="project.testclasspath">
        <path refid="dependency.testclasspath"/>
        <pathelement path="${android-sdk-path}/platforms/android-${android-target}/android.jar" />
    </path>

    <target name="init">
        <mkdir dir="${build}" />
        <mkdir dir="${dist}/lib" />
        <mkdir dir="${test.reports}" />
    </target>

    <target name="clean" >
        <delete dir="${build}" />
        <delete dir="${dist}" />
    </target>

    <target name="build" depends="init" >
        <echo message="Building for android target ${android-target}" />
        <echo message="Java version: ${java.version}"/>
        <echo message="Android SDK Path: ${toString:project.classpath}" />
        <javac classpathref="project.classpath"
               srcdir="${src}"
               destdir="${build}"
               includeantruntime="false"
               debug="true">
            <classpath refid="dependency.classpath" />
        </javac>
    </target>

    <target name="jar" depends="build">
        <jar destfile="${jar}" basedir="${build}" includes="com/amplitude/api/*.class" />
        <jar destfile="${uberjar}">
            <fileset dir="${build}" includes="com/amplitude/api/*.class" />
            <zipgroupfileset id="dependency.fileset" dir="/" includes="${dependency.list}"/>
        </jar>
    </target>

    <target name="unity" depends="build" description="creates jar for unity plugin">
        <jar destfile="${unity-jar}">
            <fileset dir="${build}" includes="com/amplitude/api/*.class" />
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
            <fileset dir="${build}" includes="com/amplitude/unity/plugins/*.class" />
            <fileset dir="${src}" includes="com/amplitude/unity/plugins/*.java" />
            <zipgroupfileset id="dependency.fileset" dir="/" includes="${dependency.list}"/>
        </jar>
    </target>

    <target name="dist" depends="jar" description="creates release jar with javadoc and sources">
        <javadoc classpathref="project.classpath" sourcepath="${src}" destdir="${dist}/javadoc">
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
        </javadoc>
        <jar jarfile="${javadoc-jar}">
            <fileset dir="${dist}/javadoc" />
        </jar>
        <jar jarfile="${sources-jar}">
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
        </jar>
        <copy file="${jar}" todir="."/>
        <copy file="${uberjar}" todir="."/>
    </target>

    <target name="update-version">
        <replaceregexp match="\d+\.\d+.\d+(-SNAPSHOT)?" replace="${version}" flags="g">
            <fileset dir="." includes="README.md"/>
            <fileset dir="${src}" includes="com/amplitude/api/Constants.java" />
        </replaceregexp>

        <replaceregexp match="&lt;version&gt;[\d.]*(-SNAPSHOT)?&lt;/version&gt;" replace="&lt;version&gt;${version}&lt;/version&gt;">
            <fileset dir="." includes="pom.xml"/>
        </replaceregexp>

        <replaceregexp match="name=.version. value=.[\d.]*(-SNAPSHOT)?." replace="name=&quot;version&quot; value=&quot;${version}&quot;" >
            <fileset dir="." includes="build.xml"/>
        </replaceregexp>
    </target>

    <target name="tag" depends="update-version,dist,unity" description="commits new artifacts to git and tags the release">
        <echo message="Tagging artifacts in git for version ${version}"/>

        <exec dir="." executable="git"><arg line="rm amplitude-*jar"/></exec>

        <replaceregexp match="## Unreleased" replace="## Unreleased&#10;&#10;## ${version} (${long-date})" flags="g">
            <fileset dir="." includes="CHANGELOG.md"/>
        </replaceregexp>

        <exec dir="." executable="git"><arg line="add amplitude-*jar README.md pom.xml build.xml" /></exec>
        <exec dir="." executable="git"><arg line="add src/com/amplitude/api/Constants.java" /></exec>
        <exec dir="." executable="git"><arg line="add CHANGELOG.md" /></exec>

        <exec dir="." executable="git"><arg line="commit -m 'Version ${version}'" /></exec>
        <exec dir="." executable="git"><arg line="tag v${version}" /></exec>

        <echo message="The release has been tagged in your local repository. To push the release to github:"/>
        <echo message="git push --tags origin master"/>
    </target>

    <target name="release" depends="clean,tag" description="prepares for a release">
        <antcall target="maven-snapshot" inheritAll="false">
            <param name="version" value="${version}-SNAPSHOT"/>
        </antcall>

        <antcall target="maven-stage" >
            <param name="version" value="${version}"/>
        </antcall>
    </target>

    <property name="ossrh-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots" />
    <property name="ossrh-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
    <property name="ossrh-server-id" value="ossrh" />

    <!-- version in build.xml and pom.xml must be -SNAPSHOT -->
    <target name="maven-snapshot" depends="update-version,dist" description="deploy snapshot version to Maven snapshot repository">
        <echo message="Uploading artifacts to maven snapshot for version ${version}"/>

        <artifact:mvn>
            <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
            <arg value="-Durl=${ossrh-snapshots-repository-url}" />
            <arg value="-DrepositoryId=${ossrh-server-id}" />
            <arg value="-DpomFile=pom.xml" />
            <arg value="-Dfile=${jar}" />
        </artifact:mvn>
    </target><commit_msg>Add test against release packages during bundling.<commit_after><project name="Amplitude Android SDK" basedir="." default="dist" xmlns:artifact="urn:maven-artifact-ant">

    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
             uri="urn:maven-artifact-ant"
             classpath="lib/maven-ant-tasks-2.1.3.jar" />

    <description />
    <!-- set global properties for this build -->

    <property name="src" location="src" />
    <property name="build" location="build" />
    <property name="dist" location="dist" />

    <property name="test.src" location="test" />
    <property name="test.reports" location="${dist}/reports"/>

    <property environment="env" />
    <property name="android-sdk-path" value="${env.ANDROID_SDK}" />
    <property name="android-target" value="${env.ANDROID_TARGET}" />

    <property name="groupId" value="com.amplitude" />
    <property name="artifactId" value="amplitude-android" />
    <property name="version" value="1.6.1" />

    <property name="jar" value="${dist}/lib/${artifactId}-${version}.jar" />
    <property name="uberjar" value="${dist}/lib/${artifactId}-${version}-with-dependencies.jar" />
    <property name="unity-jar" value="amplitude-unity-${version}.jar" />
    <property name="javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
    <property name="sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />

    <tstamp>
      <format property="long-date" pattern="MMMM dd, yyyy"/>
    </tstamp>

    <!-- Load dependencies from pom -->
    <artifact:dependencies pathId="dependency.classpath" useScope="runtime">
        <artifact:pom file="pom.xml" />
    </artifact:dependencies>

    <path id="project.classpath">
        <path refid="dependency.classpath"/>
        <pathelement path="${android-sdk-path}/platforms/android-${android-target}/android.jar" />
    </path>

    <!-- Prepare dependency path jar list for inclusion in uberjar -->
    <pathconvert refid="dependency.classpath" property="dependency.list" pathsep="," dirsep="/">
        <map from="/" to=""/>
    </pathconvert>

    <!-- Load test dependency classpath from pom-->
    <artifact:dependencies pathId="dependency.testclasspath" useScope="test">
        <artifact:pom file="pom.xml" />
    </artifact:dependencies>

    <path id="project.testclasspath">
        <path refid="dependency.testclasspath"/>
        <pathelement path="${android-sdk-path}/platforms/android-${android-target}/android.jar" />
    </path>

    <target name="init">
        <mkdir dir="${build}" />
        <mkdir dir="${dist}/lib" />
        <mkdir dir="${test.reports}" />
    </target>

    <target name="clean" >
        <delete dir="${build}" />
        <delete dir="${dist}" />
    </target>

    <target name="build" depends="init" >
        <echo message="Building for android target ${android-target}" />
        <echo message="Java version: ${java.version}"/>
        <echo message="Android SDK Path: ${toString:project.classpath}" />
        <javac classpathref="project.classpath"
               srcdir="${src}"
               destdir="${build}"
               includeantruntime="false"
               debug="true">
            <classpath refid="dependency.classpath" />
        </javac>
    </target>

    <target name="jar" depends="build">
        <jar destfile="${jar}" basedir="${build}" includes="com/amplitude/api/*.class" />
        <jar destfile="${uberjar}">
            <fileset dir="${build}" includes="com/amplitude/api/*.class" />
            <zipgroupfileset id="dependency.fileset" dir="/" includes="${dependency.list}"/>
        </jar>
    </target>

    <target name="unity" depends="build" description="creates jar for unity plugin">
        <jar destfile="${unity-jar}">
            <fileset dir="${build}" includes="com/amplitude/api/*.class" />
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
            <fileset dir="${build}" includes="com/amplitude/unity/plugins/*.class" />
            <fileset dir="${src}" includes="com/amplitude/unity/plugins/*.java" />
            <zipgroupfileset id="dependency.fileset" dir="/" includes="${dependency.list}"/>
        </jar>
    </target>

    <target name="dist" depends="jar" description="creates release jar with javadoc and sources">
        <javadoc classpathref="project.classpath" sourcepath="${src}" destdir="${dist}/javadoc">
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
        </javadoc>
        <jar jarfile="${javadoc-jar}">
            <fileset dir="${dist}/javadoc" />
        </jar>
        <jar jarfile="${sources-jar}">
            <fileset dir="${src}" includes="com/amplitude/api/*.java" />
        </jar>
        <copy file="${jar}" todir="."/>
        <copy file="${uberjar}" todir="."/>
    </target>

    <target name="update-version">
        <replaceregexp match="\d+\.\d+.\d+(-SNAPSHOT)?" replace="${version}" flags="g">
            <fileset dir="." includes="README.md"/>
            <fileset dir="${src}" includes="com/amplitude/api/Constants.java" />
        </replaceregexp>

        <replaceregexp match="&lt;version&gt;[\d.]*(-SNAPSHOT)?&lt;/version&gt;" replace="&lt;version&gt;${version}&lt;/version&gt;">
            <fileset dir="." includes="pom.xml"/>
        </replaceregexp>

        <replaceregexp match="name=.version. value=.[\d.]*(-SNAPSHOT)?." replace="name=&quot;version&quot; value=&quot;${version}&quot;" >
            <fileset dir="." includes="build.xml"/>
        </replaceregexp>
    </target>

    <target name="tag" depends="update-version,dist,unity" description="commits new artifacts to git and tags the release">
        <echo message="Tagging artifacts in git for version ${version}"/>

        <exec dir="." executable="git"><arg line="checkout -b v${version}-snapshot"/></exec>

        <exec dir="." executable="git"><arg line="rm amplitude-*jar"/></exec>

        <replaceregexp match="## Unreleased" replace="## Unreleased&#10;&#10;## ${version} (${long-date})" flags="g">
            <fileset dir="." includes="CHANGELOG.md"/>
        </replaceregexp>

        <exec dir="." executable="git"><arg line="add amplitude-*jar README.md pom.xml build.xml" /></exec>
        <exec dir="." executable="git"><arg line="add src/com/amplitude/api/Constants.java" /></exec>
        <exec dir="." executable="git"><arg line="add CHANGELOG.md" /></exec>

        <exec dir="." executable="git"><arg line="commit -m 'Version ${version}'" /></exec>
        <exec dir="." executable="git"><arg line="tag v${version}" /></exec>

        <exec dir="." executable="git"><arg line="push --tags origin v${version}-snapshot" /></exec>

        <echo message="The release has been tagged in the v${version} branch. To publish the release to github:"/>
        <echo message="git checkout master; git merge v${version}; git push origin master"/>
    </target>

    <target name="release" depends="clean,tag" description="prepares for a release">
        <antcall target="test-snapshot" inheritAll="false">
            <param name="version" value="${version}-SNAPSHOT"/>
        </antcall>

        <antcall target="maven-stage" >
            <param name="version" value="${version}"/>
        </antcall>
    </target>

    <property name="ossrh-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots" />
    <property name="ossrh-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
    <property name="ossrh-server-id" value="ossrh" />

    <!-- version in build.xml and pom.xml must be -SNAPSHOT -->
    <target name="maven-snapshot" depends="update-version,dist" description="deploy snapshot version to Maven snapshot repository">
        <echo message="Uploading artifacts to maven snapshot for version ${version}"/>

        <artifact:mvn>
            <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
            <arg value="-Durl=${ossrh-snapshots-repository-url}" />
            <arg value="-DrepositoryId=${ossrh-server-id}" />
            <arg value="-DpomFile=pom.xml" />
            <arg value="-Dfile=${jar}" />
        </artifact:mvn>
    </target>

    <target name="test-snapshot" depends="maven-snapshot" description="test release packages">
        <echo message="Testing release artifacts for ${version}"/>
        <echo message="Cloning demo app..."/>

        <exec dir="." executable="rm"><arg line="-rf test-release"/></exec>
        <exec dir="." executable="git"><arg line="clone https://github.com/amplitude/AndroidDemo test-release"/></exec>
        <exec dir="test-release" executable="./amplitude-test.sh"><arg line="${version}"/></exec>
        <exec dir="." executable="rm"><arg line="-rf test-release"/></exec>
    </target>
{'fraction_non_alphanumeric': 0.19482768918353938, 'fraction_numerical': 0.0015528877739951024, 'mean_word_length': 3.1150159744408947, 'pattern_counts': {'":': 0, '<': 323, '<?xml version=': 0, '>': 323, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, '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': '4372048', 'n_tokens_mistral': 5149, 'n_tokens_neox': 4822, 'n_words': 955}