<project name= "YaCy" default= "all" basedir= "." >
<description >
YaCy - a Peer to Peer Web Search Engine
</description>
<!--
# THIS IS THE YACY BUILD SCRIPT
# YOU CAN USE IT TO COMPILE YOUR OWN RELEASE
# THE TARGET OF THE COMPILATION CAN BE FOUND
# IN THE 'RELEASE' DIRECTORY AFTERWARDS
# YOU NEED APACHE ANT TO USE THIS SCRIPT
# ==========================================
# This Software is Copyrighted
# (C) by Michael Peter Christen; mc@anomic.de
# first published on http://www.anomic.de
# Frankfurt, Germany, 2005
# last major change: 06.05.2005
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Using this software in any meaning (reading, learning, copying, compiling,
# running) means that you agree that the Author(s) is (are) not responsible
# for cost, loss of data or any harm that may be caused directly or indirectly
# by usage of this softare or this documentation. The usage of this software
# is on your own risk. The installation and usage (starting/running) of this
# software may allow other people or application to access your computer and
# any attached devices and is highly dependent on the configuration of the
# software which must be done by the user of the software; the author(s) is
# (are) also not responsible for proper configuration and usage of the
# software, even if provoked by documentation provided together with
# the software.
#
# Any changes to this file according to the GPL as documented in the file
# gpl.txt aside this file in the shipment you received can be done to the
# lines that follows this copyright notice here, but changes must not be
# done inside the copyright notive above. A re-distribution must contain
# the intact and unchanged copyright notice.
# Contributions and changes to the program code must be marked as such.
-->
<!-- defining the timestamp format -->
<tstamp >
<format property= "REPL_DATE_FORMAT" pattern= "yyyymmdd" />
</tstamp>
<!-- defining all needed directory names -->
<property name= "addon" location= "addon" />
<property name= "src" location= "source" />
<property name= "doc" location= "doc" />
<property name= "data" location= "DATA" />
<property name= "lib" location= "lib" />
<property name= "libx" location= "libx" />
<property name= "build" location= "classes" />
<property name= "htroot" location= "htroot" />
<property name= "locales" location= "locales" />
<property name= "release" location= "RELEASE" />
<condition property= "singleExtFile" >
<equals arg1= "${extensionTarget}" arg2= "copy" />
</condition>
<!-- determining if the .svn directory exists -->
<condition property= "svnEntriesFileExists" >
<available file= ".svn/entries" />
</condition>
<!--
if the .svn directory exists we try to determine the real
svn revision number of the working base now
-->
<target name= "determineRevisionNr" if= "svnEntriesFileExists" >
<!-- loading the entries file containing the revision number of the root directory -->
<xmlproperty file= ".svn/entries" rootdirectory= "false" />
<!-- storing the list of read revision numbers into file -->
<tempfile property= "temp.file" prefix= "svnRevNr" suffix= ".properties" />
<echo message= "baseRevisionNr=${wc-entries.entry(revision)}" file= "${temp.file}" />
<!-- reading out the first entry of the stored revision numbers -->
<loadproperties srcFile= "${temp.file}" >
<filterchain >
<tokenfilter >
<containsregex
pattern="^baseRevisionNr=([^,]*)(.*)$"
replace="baseRevisionNr=\1"/>
</tokenfilter>
</filterchain>
</loadproperties>
<!-- deleting the temp file -->
<delete file= "${temp.file}" />
<!-- replacing the old with the new revision number -->
<copy file= "build.properties" tofile= "build.properties.new" >
<filterchain >
<tokenfilter >
<replaceregex
pattern="^releaseNr=(.*)"
replace="releaseNr=$Revision: ${baseRevisionNr} $" />
</tokenfilter>
</filterchain>
</copy>
<delete file= "build.properties" />
<move file= "build.properties.new" tofile= "build.properties" />
</target>
<!-- reading the build properties from file -->
<target name= "readBuildProperties" depends= "determineRevisionNr" >
<!-- loading some property values from file -->
<loadproperties srcFile= "build.properties" >
<filterchain >
<tokenfilter >
<replaceregex
pattern="^releaseNr=\$Revision:\s(.*)\s\$"
replace="releaseNr=\1"/>
</tokenfilter>
</filterchain>
</loadproperties>
<condition property= "singleExtFile" >
<equals arg1= "${extensionTarget}" arg2= "copy" />
</condition>
</target>
<!-- initializing all needed variables -->
<target name= "init" depends= "readBuildProperties" >
<mkdir dir= "${build}/de/anomic/data" />
<mkdir dir= "${build}/de/anomic/htmlFilter" />
<mkdir dir= "${build}/de/anomic/http" />
<mkdir dir= "${build}/de/anomic/kelondro" />
<mkdir dir= "${build}/de/anomic/net" />
<mkdir dir= "${build}/de/anomic/plasma" />
<mkdir dir= "${build}/de/anomic/plasma/parser" />
<mkdir dir= "${build}/de/anomic/server" />
<mkdir dir= "${build}/de/anomic/tools" />
<mkdir dir= "${build}/de/anomic/ymage" />
<mkdir dir= "${build}/de/anomic/yacy" />
<mkdir dir= "${build}/de/anomic/yacy/seedUpload" />
<mkdir dir= "${doc}" />
<mkdir dir= "${data}" />
<mkdir dir= "${release}" />
<filter token= "REPL_DATE" value= "${DSTAMP}" />
<filter token= "REPL_RELEASE" value= "${releaseFile}" />
<filter token= "REPL_VERSION" value= "${releaseVersion}" />
<copy file= "${src}/yacy.java" tofile= "${build}/yacy.java" filtering= "true" />
<copy file= "${doc}/Download.html" tofile= "${doc}/Download.html.up" filtering= "true" />
</target>
<target name= "compile" depends= "init" description= "Compiling the yacy sources ..." >
<!-- defining the classpath that should be used for compiling -->
<path id= "project.class.path" >
<pathelement location= "${build}" />
<pathelement location= "${htroot}" />
<!-- libs needed for the yacy thread/object - pools -->
<pathelement location= "${lib}/commons-collections.jar" />
<pathelement location= "${lib}/commons-pool-1.2.jar" />
</path>
<!-- compiling yacy.java -->
<javac srcdir= "${build}" destdir= "${build}" sourcepath= "${src}"
includes="yacy.java"
classpathref="project.class.path"
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}"/>
<!-- compiling the main sources -->
<javac srcdir= "${src}/" destdir= "${build}"
excludes="de/anomic/plasma/parser/*/*,de/anomic/yacy/seedUpload/**,de/anomic/soap/**,yacy.java,de/anomic/server/serverPortForwardingSch.java"
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}">
<classpath refid= "project.class.path" />
</javac>
<!-- compiling the two standard seed uploader methods -->
<javac srcdir= "${src}" destdir= "${build}"
classpathref="project.class.path"
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}">
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFile.java" />
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFtp.java" />
</javac>
<!-- compiling htroot, htroot/yacy and htroot/htdocsdefault -->
<javac srcdir= "${htroot}/"
classpathref="project.class.path"
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}"/>
</target>
<target name= "all" depends= "compile" >
<delete file= "${build}/yacy.java" />
</target>
<!-- compiling optional content parsers and building install packages -->
<target name= "parsers" depends= "compile" description= "Compiling and zipping all additional parsers" >
<subant target= "${extensionTarget}" >
<property name= "src" location= "${src}" />
<property name= "build" location= "${build}" />
<property name= "libx" location= "${libx}" />
<property name= "release" location= "${release}" />
<property name= "releaseDir" value= "${releaseDir}" />
<property name= "javacSource" value= "${javacSource}" />
<property name= "javacTarget" value= "${javacTarget}" />
<!-- each optional parser must have its own build file -->
<fileset dir= "${src}/" includes= "de/anomic/plasma/parser/*/build.xml" />
</subant>
</target>
<!-- compiling optional seed uploaders and building install packages -->
<target name= "seedUploaders" depends= "compile" description= "Compiling and zipping additional seed uploaders" >
<subant target= "${extensionTarget}" >
<property name= "src" location= "${src}" />
<property name= "build" location= "${build}" />
<property name= "libx" location= "${libx}" />
<property name= "htroot" value= "${htroot}" />
<property name= "release" location= "${release}" />
<property name= "releaseDir" value= "${releaseDir}" />
<property name= "javacSource" value= "${javacSource}" />
<property name= "javacTarget" value= "${javacTarget}" />
<!-- each optionl uploader module must have its own build file -->
<fileset dir= "${src}/" includes= "de/anomic/yacy/seedUpload/yacySeedUpload*.xml" />
</subant>
</target>
<!-- compiling optional soap API and building install packages -->
<target name= "yacySOAP" depends= "compile" description= "Compiling and zipping additional yacy SOAP API" >
<subant target= "${extensionTarget}" >
<property name= "src" location= "${src}" />
<property name= "build" location= "${build}" />
<property name= "libx" location= "${libx}" />
<property name= "htroot" value= "${htroot}" />
<property name= "release" location= "${release}" />
<property name= "releaseDir" value= "${releaseDir}" />
<property name= "javacSource" value= "${javacSource}" />
<property name= "javacTarget" value= "${javacTarget}" />
<fileset dir= "${src}/" includes= "de/anomic/soap/build.xml" />
</subant>
</target>
<target name= "portForwarding" depends= "compile" description= "Compiling and zipping additional port forwarder" >
<javac srcdir= "${src}/de/anomic/server/" destdir= "${build}" source= "${javacSource}" target= "${javacTarget}" debug= "true" debuglevel= "lines,vars,source" >
<include name= "serverPortForwardingSch.java" />
<classpath >
<pathelement location= "${build}" />
<!-- main lib needed to parse rss/atom feed files -->
<pathelement location= "${libx}/jsch-0.1.21.jar" />
</classpath>
</javac>
<copy todir= "${release}/libx/" >
<fileset dir= "${libx}" includes= "jsch-0.1.21.*" />
</copy>
<copy todir= "${release}/source/de/anomic/server/" >
<fileset dir= "${src}/de/anomic/server/" >
<include name= "serverPortForwardingSch.java" />
</fileset>
</copy>
<copy todir= "${release}/classes/de/anomic/server/" >
<fileset dir= "${build}/de/anomic/server/" >
<include name= "serverPortForwardingSch.class" />
<include name= "serverPortForwardingSch$MyUserInfo.class" />
</fileset>
</copy>
</target>
<target name= "singleExtensionFile" if= "singleExtFile" >
<tar destfile= "${release}/${extensionFile}" compression= "gzip" defaultexcludes= "yes" longfile= "gnu" >
<tarfileset dir= "${release}" prefix= "${releaseDir}/" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*.*" />
<exclude name= "*.gz" />
</tarfileset>
</tar>
<delete dir= "${release}/classes" />
<delete dir= "${release}/htroot" />
<delete dir= "${release}/libx" />
<delete dir= "${release}/source" />
</target>
<!-- making a release file for yacy -->
<target name= "dist" depends= "all,parsers,seedUploaders,yacySOAP,portForwarding,singleExtensionFile" description= "Compiling sources and make a release file ..." >
<tar destfile= "${release}/${releaseFile}" compression= "gzip" defaultexcludes= "yes" longfile= "gnu" >
<!-- copy class files -->
<tarfileset dir= "${build}" prefix= "${releaseDir}/classes" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*.*" />
<!-- excluding all additional content parsers -->
<exclude name= "de/anomic/plasma/parser/*/*" />
<!-- excluding all additional seed uploaders -->
<exclude name= "de/anomic/yacy/seedUpload/**" />
<!-- excluding the soap handler -->
<exclude name= "de/anomic/soap/**" />
<!-- excluding the port forwarder -->
<exclude name= "de/anomic/server/serverPortForwardingSch.class" />
<exclude name= "de/anomic/server/serverPortForwardingSch$MyUserInfo.class" />
</tarfileset>
<tarfileset dir= "${build}" prefix= "${releaseDir}/classes" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFile.class" />
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFtp.class" />
</tarfileset>
<!-- copy libs -->
<tarfileset dir= "${lib}" includes= "**/*" prefix= "${releaseDir}/lib" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" />
<!-- copy configuration files -->
<tarfileset dir= "." dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" prefix= "${releaseDir}" >
<include name= "yacy.logging" />
<include name= "yacy.init" />
<include name= "yacy.yellow" />
<include name= "yacy.stopwords" />
<include name= "yacy.parser" />
<include name= "httpd.mime" />
<include name= "superseed.txt" />
</tarfileset>
<!-- copy Unix wrappers -->
<tarfileset dir= "." dirmode= "${accessRightsDir}" mode= "${accessRightsExecutable}" prefix= "${releaseDir}" >
<include name= "startYACY.sh" />
<include name= "stopYACY.sh" />
<include name= "killYACY.sh" />
<include name= "startYACY.command" />
<include name= "stopYACY.command" />
</tarfileset>
<!-- copy other wrappers -->
<tarfileset dir= "." dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" prefix= "${releaseDir}" >
<include name= "startYACY.bat" />
<include name= "startYACY_noconsole.bat" />
<include name= "stopYACY.bat" />
<include name= "startYACY_Win9x.bat" />
<include name= "startYACY_noconsole_Win9x.bat" />
<include name= "stopYACY_Win9x.bat" />
</tarfileset>
<!-- copy locales -->
<tarfileset dir= "${locales}" prefix= "${releaseDir}/locales" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "*" />
</tarfileset>
<!-- copy documentation -->
<tarfileset dir= "." dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" prefix= "${releaseDir}" >
<include name= "readme.txt" />
<include name= "gpl.txt" />
</tarfileset>
<tarfileset dir= "${doc}" prefix= "${releaseDir}/doc" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*" />
</tarfileset>
<!-- copy source code -->
<tarfileset dir= "${src}" prefix= "${releaseDir}/source" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*.*" />
<exclude name= "de/anomic/plasma/parser/*/*" />
<exclude name= "de/anomic/yacy/seedUpload/yacySeedUpload**" />
<exclude name= "de/anomic/soap/**" />
</tarfileset>
<tarfileset dir= "${src}" prefix= "${releaseDir}/source" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFile.java" />
<include name= "de/anomic/yacy/seedUpload/yacySeedUploadFtp.java" />
</tarfileset>
<!-- copy server pages -->
<tarfileset dir= "${htroot}" prefix= "${releaseDir}/htroot" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*" />
<exclude name= "yacy/seedUpload/**" />
</tarfileset>
<tarfileset dir= "${htroot}" prefix= "${releaseDir}/htroot" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "yacy/seedUpload/yacySeedUploadFile.html" />
<include name= "yacy/seedUpload/yacySeedUploadFtp.html" />
</tarfileset>
<!-- copy add - on's -->
<tarfileset dir= "${addon}" prefix= "${releaseDir}/addon" dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" >
<include name= "**/*" />
</tarfileset>
<!-- copy development tools -->
<tarfileset dir= "." dirmode= "${accessRightsDir}" mode= "${accessRightsFile}" prefix= "${releaseDir}" >
<include name= "build.xml" />
<include name= "build.properties" />
</tarfileset>
</tar>
<!-- writing the current release version into a file -->
<echo message= "${releaseVersion}" file= "${doc}/release.txt" />
</target>
<!-- make clean -->
<target name= "clean" description= "make clean" >
<delete >
<fileset dir= "${src}" includes= "**/*.class" />
<fileset dir= "${build}" includes= "**/*.class" />
<fileset dir= "${htroot}" includes= "**/*.class" />
</delete>
</target>
<!-- run YaCy (needed for NetBeans4) -->
<target name= "run" description= "Run YaCy" >
<!-- debug options:
java -Xrunhprof:help
Hprof usage: -Xrunhprof[:help]|[:<option > =<value > , ...]
Option Name and Value Description Default
_____________________ ___________ _______
heap=dump|sites|all heap profiling all
cpu=samples|times|old CPU usage off
monitor=y|n monitor contention n
format=a|b ascii or binary output a
file=<file > write data to file java.hprof(.txt for ascii)
net=<host > :<port > send data over a socket write to file
depth=<size > stack trace depth 4
cutoff=<value > output cutoff point 0.0001
lineno=y|n line number in traces? y
thread=y|n thread in traces? n
doe=y|n dump on exit? y
gc_okay=y|n GC okay during sampling y
Example: java -Xrunhprof:cpu=samples,file=log.txt,depth=3 FooClass
Note: format=b cannot be used with cpu=old|times
-->
<java classname= "yacy" fork= "yes" >
<classpath >
<pathelement location= "${build}" />
<pathelement location= "${htroot}" />
<pathelement location= "${lib}/commons-collections.jar" />
<pathelement location= "${lib}/commons-pool-1.2.jar" />
<pathelement location= "${libx}" />
<fileset dir= "${libx}" includes= "**/*.jar" />
</classpath>
<!-- <arg value=" - Xrunhprof"/> -->
<arg line= "-start" />
<!-- <arg line=" - migratewords"/> -->
<!-- <arg line=" - start ${user.dir}"/> -->
</java>
</target>
<!-- run a single file (selected in NetBeans4) -->
<target name= "run-single" depends= "compile" description= "Run Single File" >
<fail unless= "classname" > Must set property 'classname'</fail>
<java classname= "yacy" fork= "yes" >
<classpath refid= "run.classpath" />
<classpath >
<pathelement location= "${build}" />
<pathelement location= "${htroot}" />
<pathelement location= "${lib}/commons-collections.jar" />
<pathelement location= "${lib}/commons-pool-1.2.jar" />
<pathelement location= "${libx}" />
<fileset dir= "${libx}" includes= "**/*.jar" />
</classpath>
<arg line= "" />
</java>
</target>
<!-- run YaCy with remote debugging enabled on port 8000 -->
<target name= "debug" description= "Debug YaCy" >
<java classname= "yacy" fork= "yes" >
<classpath >
<pathelement location= "${build}" />
<pathelement location= "${htroot}" />
<pathelement location= "${lib}/commons-collections.jar" />
<pathelement location= "${lib}/commons-pool-1.2.jar" />
<pathelement location= "${libx}" />
<fileset dir= "${libx}" includes= "**/*.jar" />
</classpath>
<arg line= "-start" />
<jvmarg line= "-Xdebug" />
<jvmarg line= "-Xnoagent" />
<jvmarg line= "-Djava.compiler=none" />
<jvmarg line= "-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" />
</java>
</target>
<!-- stop YaCy again -->
<target name= "stop" description= "Stop YaCy" >
<java classname= "yacy" fork= "yes" >
<classpath >
<pathelement location= "${build}" />
<pathelement location= "${htroot}" />
<pathelement location= "${lib}/commons-collections.jar" />
<pathelement location= "${lib}/commons-pool-1.2.jar" />
<pathelement location= "${libx}" />
<fileset dir= "${libx}" includes= "**/*.jar" />
</classpath>
<arg line= "-stop" />
</java>
</target>
<!-- create the html - documentation from javadoc -->
<target name= "create-doc" description= "Create the javadoc-HTML-Pages" >
<javadoc destdir= "doc/api" version= "no" use= "yes" encoding= "iso-8859-1" windowtitle= "YaCy API Documentation" >
<fileset dir= "source" defaultexcludes= "yes" >
<include name= "**/*.java" />
</fileset>
</javadoc>
</target>
</project>