1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
<project name="dsiutils" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:resolver="antlib:org.apache.maven.resolver.ant">
<property name="build.sysclasspath" value="ignore"/>
<property name="jars.dir" value="/usr/share/java"/>
<property file="build.properties"/>
<property environment="env"/>
<condition property="ivy.settings.file" value="${env.LOCAL_IVY_SETTINGS}"><isset property="env.LOCAL_IVY_SETTINGS"/></condition>
<path id="ivy.lib.path">
<fileset dir="/usr/share/java" includes="ivy.jar"/>
</path>
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml" classpathref="ivy.lib.path"/>
<target name="ivy-setupjars" description="Downloads dependencies with ivy and generate report">
<ivy:retrieve symlink="true" sync="true" pattern="${jars.dir}/[conf]/[artifact](-[classifier]).[ext]"/>
<ivy:report todir="${dist}/ivy-report"/>
</target>
<target name="ivy-clean" description="Cleans ivy cache, jars dir and ivy installation">
<delete dir="${jars.dir}"/>
</target>
<target name="ivy-pom" description="Creates POM">
<ivy:resolve/>
<ivy:deliver deliverpattern="${dist}/ivy.xml" pubrevision="${version}" status="release"/>
<ivy:makepom ivyfile="${dist}/ivy.xml" templatefile="pom-model.xml" pomfile="pom.xml">
<dependency group="ch.qos.logback" artifact="logback-classic.jar" optional="true"/>
</ivy:makepom>
</target>
<path id="compile.classpath">
<fileset dir="${jars.dir}"/>
</path>
<path id="test.classpath">
<fileset dir="${jars.dir}"/>
</path>
<path id="project.classpath">
<fileset dir="${jars.dir}"/>
</path>
<!-- ************************************** WARNING: MAVEN SH*T ************************************** -->
<!-- define Maven coordinates -->
<property name="groupId" value="it.unimi.dsi" />
<property name="artifactId" value="dsiutils" />
<property name="version" value="${version}" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<!-- defined maven staging repository id and url -->
<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/" />
<!-- OSGi manifest generation -->
<target name="resolve" description="run Ivy to fetch jars">
<ivy:retrieve />
</target>
<target name="osgi" depends="resolve,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="dsiutils.bnd"/>
</target>
<!-- end OSGi manifest generation -->
<target name="dist" depends="osgi,javadoc" description="generate the distribution">
<!-- build the javadoc artifact (from symbolic link created in init) -->
<jar jarfile="${maven-javadoc-jar}">
<fileset dir="${dist}/javadoc" />
</jar>
<!-- build the sources artifact -->
<jar jarfile="${maven-sources-jar}">
<fileset dir="." includes="README.md,CHANGES,COPYING.LESSER,LICENSE-2.0.txt,dsiutils.bnd,build.xml,build.properties,ivy.xml,${src}/**/*.java,${src}/**/*.12,${src}/**/*.16,${src}/**/*.html,${test}/**/*.java,${slow}/**/*.java"/>
</jar>
</target>
<target name="stage" depends="dist,ivy-pom" description="deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<exec executable="gpg">
<arg value="-sba"/>
<arg value="--yes"/>
<arg value="${maven-jar}"/>
</exec>
<exec executable="gpg">
<arg value="-sba"/>
<arg value="--yes"/>
<arg value="${maven-sources-jar}"/>
</exec>
<exec executable="gpg">
<arg value="-sba"/>
<arg value="--yes"/>
<arg value="${maven-javadoc-jar}"/>
</exec>
<exec executable="gpg">
<arg value="-sba"/>
<arg value="--yes"/>
<arg value="pom.xml"/>
</exec>
<resolver:deploy>
<pom file="pom.xml"/>
<remoterepo id="${maven-staging-repository-id}" url ="${maven-staging-repository-url}"/>
<artifact file="pom.xml.asc" type="pom.asc"/>
<artifact file="${maven-jar}" type="jar"/>
<artifact file="${maven-sources-jar}" type="jar" classifier="sources"/>
<artifact file="${maven-javadoc-jar}" type="jar" classifier="javadoc"/>
<artifact file="${maven-jar}.asc" type="jar.asc"/>
<artifact file="${maven-sources-jar}.asc" type="jar.asc" classifier="sources"/>
<artifact file="${maven-javadoc-jar}.asc" type="jar.asc" classifier="javadoc"/>
</resolver:deploy>
</target>
<!-- ************************************** END OF MAVEN SH*T ************************************** -->
<property name="subdir" value=""/>
<!-- ************ SOURCE ********************* -->
<target name="init">
<available property="ivy.set.up" file="${jars.dir}"/>
<fail message="It appears that Ivy has not been set up properly. Please run "ant ivy-setupjars" and try again." unless="ivy.set.up"/>
<mkdir dir="${build}"/>
<mkdir dir="${docs}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${reports}"/>
<mkdir dir="${dist}/lib"/>
<symlink link="${dist}/javadoc" resource="../${docs}" overwrite="true"/>
</target>
<target name="compile" depends="init" description="Compile sources (without tests)">
<javac srcdir="${src}" debug="on" optimize="on" destdir="${build}" encoding="UTF-8" release="8" classpathref="compile.classpath">
<compilerarg value="-Xlint:all"/>
</javac>
<copy todir="${build}">
<fileset dir="${src}" includes="**/*.12"/>
<fileset dir="${src}" includes="**/*.16"/>
</copy>
</target>
<target name="compile-tests" depends="init" description="Compile sources (with tests)">
<javac srcdir="${src}:${test}:${slow}" debug="on" optimize="on" destdir="${build}" encoding="UTF-8" release="8" classpathref="test.classpath">
<compilerarg value="-Xlint:all"/>
</javac>
<copy todir="${build}">
<fileset dir="${src}" includes="**/*.12"/>
<fileset dir="${src}" includes="**/*.16"/>
</copy>
</target>
<target name="jar" depends="compile" description="Creates jar (without tests)">
<jar jarfile="dsiutils-${version}.jar">
<fileset dir="${build}"/>
<manifest>
<attribute name="Automatic-Module-Name" value="it.unimi.dsi.dsiutils"/>
</manifest>
</jar>
</target>
<target name="jar-tests" depends="compile-tests" description="Creates jar (with tests)">
<jar jarfile="dsiutils-${version}.jar">
<fileset dir="${build}"/>
<fileset dir="${test}" includes="**/*.data"/>
</jar>
</target>
<!-- ************ JAVADOC ********************* -->
<target name="javadoc" description="Generates documentation">
<delete dir="${docs}"/>
<mkdir dir="${docs}"/>
<javadoc destdir="${docs}"
encoding="UTF-8"
sourcepath="${src}"
packagenames="it.unimi.dsi.*"
private="off"
overview="${src}/overview.html"
source="1.8"
windowtitle="dsiutil ${version}"
additionalparam="-breakiterator -tag "apiNote:a:API Notes:" -tag "implSpec:a:Implementation Specification:" -tag "implNote:a:Implementation Notes:\""
classpathref="compile.classpath">
<link href="${j2se.apiurl}"/>
<link href="${fastutil.apiurl}"/>
<link href="${jsap.apiurl}"/>
<link href="${junit.apiurl}"/>
<link href="${slf4j.apiurl}"/>
<link href="${log4j.apiurl}"/>
<link href="${guava.apiurl}"/>
<link href="${commons-io.apiurl}"/>
<link href="${commons-lang3.apiurl}"/>
<link href="${commons-configuration2.apiurl}"/>
<link href="${commons-collections4.apiurl}"/>
<link href="${commons-math3.apiurl}"/>
</javadoc>
</target>
<target name="junit" depends="compile-tests" description="Runs JUnit tests">
<junit printsummary="yes" fork="yes" haltonfailure="on" haltonerror="on">
<classpath>
<path refid="test.classpath" />
<pathelement location="${build}"/>
<pathelement location="${src}"/>
<pathelement location="${test}"/>
</classpath>
<assertions><enable/></assertions>
<formatter type="xml"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="${reports}">
<fileset dir="${build}">
<include name="**/*Test.class"/>
<exclude name="**/*SlowTest.class"/>
<exclude name="it/unimi/dsi/test/*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="reports">
<fileset dir="reports">
<include name="TEST-*.xml"/>
</fileset>
<report todir="reports/html"/>
</junitreport>
</target>
<target name="junit-slow" depends="compile-tests" description="Runs JUnit slow tests">
<junit printsummary="yes" fork="yes" haltonfailure="off" haltonerror="off">
<classpath>
<path refid="test.classpath" />
<pathelement location="${build}"/>
<pathelement location="${src}"/>
<pathelement location="${slow}"/>
</classpath>
<assertions><enable/></assertions>
<formatter type="xml"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="${reports}">
<fileset dir="${build}">
<include name="**/*SlowTest.class"/>
<exclude name="it/unimi/dsi/test/*"/>
</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="${dist}"/>
<delete dir="${reports}"/>
<delete dir="${docs}"/>
<delete>
<fileset dir="." includes="*.jar"/>
</delete>
</target>
</project>
|