<project name="fastutil" default="jar" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property name="build.sysclasspath" value="ignore"/>
<property file="build.properties"/>
<property environment="env"/>
<!-- ************************************** WARNING: MAVEN SH*T ************************************** -->
<!-- define Maven coordinates -->
<property name="groupId" value="it.unimi.dsi" />
<property name="artifactId" value="fastutil" />
<property name="version" value="${version}" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="maven-core-jar" value="${dist}/lib/${artifactId}-core-${version}.jar" />
<property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="maven-core-sources-jar" value="${dist}/lib/${artifactId}-core-${version}-sources.jar" />
<property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<property name="maven-core-javadoc-jar" value="${dist}/lib/${artifactId}-core-${version}-javadoc.jar" />
<property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<!-- defined maven snapshots and staging repository id and url -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<target name="src-core">
<delete dir="$src}-core"/>
<mkdir dir="${src}-core"/>
<copy todir="${src}-core">
<fileset dir="${src}" includesfile="fastutil-src-core.txt"/>
</copy>
</target>
<target name="core" depends="compile">
<delete dir="${build}-core"/>
<mkdir dir="${build}-core"/>
<copy todir="${build}-core">
<fileset dir="${build}" includesfile="fastutil-core.txt"/>
</copy>
</target>
<target name="osgi-core" depends="core">
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="bnd/biz.aQute.bnd-5.2.0.jar"/>
<bnd
classpath="${build}-core"
eclipse="false"
failok="false"
exceptions="true"
output="${maven-core-jar}"
files="fastutil-core.bnd"/>
</target>
<target name="osgi" depends="compile">
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="bnd/biz.aQute.bnd-5.2.0.jar"/>
<bnd
classpath="${build}"
eclipse="false"
failok="false"
exceptions="true"
output="${maven-jar}"
files="fastutil.bnd"/>
</target>
<!-- end OSGi manifest generation -->
<target name="dist-javadoc-core" depends="javadoc-core" description="generate the distribution Javadoc (core)">
<!-- build the javadoc artifact (from symbolic link created in init) -->
<jar jarfile="${maven-core-javadoc-jar}">
<fileset dir="${dist}/javadoc-core" />
</jar>
</target>
<target name="dist-javadoc" depends="javadoc" description="generate the distribution Javadoc">
<!-- build the javadoc artifact (from symbolic link created in init) -->
<jar jarfile="${maven-javadoc-jar}">
<fileset dir="${dist}/javadoc" />
</jar>
</target>
<target name="dist-core" depends="osgi-core,dist-javadoc-core" description="generate the distribution (core)">
<!-- build the sources artifact -->
<jar jarfile="${maven-core-sources-jar}">
<fileset dir="." includes="README.md,CHANGES,LICENSE-2.0,build.xml,pom-core-model.xml,pom-model.xml,fastutil-core.bnd,fastutil.bnd,split.sh,build.properties,makefile,${drv}/*.drv,gencsource.sh,src/overview.html"/>
<fileset dir="src" includesfile="fastutil-src-core.txt"/>
</jar>
</target>
<target name="dist" depends="osgi,dist-javadoc" description="generate the distribution">
<!-- build the sources artifact -->
<jar jarfile="${maven-sources-jar}">
<fileset dir="src"/>
</jar>
</target>
<target name="pom-core" description="insert version into pom (core)">
<copy tofile="pom-core.xml" file="pom-core-model.xml" overwrite="true">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
</target>
<target name="pom" description="insert version into pom">
<copy tofile="pom.xml" file="pom-model.xml" overwrite="true">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
</target>
<target name="deploy-core" depends="pom-core,dist-core" description="deploy core snapshot version to Maven snapshot repository (core)">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
<arg value="-DpomFile=${build}/pom-core.xml" />
<arg value="-Dfile=${maven-core-jar}" />
</artifact:mvn>
</target>
<target name="stage-core" depends="pom-core,dist-core" description="deploy core release version to Maven staging repository (core)">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom-core.xml" />
<arg value="-Dfile=${maven-core-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom-core.xml" />
<arg value="-Dfile=${maven-core-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom-core.xml" />
<arg value="-Dfile=${maven-core-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<target name="deploy" depends="pom,dist" description="deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
<arg value="-DpomFile=${build}/pom.xml" />
<arg value="-Dfile=${maven-jar}" />
</artifact:mvn>
</target>
<target name="stage" depends="pom,dist" description="deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<target name="deploy-all" depends="deploy-core,deploy" description="deploy all release versions to Maven staging repository">
</target>
<target name="stage-all" depends="stage-core,stage" description="stage all release versions to Maven staging repository">
</target>
<!-- ************************************** END OF MAVEN SH*T ************************************** -->
<condition property="j2se.apiurl" value="${local.j2se.apiurl}" else="${remote.j2se.apiurl}"><isset property="local"/></condition>
<property name="j2se.apiurl" value="http://java.sun.com/j2se/5.0/docs/api/"/>
<target name="init">
<delete dir="${dist}"/>
<mkdir dir="${build}"/>
<mkdir dir="${dist}/lib"/>
<mkdir dir="${reports}"/>
<symlink link="${dist}/javadoc-core" resource="../${docs}-core" overwrite="true"/>
<symlink link="${dist}/javadoc" resource="../${docs}" overwrite="true"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}"
debug="on"
deprecation="on"
optimize="on"
destdir="${build}"
memoryMaximumSize="2G"
fork="yes"
release="8"
>
<compilerarg value="-Xlint:all"/>
</javac>
</target>
<target name="compile-tests" depends="compile">
<javac srcdir="${test}"
debug="on"
deprecation="on"
optimize="on"
classpath="lib/junit-4.13.jar:lib"
destdir="${build}"
memoryMaximumSize="2G"
fork="yes"
release="8"
/>
</target>
<target name="jar" depends="compile">
<jar jarfile="fastutil-${version}.jar">
<fileset dir="${build}"/>
<manifest>
<attribute name="Automatic-Module-Name" value="it.unimi.dsi.fastutil"/>
</manifest>
</jar>
</target>
<target name="jar-tests" depends="compile">
<jar jarfile="fastutil-${version}.jar">
<fileset dir="${build}"/>
</jar>
</target>
<target name="javadoc-core" depends="src-core" description="Generates documentation (core)">
<mkdir dir="${docs}-core"/>
<javadoc destdir="${docs}-core"
packagenames = "it.unimi.dsi.fastutil,it.unimi.dsi.fastutil.*"
overview="${src}/overview.html"
sourcepath="${src}-core"
public="on"
source="1.8"
windowtitle="fastutil ${version}"
additionalparam="-breakiterator -Xmaxwarns 1 -tag "apiNote:a:API Notes:" -tag "implSpec:a:Implementation Specification:" -tag "implNote:a:Implementation Notes:\""
maxmemory="2G"
>
</javadoc>
</target>
<target name="javadoc" description="Generates documentation">
<mkdir dir="${docs}"/>
<javadoc destdir="${docs}"
packagenames = "it.unimi.dsi.fastutil,it.unimi.dsi.fastutil.*"
overview="${src}/overview.html"
sourcepath="${src}"
public="on"
source="1.8"
windowtitle="fastutil ${version}"
additionalparam="-breakiterator -Xmaxwarns 1 -tag "apiNote:a:API Notes:" -tag "implSpec:a:Implementation Specification:" -tag "implNote:a:Implementation Notes:\""
maxmemory="2G"
>
</javadoc>
</target>
<target name="junit" depends="compile-tests" description="Runs JUnit tests">
<junit printsummary="yes" fork="yes" haltonfailure="off" haltonerror="off">
<classpath location="${build}"/>
<classpath location="${src}"/>
<classpath location="lib/junit-4.13.jar"/>
<classpath location="lib/hamcrest-all-1.3.jar"/>
<jvmarg value="-Xmx3G" />
<assertions><enable/></assertions>
<formatter type="xml"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="${reports}">
<fileset dir="${build}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="reports">
<fileset dir="reports">
<include name="TEST-*.xml"/>
</fileset>
<report todir="reports/html"/>
</junitreport>
</target>
<!-- ************ CLEAN ********************* -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${build}-core"/>
<delete dir="${src}-core"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
<delete dir="${docs}-core"/>
<delete dir="${docs}"/>
<delete>
<fileset dir="." includes="fastutil-*.jar"/>
</delete>
</target>
</project>