build.xml 10.8 KB
<?xml version="1.0" encoding="utf-8" ?>
<project name="metarepository" default="deploy" basedir=".">
	<property file="build.properties"/>
	<property name="final.name" value="${name}-${version}"/>

	<path id="build.classpath">
		<fileset dir="${lib.dir}">
			<include name="**/*.jar"/>
		</fileset>
	</path>

	<target name="init">
		<tstamp/>
	</target>

	<target name="compile" depends="clean, init">
		<mkdir dir="${build.dir}/classes" />
		<javac debug="true" srcdir="${src.dir}" includes="**/*.java" destdir="${build.dir}/classes">
			<!--<compilerarg value="-Xlint:deprecation"/>-->
			<!--<compilerarg value="-Xlint:unchecker"/>-->
			<classpath refid="build.classpath" />
		</javac>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/rights.list" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/doctypes.list" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/languages.list" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/stopWords.list" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/CqlToSQL.properties" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/CqlToSolr.properties" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/validator.xml" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/configuration" file="${config.dir}/validator.xsd" overwrite="true"/>
		<copy todir="${build.dir}/classes/pt/keep/metarepository/core/localization" overwrite="true">
			<fileset dir="${config.dir}/" includes="**/Messages*.properties" />
		</copy>
		<!--<copy todir="${web.dir}/images/repositories" overwrite="true">
			<fileset dir="${logos.dir}/" includes="**/*.jpg" />
		</copy>-->
		<copy todir="${build.dir}/classes/templates" overwrite="true">
			<fileset dir="${config.dir}/templates/" includes="**/*" />
		</copy>
		<copy todir="${build.dir}/classes" file="${config.dir}/metarepository.config" overwrite="true" />
		<copy todir="${build.dir}/classes" file="${config.dir}/oaicat.properties" overwrite="true" />
		<copy todir="${build.dir}/classes" file="${config.dir}/log4j.xml" overwrite="true" />
	</target>

	<target name="jar" depends="compile">
		<mkdir dir="${build.dir}"/>
		<jar destfile="${build.dir}/${final.name}.jar" basedir="${build.dir}/classes/">
			<manifest>
				<attribute name="Created-By" value="KEEP SOLUTIONS Lda."/>
			</manifest>
		</jar>
	</target>

	<target name="build" depends="compile">
		<mkdir dir="${bin.dir}"/>
		<jar destfile="${bin.dir}/${harvest_file_name}.jar" basedir="${build.dir}/classes/">
			<fileset dir="${lib.dir}/">
				<include name="*.jar"/>
			</fileset>
			<manifest>
				<attribute name="Main-Class" value="pt.keep.metarepository.core.app.HarvestApp"/>
			</manifest>
		</jar>
	</target>

	<target name="harvest">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath"/>
				<path location="${bin.dir}/${harvest_file_name}.jar"/>
			</classpath>
			<arg value="-o" />
			<arg value="HARVEST"/>
			<arg value="--${selector}" />
			<arg value="${selector_value}"/>
		</java>
	</target>

	<target name="force_harvest">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath"/>
				<path location="${bin.dir}/${harvest_file_name}.jar"/>
			</classpath>
			<arg value="-o" />
			<arg value="HARVEST"/>
			<arg value="-f" />
			<arg value="--${selector}" />
			<arg value="${selector_value}"/>
		</java>
	</target>

	<target name="send">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath"/>
				<path location="${bin.dir}/${harvest_file_name}.jar"/>
			</classpath>
			<arg value="-o" />
			<arg value="SENDMAIL"/>
		</java>
	</target>

	<target name="subjects">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath"/>
				<path location="${bin.dir}/${harvest_file_name}.jar"/>
			</classpath>
			<arg value="-o" />
			<arg value="PARSESUBJECTS"/>
		</java>
	</target>

	<target name="statistics">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath" />
				<path location="${bin.dir}/${harvest_file_name}.jar" />
			</classpath>
			<arg value="-o" />
			<arg value="STATISTICS"/>
		</java>
	</target>
	<target name="graphs">
		<java fork="true" classname="pt.keep.metarepository.core.app.HarvestApp" maxmemory="2048m" failonerror="true">
			<jvmarg value="-Xss4096k" />
			<sysproperty key="log4j.configuration" value="file:${config.dir}/log4j.xml"/>
			<classpath>
				<path refid="build.classpath" />
				<path location="${bin.dir}/${harvest_file_name}.jar" />
			</classpath>
			<arg value="-o" />
			<arg value="GRAPHS"/>
		</java>
	</target>

	<!-- create war file -->
	<target name="war" depends="compile">
		<mkdir dir="${build.dir}"/>
		<war destfile="${build.dir}/${deploy.name}.war" webxml="${config.dir}/web.xml">
			<fileset dir="${web.dir}" excludes="WEB-INF/web.xml"/>
			<classes dir="${build.dir}/classes"/>
			<lib file="${lib.dir}/mysql-connector-java-5.1.7-bin.jar"/>
			<lib file="${lib.dir}/commons-lang-2.4.jar"/>
			<lib file="${lib.dir}/commons-fileupload.jar"/>
			<lib file="${lib.dir}/commons-io.jar"/>
			<lib file="${lib.dir}/commons-logging.jar"/>
			<lib file="${lib.dir}/commons-httpclient-3.1.jar" />
			<lib file="${lib.dir}/cql-java.jar"/>
			<lib file="${lib.dir}/axis.jar"/>
			<lib file="${lib.dir}/jaxb-impl-2.1.9.jar"/>
			<lib file="${lib.dir}/httpcore-4.0.jar"/>
			<lib file="${lib.dir}/httpclient-4.0-beta2.jar"/>
			<lib file="${lib.dir}/axiom-api-1.2.5.jar"/>
			<lib file="${lib.dir}/axiom-impl-1.2.5.jar"/>
			<lib file="${lib.dir}/log4j-1.2.16.jar"/>
			<lib file="${lib.dir}/log4j-extras-1.1.jar"/>
			<lib file="${lib.dir}/velocity-1.6.2.jar" />
			<lib file="${lib.dir}/commons-collections-3.2.1.jar" />
			<lib file="${lib.dir}/mailapi.jar" />
			<lib file="${lib.dir}/smtp.jar" />
			<lib file="${lib.dir}/oaicat.jar" />
			<lib file="${lib.dir}/degois-3.0.jar" />
			<lib file="${lib.dir}/jaxrpc.jar" />
			<lib file="${lib.dir}/commons-discovery.jar" />
			<lib file="${lib.dir}/wsdl4j.jar" />
			<lib file="${lib.dir}/solr-core-3.4.0.jar" />
			<lib file="${lib.dir}/solr-solrj-3.4.0.jar" />
			<lib file="${lib.dir}/commons-codec-1.3.jar" />
			<lib file="${lib.dir}/jcl-over-slf4j-1.5.5.jar" />
			<lib file="${lib.dir}/lucene-analyzers-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-core-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-misc-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-memory-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-queries-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-spellchecker-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-spatial-3.4.0.jar" />
			<lib file="${lib.dir}/lucene-highlighter-3.4.0.jar" />
			<lib file="${lib.dir}/slf4j-api-1.5.5.jar" />
			<lib file="${lib.dir}/slf4j-log4j12-1.5.5.jar" />
			<!-- jersey stuff -->
			<lib file="${lib.dir}/javax.ws.rs-api-2.0.jar" />
			<lib file="${lib.dir}/jersey-container-servlet.jar" />
			<lib file="${lib.dir}/jersey-container-servlet-core.jar" />
			<lib file="${lib.dir}/jersey-common.jar" />
			<lib file="${lib.dir}/jersey-client.jar" />
			<lib file="${lib.dir}/jersey-server.jar" />
			<lib file="${lib.dir}/asm-all-repackaged-2.2.0-b21.jar" />
			<lib file="${lib.dir}/guava-14.0.1.jar" />
			<lib file="${lib.dir}/cglib-2.2.0-b21.jar" />
			<lib file="${lib.dir}/validation-api-1.1.0.Final.jar" />
			<lib file="${lib.dir}/persistence-api-1.0.jar" />
			<lib file="${lib.dir}/osgi-resource-locator-1.0.1.jar" />
			<lib file="${lib.dir}/org.osgi.core-4.2.0.jar" />
			<lib file="${lib.dir}/jaxb-api-2.2.7.jar" />
			<lib file="${lib.dir}/javax.inject-2.2.0-b21.jar" />
			<lib file="${lib.dir}/javax.annotation-api-1.2.jar" />
			<lib file="${lib.dir}/hk2-utils-2.2.0-b21.jar" />
			<lib file="${lib.dir}/hk2-locator-2.2.0-b21.jar" />
			<lib file="${lib.dir}/hk2-api-2.2.0-b21.jar" />
			<lib file="${lib.dir}/jersey-mvc-jsp-2.4.1.jar" />
			<lib file="${lib.dir}/jersey-mvc-2.4.1.jar" />

			<!-- json stuff -->
			<lib file="${lib.dir}/json-simple-1.1.1.jar" />
		</war>
	</target>

	<target name="deploy" depends="war, build">
		<delete file="${deploy.dir}/${deploy.name}.war"/>
		<copy todir="${deploy.dir}" file="${build.dir}/${deploy.name}.war"/>
		<echo message="Deverá reiniciar o tomcat" />
		<echo message="Deverá também correr 'ant graphs' assim que o .war for expandido" />

	</target>

	<target name="src.dist" depends="clean" description="--> Generates the source oaiarc distribution as .tar.gz">
		<mkdir dir="${dist.dir}"/>
		<mkdir dir="${build.dir}"/>
		<delete file="${build.dir}/${final.name}-src.tar"/>
		<delete file="${dist.dir}/${final.name}-src.tar.gz"/>
		<tar tarfile="${build.dir}/${final.name}-src.tar">
			<tarfileset prefix="${final.name}-src" dir="." includes="src/,config/,bin/,lib/,build.properties,build.xml,README.txt,CHANGES.txt,AUTHORS.txt"/>
		</tar>
		<gzip zipfile="${dist.dir}/${final.name}-src.tar.gz" src="${build.dir}/${final.name}-src.tar" />
	</target>


	<target name="dist" depends="war" description="--> Generates the oaiarc distribution as .tar.gz">
		<mkdir dir="${dist.dir}"/>
		<delete file="${build.dir}/${final.name}.tar"/>
		<delete file="${dist.dir}/${final.name}.tar.gz"/>
		<tar tarfile="${build.dir}/${final.name}.tar">
			<tarfileset prefix="${final.name}" dir="."
		  	includes="src/,config/,bin/,lib/,build.properties,build.xml,README.txt,CHANGES.txt,AUTHORS.txt"/>
			<tarfileset prefix="${final.name}" dir="${build.dir}"
		  		includes="${final.name}.jar,${deploy.name}.war"/>
		</tar>
		<gzip zipfile="${dist.dir}/${final.name}.tar.gz" src="${build.dir}/${final.name}.tar" />
	</target>

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