All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mg4j-big.4.0.4.source-code.build.xml Maven / Gradle / Ivy

Go to download

MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java. The big version is a fork of the original MG4J that can handle more than 2^31 terms and documents.

The newest version!
<project name="mg4j-big" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

	<property name="build.sysclasspath" value="ignore"/>
	<property name="jars.dir" value="${basedir}/jars"/>
	<property file="build.properties"/>

	<property name="ivy.install.version" value="2.2.0" />
	<property name="ivy.jar.dir" value="${basedir}/.ivy" />
	<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
	<property name="ivy.pom.version" value="${version}" />

	<target name="ivy-init" description="Installs a local copy of ivy">
		<mkdir dir="${ivy.jar.dir}"/>
		<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
		<path id="ivy.lib.path">
			<pathelement location="${ivy.jar.file}"/>
		</path>
		<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
	</target>

	<target name="ivy-setupjars" depends="ivy-init" description="Downloads dependencies with ivy and generate report">
		<ivy:retrieve symlink="true" sync="true" pattern="${jars.dir}/[conf]/[artifact].[ext]"/>
		<ivy:report todir="${dist}/ivy-report"/>
	</target>

	<target name="ivy-clean" depends="ivy-init" description="Clean ivy cache, jars dir and ivy installation">
		<delete dir="${jars.dir}"/>
	</target>

	<target name="ivy-pom" depends="ivy-init" 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"/>
	</target>
	
	<path id="build.classpath">
		<fileset dir="${jars.dir}/build"/>
	</path>	
	<path id="test.classpath">
		<fileset dir="${jars.dir}/test"/>
	</path>	
	<path id="project.classpath">
		<fileset dir="${jars.dir}/runtime"/>
	</path>	

	

	<!-- ************************************** WARNING: MAVEN SH*T ************************************** -->

	<!-- define Maven coordinates -->
	<property name="groupId" value="it.unimi.dsi" />
	<property name="artifactId" value="mg4j" />
	<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 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="dist" depends="compile,javadoc" description="generate the distribution">

		<!-- build the main artifact -->
		<jar jarfile="${maven-jar}" basedir="${build}" />

		<!-- 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="CHANGES,COPYING,COPYING.LESSER,build.xml,build.properties,ivy.xml,ivysettings.xml,${src}/**/*.java,${src}/**/*.html,${test}/**/*.java,${slow}/**/*.java"/>
		</jar>
	</target>

	<target name="deploy" depends="dist,ivy-pom" 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=pom.xml" />
			<arg value="-Dfile=${maven-jar}" />
		</artifact:mvn>
	</target>

	<target name="stage" depends="dist,ivy-pom" 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>

	<!-- ************************************** END OF MAVEN SH*T ************************************** -->


	<condition property="j2se.apiurl" value="${local.j2se.apiurl}" else="${remote.j2se.apiurl}"><isset property="local"/></condition>
	<condition property="log4j.apiurl" value="${local.log4j.apiurl}" else="${remote.log4j.apiurl}"><isset property="local"/></condition>
	<condition property="sux4j.apiurl" value="${local.sux4j.apiurl}" else="${remote.sux4j.apiurl}"><isset property="local"/></condition>
	<condition property="webgraph.apiurl" value="${local.webgraph.apiurl}" else="${remote.webgraph.apiurl}"><isset property="local"/></condition>
	<condition property="fastutil.apiurl" value="${local.fastutil.apiurl}" else="${remote.fastutil.apiurl}"><isset property="local"/></condition>
	<condition property="dsiutils.apiurl" value="${local.dsiutils.apiurl}" else="${remote.dsiutils.apiurl}"><isset property="local"/></condition>
	<condition property="jsap.apiurl" value="${local.jsap.apiurl}" else="${remote.jsap.apiurl}"><isset property="local"/></condition>
	<condition property="velocity.apiurl" value="${local.velocity.apiurl}" else="${remote.velocity.apiurl}"><isset property="local"/></condition>
	<condition property="velocity-tools.apiurl" value="${local.velocity-tools.apiurl}" else="${remote.velocity-tools.apiurl}"><isset property="local"/></condition>
	<condition property="servletapi5.apiurl" value="${local.servletapi5.apiurl}" else="${remote.servletapi5.apiurl}"><isset property="local"/></condition>
	<condition property="junit.apiurl" value="${local.junit.apiurl}" else="${remote.junit.apiurl}"><isset property="local"/></condition>
	<condition property="commons-io.apiurl" value="${local.commons-io.apiurl}" else="${remote.commons-io.apiurl}"><isset property="local"/></condition>
	<condition property="commons-lang.apiurl" value="${local.commons-lang.apiurl}" else="${remote.commons-lang.apiurl}"><isset property="local"/></condition>
	<condition property="commons-configuration.apiurl" value="${local.commons-configuration.apiurl}" else="${remote.commons-configuration.apiurl}"><isset property="local"/></condition>
	<condition property="commons-collections.apiurl" value="${local.commons-collections.apiurl}" else="${remote.commons-collections.apiurl}"><isset property="local"/></condition>

	<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 &quot;ant ivy-setupjars&quot; and try again." unless="ivy.set.up"/>	
		<mkdir dir="${dist}"/>
		<mkdir dir="${docs}"/>
		<mkdir dir="${build}"/>
		<mkdir dir="${instrumented}"/>
		<mkdir dir="${reports}"/>
		<symlink link="${dist}/javadoc" resource="../${docs}" overwrite="true"/>
	</target>

	<target name="parser" depends="init">
		<javacc target="${src}/it/unimi/dsi/big/mg4j/query/parser/SimpleParser.jj" javacchome="${jars.dir}/build"/>
	</target>

	<target name="compile" depends="init,parser" description="Compile sources (without tests)">
	<javac srcdir="${src}" debug="on" optimize="on" destdir="${build}" target="1.6" classpathref="build.classpath"/>
	</target>

	<target name="compile-tests" depends="init,parser" description="Compile sources (with tests)">
	<javac srcdir="${src}:${test}:${slow}" debug="on" optimize="on" destdir="${build}" target="1.6" classpathref="test.classpath"/>
	</target>

	<target name="jar" depends="compile" description="Creates jar (without tests)">
		<jar jarfile="mg4j-big-${version}.jar">
		<fileset dir="${build}" includes="**/*.class"/>
		<fileset dir="${src}" includes="**/*.velocity"/>
		<fileset dir="${src}" includes="**/*.8"/>
		<fileset dir="${src}" includes="**/*.16"/>
		<fileset dir="${src}" includes="**/*.12"/>
	</jar>
	</target>

	<target name="jar-tests" depends="compile-tests" description="Creates jar (with tests)">
		<jar jarfile="mg4j-big-${version}.jar">
		<fileset dir="${build}" includes="**/*.class"/>
		<fileset dir="${src}" includes="**/*.velocity"/>
		<fileset dir="${src}" includes="**/*.8"/>
		<fileset dir="${src}" includes="**/*.16"/>
		<fileset dir="${src}" includes="**/*.12"/>
	</jar>
	</target>

	<target name="javadoc" depends="parser">
		<mkdir dir="${docs}"/>
		<javadoc destdir="${docs}" 
			 packagenames = "it.unimi.dsi.big.mg4j.*"
			 overview="${src}/overview.html"
			 sourcepath="${src}" 
			 private="off"
			 source="1.6"
			 windowtitle="MG4J (big) ${version}"
			 classpathref="build.classpath">
	<link href="${j2se.apiurl}"/>
	<link href="${fastutil.apiurl}"/>
	<link href="${dsiutils.apiurl}"/>
	<link href="${log4j.apiurl}"/>
	<link href="${sux4j.apiurl}"/>
	<link href="${webgraph.apiurl}"/>
	<link href="${velocity.apiurl}"/>
	<link href="${velocity-tools.apiurl}"/>
	<link href="${servletapi5.apiurl}"/>
	<link href="${commons-configuration.apiurl}"/>
	<link href="${commons-io.apiurl}"/>
	<link href="${commons-lang.apiurl}"/>
		</javadoc>
	</target>

	<target name="junit" depends="instrument" description="Runs JUnit tests">

		<junit printsummary="yes" fork="yes" haltonfailure="off" haltonerror="off">
			<classpath>
				<path refid="test.classpath" />
				<pathelement location="${instrumented}/classes"/>
				<pathelement location="${build}"/>
				<pathelement location="${src}"/>
				<pathelement location="${test}"/>
			</classpath>

			<jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />
			<jvmarg value="-Demma.coverage.out.merge=true" />
			<jvmarg value="-Xmx2G" />

			<formatter type="xml"/>
			<formatter type="plain"/>

			<batchtest fork="yes" todir="${reports}">
				<fileset dir="${instrumented}/classes">
					<include name="it/unimi/dsi/big/mg4j/**/*Test.class"/>
					<exclude name="it/unimi/dsi/big/mg4j/**/*SlowTest.class"/>
					<exclude name="it/unimi/dsi/big/mg4j/test/*.class"/>
				</fileset>
			</batchtest>
		</junit>

		<junitreport todir="reports">
			<fileset dir="reports">
				<include name="TEST-*.xml"/>
			</fileset>
			<report todir="reports/html"/>
		</junitreport>

		<emma>
			<report sourcepath="${src}" >
				<fileset file="${coverage}/*a"/>
				<txt outfile="coverage.txt" />
				<html outfile="coverage.html" />
			</report>
		</emma>
	</target>

	<target name="junit-slow" depends="instrument" description="Runs slow JUnit tests">

		<junit printsummary="yes" fork="yes" haltonfailure="off" haltonerror="off">
			<classpath>
				<path refid="test.classpath" />
				<pathelement location="${instrumented}/classes"/>
				<pathelement location="${build}"/>
				<pathelement location="${src}"/>
				<pathelement location="${test}"/>
				<pathelement location="${slow}"/>
			</classpath>

			<jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" />
			<jvmarg value="-Demma.coverage.out.merge=true" />
			<jvmarg value="-Xmx8G" />

			<formatter type="xml"/>
			<formatter type="plain"/>

			<batchtest fork="yes" todir="${reports}">
				<fileset dir="${instrumented}/classes">
					<include name="it/unimi/dsi/big/mg4j/**/*SlowTest.class"/>
					<exclude name="it/unimi/dsi/big/mg4j/test/*"/>
				</fileset>
			</batchtest>
		</junit>

		<junitreport todir="reports">
			<fileset dir="reports">
				<include name="TEST-*.xml"/>
			</fileset>
			<report todir="reports/html"/>
		</junitreport>

		<emma>
			<report sourcepath="${src}" >
				<fileset file="${coverage}/*a"/>
				<txt outfile="coverage.txt" />
				<html outfile="coverage.html" />
			</report>
		</emma>
	</target>

	<target name="instrument" depends="compile-tests" description="Generate instrumented classes">
		<taskdef resource="emma_ant.properties" classpathref="test.classpath"/>
		<emma>
			<instr mode="fullcopy"
				 outdir="${instrumented}"
				 merge="no"
				 metadatafile="${coverage}/metadata.emma"
				 instrpath="${build}"
			>
				<filter excludes="*Test*"/>
			</instr>
		</emma>
	</target>
	
	<target name="clean">
		<delete dir="${dist}"/>
		<delete dir="${build}"/>
		<delete dir="${coverage}"/>
		<delete dir="${instrumented}"/>
		<delete dir="${reports}"/>
		<delete>
			<fileset dir="${src}/it/unimi/dsi/big/mg4j/index/wired" includes="*.java"/>
			<fileset dir="." includes="mg4j-big-*.jar"/>
			<fileset dir="${src}/it/unimi/dsi/big/mg4j/query/parser" includes="SimpleParser*.java"/>
			<fileset dir="${src}/it/unimi/dsi/big/mg4j/query/parser" includes="*CharStream.java"/>
			<fileset dir="${src}/it/unimi/dsi/big/mg4j/query/parser" includes="Token*.java"/>
			<fileset dir="${src}/it/unimi/dsi/big/mg4j/query/parser" includes="ParseException.java"/>
		</delete>
	</target>

</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy