<commit_before><?xml version="1.0" encoding="UTF-8"?>

<project name="OpenCms" default="compile" basedir=".">

    <property name="version.number"             		value="7.0.2" />
    <property name="java.target.version"                value="1.5" />
    
	<property name="app.name" 							value="opencms" />
	<property name="src.all.comps" 						value="lib,modules,src-components,src-modules,src-setup,test,webapp" />
	
    <property name="opencms.input" 						location="${basedir}" />
	<property name="opencms.output" 					location="${basedir}/../BuildCms" />

    <property name="opencms.build"			            location="${opencms.output}/build" />
    <property name="opencms.output.classes"             location="${opencms.output}/build/classes-core" />
    <property name="opencms.output.tests"               location="${opencms.output}/build/test" />
    <property name="opencms.output.jars"                location="${opencms.output}/build/jars-core" />
    <property name="opencms.output.warfiles"            location="${opencms.output}/build/${app.name}" />
    <property name="opencms.output.distfiles"           location="${opencms.output}/zip" />    

    <property name="opencms.input.warfiles"            	location="${opencms.input}/webapp" />
    <property name="opencms.input.webinf" 				location="${opencms.input.warfiles}/WEB-INF" />
    <property name="opencms.input.libs.runtime"			location="${basedir}/lib/runtime" />
    <property name="opencms.input.libs.compile"			location="${basedir}/lib/compile" />
    <property name="opencms.input.libs.db.base"			location="${opencms.input.warfiles}/setup/database" />

    <property name="opencms.input.defaultconfiguration" location="${opencms.input.warfiles}/WEB-INF/config/opencms.properties" />
    <property name="opencms.input.default.registry"		location="${opencms.input.warfiles}/WEB-INF/config/registry.xml" />
    <property name="opencms.input.default.config"		location="${opencms.input.warfiles}/WEB-INF/config/opencms.xml" />
    <property name="opencms.input.default.system"		location="${opencms.input.warfiles}/WEB-INF/config/opencms-system.xml" />

	<property name="drivers.vfs"						value="db" />
	<property name="drivers.project"					value="db" />
	<property name="drivers.user"						value="db" />
	<property name="drivers.history"					value="db" />
	<property name="db.additional.pools" 				value="" />
	<property name="drivers.configuration"				value="" />
	<property name="registry.configuration"				value="" />
	<property name="opencms.configuration"				value="" />
	<property name="system.runtimeinfo"					value="org.opencms.db.CmsDbContextFactory" />

    <property name="excludes"                   		value="**/CVS/*,**/.nbattrs,**/.project,**/.classpath" />
    
    <property environment="env" />
	
	<!-- comma separated list of jar archives to be removed during update -->
	<property name="updater.jars.remove"				value="alkacon-diff-0.9.1.jar,commons-collections-3.1.jar,commons-dbcp-1.2.1.jar,commons-digester-1.7.jar,commons-logging-1.0.4.jar,commons-pool-1.2.jar,htmlparser-1.5-20050925.jar,jaxen-1.1-beta-4.jar,jstl-1.0.6.jar,log4j-1.2.9.jar,lucene-analyzers-1.9.1.jar,lucene-core-1.9.1.jar,mysql-connector-java-3.1.12-bin.jar,quartz-1.4.5.jar,standard-1.0.6.jar,xercesImpl-2.6.2.jar,xml-apis-2.6.2.jar,alkacon-simapi-0.9.2.jar,alkacon-simapi-0.9.3.jar,alkacon-simapi-0.9.4.jar" />
	<!-- comma separated list of files in WEB-INF/ to be updated -->
	<property name="updater.webinf.files"				value="opencms.tld,web.xml,cmsshell.sh" />

 	<taskdef resource="net/sf/antcontrib/antlib.xml" loaderref="contrib">
	  <classpath>
	    <pathelement location="${opencms.input.libs.compile}/ant-contrib-1.0b1.jar"/>
	  </classpath>
	</taskdef>
	
	<taskdef resource="org/opencms/util/ant/taskdefs.properties" loaderref="opencms">
		<classpath>
			<pathelement location="${opencms.input.libs.compile}/ant-opencms-1.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-digester-1.7.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-collections-3.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-logging-1.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-beanutils-1.7.0.jar" />
		</classpath>
	</taskdef>

	<!-- 
	  -	Checks if all required libraries are available
	  -->
    <target name="init" >
    	
        <condition property="tomcat.home" value="${env.TOMCAT_HOME}">
            <available file="${env.TOMCAT_HOME}" type="dir"/>
        </condition>

        <condition property="tomcat.home" value="${env.CATALINA_HOME}">
            <available file="${env.CATALINA_HOME}" type="dir"/>
        </condition>
    
        <tstamp>
            <format property="timestamp" pattern="yyyy.MM.dd-HH.mm"/>
        </tstamp>
        <property name="version.number" value="${env.USERNAME}_${timestamp}"/>
        
        <echo message="Building OpenCms ${version.number}" />
        <echo message=" " />
        <echo message="OpenCms input directory is: ${opencms.input}" />
        <echo message="OpenCms output directory is: ${opencms.output}" />
        <echo message="Java version detected: ${ant.java.version}"/>
        <echo message="Java target version: ${java.target.version}"/>
        <echo message="Java home is: ${env.JAVA_HOME}"/>
    	<echo message="Tomcat home is: ${tomcat.home}" />        
    </target>

    <target name="clean" description="Delete existing output directories">
    	
        <delete dir="${opencms.output.tests}" />
        <delete dir="${opencms.output.warfiles}" />
        <delete dir="${opencms.output}/build" />
        <delete dir="${opencms.output.distfiles}" />
    </target>
    		
    <target name="compile" depends="init" description="Compile the OpenCms classes">
    	
        <mkdir dir="${opencms.output.classes}" />    	
    	
        <uptodate property="classesUpToDate" targetfile="${opencms.output.jars}/opencms.jar">
        	<srcfiles dir= "${opencms.input}/src" includes="**/*.java" excludes="${build.excludes},${excludes}"/>
        	<srcfiles dir= "${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
        </uptodate>
            	
       	<javac
            srcdir="${opencms.input}/src"
            destdir="${opencms.output.classes}"
            debug="on"
            optimize="on"
            deprecation="on"
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       		<!-- compilerarg value="-Xlint:unchecked"/ -->
       	</javac>
		
        <copy todir="${opencms.output.classes}">
            <fileset dir="${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}"/>
        </copy>              
                
        <antcall target="versioninfo" />        
    </target>

    
	<!-- 
	  -	Generate version information files
	  -->
    <target name="versioninfo" unless="classesUpToDate" >

		<copy 
			file="${opencms.input.warfiles}/WEB-INF/setupdata/version.properties" 
			tofile="${opencms.output.classes}/org/opencms/main/version.properties" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION_NUMBER" value="${version.number}"/>
      			<filter token="OPENCMS_VERSION_NAME" value="${version.name}"/>
    		</filterset>			
		</copy>		
      				    	
		<copy 
			file="${opencms.input.warfiles}/setup/versions.txt" 
			tofile="${opencms.output.classes}/versions.txt" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION" value="OpenCms ${version.number}"/>
    		</filterset>			
		</copy>
    	
		<copy 
			file="${opencms.input.warfiles}/setup/license.html" 
			tofile="${opencms.output.classes}/license.html" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION_NUMBER" value="${version.number}"/>
      			<filter token="OPENCMS_VERSION_NAME" value="${version.name}"/>
    		</filterset>			
		</copy>    	
       	
	   	<copy 
	   		file="${opencms.input.defaultconfiguration}" 
	   		tofile="${opencms.output.classes}/opencms.properties" overwrite="true">	   		
    		<filterset>
      			<filter token="DRIVERS_VFS" value="${drivers.vfs}"/>
      			<filter token="DRIVERS_PROJECT" value="${drivers.project}"/>
      			<filter token="DRIVERS_USER" value="${drivers.user}"/>
      			<filter token="DRIVERS_HISTORY" value="${drivers.history}"/>    			
      			<filter token="DRIVERS_CONFIGURATION" value="${drivers.configuration}"/>
    			<filter token="ADDITIONAL_DB_POOLS" value="${db.additional.pools}"/>
    		</filterset>
	   	</copy>       	  
    	
	   	<copy 
	   		file="${opencms.input.default.config}" 
	   		tofile="${opencms.output.classes}/opencms.xml" overwrite="true">	   		
    		<filterset>
      			<filter token="OPENCMS_CONFIGURATION" value="${opencms.configuration}"/>
    		</filterset>	   		
	   	</copy>	   		   	

	   	<copy 
	   		file="${opencms.input.default.system}" 
	   		tofile="${opencms.output.classes}/opencms-system.xml" overwrite="true">	   		
    		<filterset>
      			<filter token="RUNTIME_INFO" value="${system.runtimeinfo}"/>
    		</filterset>	   		
	   	</copy>	   		   	
	</target>
    		    

    <target name="jar" 
    	depends="compile" description="Generate the OpenCms .jar files">
    	
        <mkdir dir="${opencms.output.jars}" />
            	
        <jar
            jarfile="${opencms.output.jars}/opencms.jar"
            basedir="${opencms.output.classes}"
            includes="org/opencms/**" >      
            <metainf dir="${opencms.input.warfiles}/WEB-INF" includes="opencms.tld"/>
        </jar>        	     
    	
    </target>

	<!-- 
		Set/Override this property to one of the following values: 
		- interactive: interactive GUI based module selection.
		- selection: module selection based on modules.common.selection property
		- all: module selection based on modules.common.all property defined in the all-modules.properties file
	-->
	<property name="modules.selection.mode"				value="interactive" />
	
    <target name="build.updater" 
    	depends="setup-jar" description="Generates a distributable updater zip file">
    	
    	<property file="${basedir}/modules/all-modules.properties" />
    	<echo message="all: ${basedir}/modules"/>
    	<if>
    		<not><isset property="modules.common.all" /></not>
    	  <then>
    		<fail>
    			property modules.common.all undefined.
    		</fail>
    	  </then>
    	</if>
        <sortlist property="modules.all.sort" value="${modules.common.all}" override="true" />
	  	<echo message="all: ${modules.all.sort}"/>
		<property name="modules.var" value="${modules.all.sort}" />
	  	<ant antfile="${basedir}/modules/build.xml" target="dist" inheritAll="false" >
	  		<property name="modules.selection.mode" value="selection" />
	  		<property name="modules.common.selection" value="${modules.var}" />
	  	</ant>

    	<delete failonerror="no" file="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" />
    	<for list="${updater.jars.remove}" param="jarfile" delimiter="," trim="yes">
    	  <sequential>
            <copy file="${opencms.input.warfiles}/update/empty.jar" tofile="${opencms.output}/build/jars-core/@{jarfile}"/>
      	  </sequential>
		</for>
    	<copy todir="${opencms.output.jars}" flatten="true" >
    		<fileset dir="${opencms.input.libs.db.base}">
    	    	<include name="**/*.jar"/>
    	    </fileset>
    	</copy>
    	    	
    	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" >
    		<zipfileset dir="${opencms.input.warfiles}" includes="update/**" excludes="update/empty.jar,update/readme.txt"/> 
    		<zipfileset dir="${opencms.input.warfiles}" includes="update/readme.txt" fullpath="readme.txt"/>
        	<zipfileset dir="${opencms.input.libs.runtime}" prefix="WEB-INF/lib" includes="*.jar" />
        	<zipfileset dir="${opencms.output}/build/jars-core/" prefix="WEB-INF/lib" includes="*.jar" />
        	<zipfileset dir="${opencms.input.webinf}" prefix="WEB-INF" includes="${updater.webinf.files}" />
    	</zip>

    	<for list="${modules.var}" param="module" trim="yes">
    	  <sequential>
    	  	<!-- skip some unwanted modules -->
        	<if>
        		<not>
        			<or>
			    		<equals arg1="@{module}" arg2="org.opencms.legacy.compatibility" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos.list" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos.widget" />
        			</or>
        		</not>
				<then>
		    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
		            	<zipfileset dir="${opencms.output.distfiles}" prefix="update/modules" includes="@{module}_*.zip" />
		    	  	</zip>
		        	<if>
			    		<available file="${opencms.output}/build/jars-@{module}" />
						<then>
				    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
				            	<zipfileset dir="${opencms.output}/build/jars-@{module}" prefix="WEB-INF/lib" includes="@{module}.jar" />
				    	  	</zip>
						</then>
					</if>
		        	<if>
			    		<available file="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" />
						<then>
				    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
				            	<zipfileset dir="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" prefix="WEB-INF/lib" includes="*.jar" />
				    	  	</zip>
						</then>
					</if>
				</then>
			</if>    	  	
    	  </sequential>
    	</for>
    </target>

    <target name="war" 
    	depends="setup-jar" description="Builds the opencms.war">
        
    	<delete failonerror="no" file="${opencms.output}/build/${app.name}.war" />
    	<copy todir="${opencms.output.jars}" flatten="true" >
    		<fileset dir="${opencms.input.libs.db.base}">
    	    	<include name="**/*.jar"/>
    	    </fileset>
    	</copy>

        <war 
        	destfile="${opencms.output}/build/${app.name}.war" 
        	webxml="${opencms.input.warfiles}/WEB-INF/web.xml"
        	manifest="${opencms.input.warfiles}/META-INF/MANIFEST.MF">
        	     		
       		<lib dir="${opencms.output.jars}">
       			<include name="*.jar" />
       		</lib>
       		<lib dir="${opencms.input.libs.runtime}" >
	   			<include name="*.jar" />
	   		</lib>
       		<fileset dir="${opencms.input.warfiles}">       		
       			<exclude name="WEB-INF/web.xml" />
       			<exclude name="WEB-INF/config/opencms.properties" />
       			<exclude name="WEB-INF/config/opencms-system.xml" />
       			<exclude name="WEB-INF/config/opencms.xml" />
       			<exclude name="WEB-INF/config/registry.xml" />
       			<exclude name="setup/versions.txt" />
       			<exclude name="setup/license.html" />
       			<exclude name="setup/database/**/*.jar" />
       			<exclude name="update/**" />
       			<exclude name="build.xml,.*,${excludes}" />
       		</fileset>
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.properties" />
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms-system.xml" />
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="registry.xml" />  			
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.xml" />  			
  			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="versions.txt" />
			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
        </war>        
    </target>
    

    <target name="tomcat.copy" 
    	description="Copy updated files to Tomcat directorys">

       	<copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
            <fileset dir="${opencms.input.libs.runtime}">
                <include name="**/*.jar"/>
            </fileset>
        </copy>    	
        <copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
            <fileset dir="${opencms.output.jars}">
                <include name="*.jar"/>
            </fileset>
        </copy>     
        <copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${tomcat.home}/webapps/${app.name}/WEB-INF"/>
        <copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${tomcat.home}/webapps/${app.name}/WEB-INF"/>       
    </target>     
    
    
    <target name="tomcat.update" 
    	depends="jar, tomcat.copy" description="Recompile changed classes and install in Tomcat webapps directory"/>      

    <target name="tomcat.all" 
    	depends="clean, tomcat.update" description="Do a complete recompile of all classes and install in Tomcat webapps directory"/>              
    
    <target name="jboss.copy" 
    	description="Copy updated files to JBoss directory">

       	<copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
            <fileset dir="${opencms.input.libs.runtime}">
                <include name="**/*.jar"/>
            </fileset>
        </copy>    	
        <copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
            <fileset dir="${opencms.output.jars}">
                <include name="*.jar"/>
            </fileset>
        </copy>     
        <copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF"/>
        <copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF"/>       
    </target>     
       
    <target name="jboss.update" 
    	depends="jar, jboss.copy" description="Recompile changed classes and install in JBoss deploy directory"/>      
    
    <target name="bindist" 
    	depends="clean" description="Creates a binary distribution ZIP, including the templateone demopages">
    	
    	<!-- read list of all available modules -->
    	<property file="${opencms.input}/modules/all-modules.properties" />
    	
		<!-- remove org.opencms.workplace.demos modules -->
		<var name="modules.common.selection" unset="true" />
		<for list="${modules.common.all}" param="module" trim="yes">
			<sequential>
				<propertyregex property="pack.name" input="@{module}" regexp="org\.opencms\.workplace\.demos([^\.]*)" select="\1" casesensitive="false" />
				<if>
					<not>
						<isset property="pack.name" />
					</not>
					<then>
						<if>
						  <isset property="modules.common.selection"/>
						  <then>
							<var name="modules.common.selection" value="${modules.common.selection},@{module}" />
						  </then>
						  <else>
							<var name="modules.common.selection" value="@{module}" />
						  </else>
						</if>
					</then>
				</if>
				<var name="pack.name" unset="true" />
			</sequential>
		</for>
    	<echo>${modules.common.selection}</echo>
    	<!-- build war with selected modules -->
	  	<ant antfile="${opencms.input}/modules/build.xml" target="war" inheritAll="false" >
	  		<property name="modules.common.selection" value="${modules.common.selection}" />
	  		<property name="modules.selection.mode" value="selection" />
	  		<property name="app.name" value="${app.name}" />
	  	</ant>    	
    	
    	<!-- build distro -->
        <mkdir dir="${opencms.output.distfiles}" />                    
    	
        <zip destfile="${opencms.output.distfiles}/opencms_${version.number}.zip">
            <zipfileset dir="${opencms.output}/build" includes="${app.name}.war"/>
            <zipfileset dir="${opencms.input}" includes="install.html,license.txt,history.txt"/>
        </zip>

    </target>    
    
    <target name="srcdist" 
    	description="Creates a source distribution ZIP">
    	
    	<echo message="Building OpenCms ${app.name} source distribution " />
        <echo message=" " />
        <echo message="OpenCms input directory is: ${opencms.input}" />
        <echo message="OpenCms output directory is: ${opencms.output}" />
		
	  	<selectionprompt 
	  	  	property="src.comps"
	  	    defaultvalue="${src.all.comps}"
	  		allvalues="${src.all.comps}"
	  		prompt="Please select the additional source components to include:"
	  		title="Additional Source Components Selection" 
	  		columns="1" 
	  	/>

        <mkdir dir="${opencms.output.distfiles}" />                    
		
    	<delete file="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip" failonerror="no"/>
        <zip destfile="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip">
        	<zipfileset dir="${opencms.input}/src" excludes="${excludes}" prefix="src" />
            <zipfileset dir="${opencms.input}" includes="build.xml,install.html,license.txt,history.txt"/>
        </zip>
    	
	    <if>
	      <not>
		      <equals arg1="${src.comps}" arg2="__ABORT__" />
	      </not>
	      <then>
	    	<for list="${src.comps}" param="comp" trim="yes">
	    	  <sequential>
	            <zip destfile="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip" update="true" whenempty="fail">
	            	<zipfileset dir="${opencms.input}/@{comp}" excludes="${excludes}" prefix="@{comp}" />
	            </zip>
	    	  </sequential>
	    	</for>
	      </then>
	    </if>

    </target>
		
    <target name="compile-tests" depends="setup-jar" description="Compile the OpenCms test classes">
    	
        <mkdir dir="${opencms.output.tests}" />    	
    	
       	<javac
            srcdir="${opencms.input}/test"
            destdir="${opencms.output.tests}"
            excludes="**/data/**"
            debug="on"
            optimize="on"
            deprecation="on" 
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
     	      <fileset dir="${opencms.output}/build">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       	</javac>
		
        <copy todir="${opencms.output.tests}">
            <fileset dir="${opencms.input}/test" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd" excludes="${excludes},**/data/**"/>
        </copy>
    	
        <mkdir dir="${opencms.output.tests}/../webapp/" />      	
        <copy todir="${opencms.output.tests}/../webapp/">
            <fileset dir="${opencms.input.warfiles}" />
        </copy>       	    	       
    	
        <mkdir dir="${opencms.output.tests}/../test/data/" />  
        <copy todir="${opencms.output.tests}/../test/data/">
            <fileset dir="${opencms.input}/test/data" />
        </copy>       	    	       
    </target>
	

    <target name="setup-jar" depends="jar" description="Compile the OpenCms setup/updater classes">
    	
        <mkdir dir="${opencms.output}/build/setup" />    	
    	
       	<javac
            srcdir="${opencms.input}/src-setup"
            destdir="${opencms.output}/build/setup"
            debug="on"
            optimize="on"
            deprecation="on" 
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
     	      <fileset dir="${opencms.output}/build">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       	</javac>
    	
        <copy todir="${opencms.output}/build/setup">
            <fileset dir="${opencms.input}/src-setup" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}"/>
        </copy>              
                
        <jar
            jarfile="${opencms.output.jars}/opencms-setup.jar"
            basedir="${opencms.output}/build/setup"
            includes="org/opencms/**" />

    </target>
	

	<target name="unittests" depends="compile-tests"
		description="Runs the core Junit test cases">
		
		<junit showoutput="yes" printsummary="yes" fork="yes" haltonfailure="no" haltonerror="no">
			<classpath>
				<pathelement path="${opencms.output.tests}"/>
        	    <fileset dir="${opencms.output}/build">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
        	    <fileset dir="${opencms.input.libs.compile}">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
	     	    <fileset dir="${opencms.input.libs.runtime}">
	     	        <include name="**/*.jar"/>
	     	    </fileset>
	       	    <fileset dir="${opencms.input.libs.db.base}">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
	       	</classpath>
			
			<formatter type="plain" />
			
			<test name="org.opencms.test.AllTests" />			
		</junit>
	</target>

    <property name="signjar.storepass" value="secret" />

    <target name="uploadjar" description="Build the upload.jar">
        
        <delete dir="${opencms.output}/upload/" />
        <mkdir dir="${opencms.output}/upload/org/opencms/applet/" />
        
        <copy todir="${opencms.output}/upload/org/opencms/applet/">
            <fileset dir="${opencms.input}/src-components/org/opencms/applet">
                <include name="**/*.png"/>
                <include name="**/*.gif"/>
            </fileset>
        </copy>  

    	<unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-logging-1.1.jar" />
        <unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-httpclient-3.0.1.jar" />
        <unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-codec-1.3.jar" />

        <delete>
            <fileset dir="${opencms.output}/upload/">
                <include name="**/*.html" />
            </fileset>
        </delete>
        
        <javac
            srcdir="${opencms.input}/src-components/org/opencms/applet"
            destdir="${opencms.output}/upload"
            debug="on"
            optimize="on"
            deprecation="on"
            source="1.4"
            target="${java.target.version}">
        </javac>
 
        <jar
            jarfile="${opencms.output}/upload/upload_unsigned.jar"
            basedir="${opencms.output}/upload/"
            includes="org/**" >  
        </jar>
       
        <genkey 
            keystore="${opencms.output}/upload/keystore" 
            validity="3650" 
            alias="OpenCms" 
            storepass="${<PASSWORD>pass}">
            <dname>
                <param name="CN" value="OpenCms Upload Applet" />
                <param name="OU" value="opencms.org" />
                <param name="O"  value="Alkacon Software GmbH" />
                <param name="L"  value="An der Wachsfabrik 13" />
                <param name="S"  value="Cologne" />
                <param name="C"  value="DE" />
            </dname>
        </genkey>       

        <signjar 
            signedjar="${opencms.output}/upload/upload.jar" 
            alias="OpenCms" 
            jar="${opencms.output}/upload/upload_unsigned.jar" 
            storepass="${<PASSWORD>}"
            keystore="${opencms.output}/upload/keystore" />
        
        <delete file="${opencms.output}/upload/upload_unsigned.jar" />

        <copy 
            todir="${opencms.input}/modules/org.opencms.workplace.explorer/resources/system/workplace/resources/components/upload_applet/"
            file="${opencms.output}/upload/upload.jar" />
    </target>    

</project><commit_msg>actualized jar files to remove during update<commit_after><?xml version="1.0" encoding="UTF-8"?>

<project name="OpenCms" default="compile" basedir=".">

    <property name="version.number"             		value="7.0.2" />
    <property name="java.target.version"                value="1.5" />
    
	<property name="app.name" 							value="opencms" />
	<property name="src.all.comps" 						value="lib,modules,src-components,src-modules,src-setup,test,webapp" />
	
    <property name="opencms.input" 						location="${basedir}" />
	<property name="opencms.output" 					location="${basedir}/../BuildCms" />

    <property name="opencms.build"			            location="${opencms.output}/build" />
    <property name="opencms.output.classes"             location="${opencms.output}/build/classes-core" />
    <property name="opencms.output.tests"               location="${opencms.output}/build/test" />
    <property name="opencms.output.jars"                location="${opencms.output}/build/jars-core" />
    <property name="opencms.output.warfiles"            location="${opencms.output}/build/${app.name}" />
    <property name="opencms.output.distfiles"           location="${opencms.output}/zip" />    

    <property name="opencms.input.warfiles"            	location="${opencms.input}/webapp" />
    <property name="opencms.input.webinf" 				location="${opencms.input.warfiles}/WEB-INF" />
    <property name="opencms.input.libs.runtime"			location="${basedir}/lib/runtime" />
    <property name="opencms.input.libs.compile"			location="${basedir}/lib/compile" />
    <property name="opencms.input.libs.db.base"			location="${opencms.input.warfiles}/setup/database" />

    <property name="opencms.input.defaultconfiguration" location="${opencms.input.warfiles}/WEB-INF/config/opencms.properties" />
    <property name="opencms.input.default.registry"		location="${opencms.input.warfiles}/WEB-INF/config/registry.xml" />
    <property name="opencms.input.default.config"		location="${opencms.input.warfiles}/WEB-INF/config/opencms.xml" />
    <property name="opencms.input.default.system"		location="${opencms.input.warfiles}/WEB-INF/config/opencms-system.xml" />

	<property name="drivers.vfs"						value="db" />
	<property name="drivers.project"					value="db" />
	<property name="drivers.user"						value="db" />
	<property name="drivers.history"					value="db" />
	<property name="db.additional.pools" 				value="" />
	<property name="drivers.configuration"				value="" />
	<property name="registry.configuration"				value="" />
	<property name="opencms.configuration"				value="" />
	<property name="system.runtimeinfo"					value="org.opencms.db.CmsDbContextFactory" />

    <property name="excludes"                   		value="**/CVS/*,**/.nbattrs,**/.project,**/.classpath" />
    
    <property environment="env" />
	
	<!-- comma separated list of jar archives to be removed during update -->
	<property name="updater.jars.remove"				value="alkacon-diff-0.9.1.jar,commons-collections-3.1.jar,commons-dbcp-1.2.1.jar,commons-digester-1.7.jar,commons-logging-1.0.4.jar,commons-pool-1.2.jar,htmlparser-1.5-20050925.jar,jaxen-1.1-beta-4.jar,jstl-1.0.6.jar,jug-1.1.jar,jug-1.1.1.jar,jug-1.1.2.jar,log4j-1.2.9.jar,lucene-analyzers-1.9.1.jar,lucene-core-1.9.1.jar,lucene-analyzers-2.1.0.jar,lucene-core-2.1.0.jar,lucene-highlighter-2.1.0.jar,lucene-snowball-2.1.0.jar,mysql-connector-java-3.1.12-bin.jar,mysql-connector-java-5.0.5-bin.jar,quartz-1.4.5.jar,standard-1.0.6.jar,xercesImpl-2.6.2.jar,xml-apis-2.6.2.jar,alkacon-simapi-0.9.2.jar,alkacon-simapi-0.9.3.jar,alkacon-simapi-0.9.4.jar" />
	<!-- comma separated list of files in WEB-INF/ to be updated -->
	<property name="updater.webinf.files"				value="opencms.tld,web.xml,cmsshell.sh" />

 	<taskdef resource="net/sf/antcontrib/antlib.xml" loaderref="contrib">
	  <classpath>
	    <pathelement location="${opencms.input.libs.compile}/ant-contrib-1.0b1.jar"/>
	  </classpath>
	</taskdef>
	
	<taskdef resource="org/opencms/util/ant/taskdefs.properties" loaderref="opencms">
		<classpath>
			<pathelement location="${opencms.input.libs.compile}/ant-opencms-1.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-digester-1.7.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-collections-3.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-logging-1.1.jar" />
			<pathelement location="${opencms.input.libs.runtime}/commons-beanutils-1.7.0.jar" />
		</classpath>
	</taskdef>

	<!-- 
	  -	Checks if all required libraries are available
	  -->
    <target name="init" >
    	
        <condition property="tomcat.home" value="${env.TOMCAT_HOME}">
            <available file="${env.TOMCAT_HOME}" type="dir"/>
        </condition>

        <condition property="tomcat.home" value="${env.CATALINA_HOME}">
            <available file="${env.CATALINA_HOME}" type="dir"/>
        </condition>
    
        <tstamp>
            <format property="timestamp" pattern="yyyy.MM.dd-HH.mm"/>
        </tstamp>
        <property name="version.number" value="${env.USERNAME}_${timestamp}"/>
        
        <echo message="Building OpenCms ${version.number}" />
        <echo message=" " />
        <echo message="OpenCms input directory is: ${opencms.input}" />
        <echo message="OpenCms output directory is: ${opencms.output}" />
        <echo message="Java version detected: ${ant.java.version}"/>
        <echo message="Java target version: ${java.target.version}"/>
        <echo message="Java home is: ${env.JAVA_HOME}"/>
    	<echo message="Tomcat home is: ${tomcat.home}" />        
    </target>

    <target name="clean" description="Delete existing output directories">
    	
        <delete dir="${opencms.output.tests}" />
        <delete dir="${opencms.output.warfiles}" />
        <delete dir="${opencms.output}/build" />
        <delete dir="${opencms.output.distfiles}" />
    </target>
    		
    <target name="compile" depends="init" description="Compile the OpenCms classes">
    	
        <mkdir dir="${opencms.output.classes}" />    	
    	
        <uptodate property="classesUpToDate" targetfile="${opencms.output.jars}/opencms.jar">
        	<srcfiles dir= "${opencms.input}/src" includes="**/*.java" excludes="${build.excludes},${excludes}"/>
        	<srcfiles dir= "${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
        </uptodate>
            	
       	<javac
            srcdir="${opencms.input}/src"
            destdir="${opencms.output.classes}"
            debug="on"
            optimize="on"
            deprecation="on"
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       		<!-- compilerarg value="-Xlint:unchecked"/ -->
       	</javac>
		
        <copy todir="${opencms.output.classes}">
            <fileset dir="${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}"/>
        </copy>              
                
        <antcall target="versioninfo" />        
    </target>

    
	<!-- 
	  -	Generate version information files
	  -->
    <target name="versioninfo" unless="classesUpToDate" >

		<copy 
			file="${opencms.input.warfiles}/WEB-INF/setupdata/version.properties" 
			tofile="${opencms.output.classes}/org/opencms/main/version.properties" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION_NUMBER" value="${version.number}"/>
      			<filter token="OPENCMS_VERSION_NAME" value="${version.name}"/>
    		</filterset>			
		</copy>		
      				    	
		<copy 
			file="${opencms.input.warfiles}/setup/versions.txt" 
			tofile="${opencms.output.classes}/versions.txt" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION" value="OpenCms ${version.number}"/>
    		</filterset>			
		</copy>
    	
		<copy 
			file="${opencms.input.warfiles}/setup/license.html" 
			tofile="${opencms.output.classes}/license.html" overwrite="true">			
    		<filterset>
      			<filter token="OPENCMS_VERSION_NUMBER" value="${version.number}"/>
      			<filter token="OPENCMS_VERSION_NAME" value="${version.name}"/>
    		</filterset>			
		</copy>    	
       	
	   	<copy 
	   		file="${opencms.input.defaultconfiguration}" 
	   		tofile="${opencms.output.classes}/opencms.properties" overwrite="true">	   		
    		<filterset>
      			<filter token="DRIVERS_VFS" value="${drivers.vfs}"/>
      			<filter token="DRIVERS_PROJECT" value="${drivers.project}"/>
      			<filter token="DRIVERS_USER" value="${drivers.user}"/>
      			<filter token="DRIVERS_HISTORY" value="${drivers.history}"/>    			
      			<filter token="DRIVERS_CONFIGURATION" value="${drivers.configuration}"/>
    			<filter token="ADDITIONAL_DB_POOLS" value="${db.additional.pools}"/>
    		</filterset>
	   	</copy>       	  
    	
	   	<copy 
	   		file="${opencms.input.default.config}" 
	   		tofile="${opencms.output.classes}/opencms.xml" overwrite="true">	   		
    		<filterset>
      			<filter token="OPENCMS_CONFIGURATION" value="${opencms.configuration}"/>
    		</filterset>	   		
	   	</copy>	   		   	

	   	<copy 
	   		file="${opencms.input.default.system}" 
	   		tofile="${opencms.output.classes}/opencms-system.xml" overwrite="true">	   		
    		<filterset>
      			<filter token="RUNTIME_INFO" value="${system.runtimeinfo}"/>
    		</filterset>	   		
	   	</copy>	   		   	
	</target>
    		    

    <target name="jar" 
    	depends="compile" description="Generate the OpenCms .jar files">
    	
        <mkdir dir="${opencms.output.jars}" />
            	
        <jar
            jarfile="${opencms.output.jars}/opencms.jar"
            basedir="${opencms.output.classes}"
            includes="org/opencms/**" >      
            <metainf dir="${opencms.input.warfiles}/WEB-INF" includes="opencms.tld"/>
        </jar>        	     
    	
    </target>

	<!-- 
		Set/Override this property to one of the following values: 
		- interactive: interactive GUI based module selection.
		- selection: module selection based on modules.common.selection property
		- all: module selection based on modules.common.all property defined in the all-modules.properties file
	-->
	<property name="modules.selection.mode"				value="interactive" />
	
    <target name="build.updater" 
    	depends="setup-jar" description="Generates a distributable updater zip file">
    	
    	<property file="${basedir}/modules/all-modules.properties" />
    	<echo message="all: ${basedir}/modules"/>
    	<if>
    		<not><isset property="modules.common.all" /></not>
    	  <then>
    		<fail>
    			property modules.common.all undefined.
    		</fail>
    	  </then>
    	</if>
        <sortlist property="modules.all.sort" value="${modules.common.all}" override="true" />
	  	<echo message="all: ${modules.all.sort}"/>
		<property name="modules.var" value="${modules.all.sort}" />
	  	<ant antfile="${basedir}/modules/build.xml" target="dist" inheritAll="false" >
	  		<property name="modules.selection.mode" value="selection" />
	  		<property name="modules.common.selection" value="${modules.var}" />
	  	</ant>

    	<delete failonerror="no" file="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" />
    	<for list="${updater.jars.remove}" param="jarfile" delimiter="," trim="yes">
    	  <sequential>
            <copy file="${opencms.input.warfiles}/update/empty.jar" tofile="${opencms.output}/build/jars-core/@{jarfile}"/>
      	  </sequential>
		</for>
    	<copy todir="${opencms.output.jars}" flatten="true" >
    		<fileset dir="${opencms.input.libs.db.base}">
    	    	<include name="**/*.jar"/>
    	    </fileset>
    	</copy>
    	    	
    	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" >
    		<zipfileset dir="${opencms.input.warfiles}" includes="update/**" excludes="update/empty.jar,update/readme.txt"/> 
    		<zipfileset dir="${opencms.input.warfiles}" includes="update/readme.txt" fullpath="readme.txt"/>
        	<zipfileset dir="${opencms.input.libs.runtime}" prefix="WEB-INF/lib" includes="*.jar" />
        	<zipfileset dir="${opencms.output}/build/jars-core/" prefix="WEB-INF/lib" includes="*.jar" />
        	<zipfileset dir="${opencms.input.webinf}" prefix="WEB-INF" includes="${updater.webinf.files}" />
    	</zip>

    	<for list="${modules.var}" param="module" trim="yes">
    	  <sequential>
    	  	<!-- skip some unwanted modules -->
        	<if>
        		<not>
        			<or>
			    		<equals arg1="@{module}" arg2="org.opencms.legacy.compatibility" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos.list" />
			    		<equals arg1="@{module}" arg2="org.opencms.workplace.demos.widget" />
        			</or>
        		</not>
				<then>
		    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
		            	<zipfileset dir="${opencms.output.distfiles}" prefix="update/modules" includes="@{module}_*.zip" />
		    	  	</zip>
		        	<if>
			    		<available file="${opencms.output}/build/jars-@{module}" />
						<then>
				    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
				            	<zipfileset dir="${opencms.output}/build/jars-@{module}" prefix="WEB-INF/lib" includes="@{module}.jar" />
				    	  	</zip>
						</then>
					</if>
		        	<if>
			    		<available file="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" />
						<then>
				    	  	<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.number}.zip" update="true" whenempty="fail">
				            	<zipfileset dir="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" prefix="WEB-INF/lib" includes="*.jar" />
				    	  	</zip>
						</then>
					</if>
				</then>
			</if>    	  	
    	  </sequential>
    	</for>
    </target>

    <target name="war" 
    	depends="setup-jar" description="Builds the opencms.war">
        
    	<delete failonerror="no" file="${opencms.output}/build/${app.name}.war" />
    	<copy todir="${opencms.output.jars}" flatten="true" >
    		<fileset dir="${opencms.input.libs.db.base}">
    	    	<include name="**/*.jar"/>
    	    </fileset>
    	</copy>

        <war 
        	destfile="${opencms.output}/build/${app.name}.war" 
        	webxml="${opencms.input.warfiles}/WEB-INF/web.xml"
        	manifest="${opencms.input.warfiles}/META-INF/MANIFEST.MF">
        	     		
       		<lib dir="${opencms.output.jars}">
       			<include name="*.jar" />
       		</lib>
       		<lib dir="${opencms.input.libs.runtime}" >
	   			<include name="*.jar" />
	   		</lib>
       		<fileset dir="${opencms.input.warfiles}">       		
       			<exclude name="WEB-INF/web.xml" />
       			<exclude name="WEB-INF/config/opencms.properties" />
       			<exclude name="WEB-INF/config/opencms-system.xml" />
       			<exclude name="WEB-INF/config/opencms.xml" />
       			<exclude name="WEB-INF/config/registry.xml" />
       			<exclude name="setup/versions.txt" />
       			<exclude name="setup/license.html" />
       			<exclude name="setup/database/**/*.jar" />
       			<exclude name="update/**" />
       			<exclude name="build.xml,.*,${excludes}" />
       		</fileset>
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.properties" />
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms-system.xml" />
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="registry.xml" />  			
  			<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.xml" />  			
  			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="versions.txt" />
			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
			<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
        </war>        
    </target>
    

    <target name="tomcat.copy" 
    	description="Copy updated files to Tomcat directorys">

       	<copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
            <fileset dir="${opencms.input.libs.runtime}">
                <include name="**/*.jar"/>
            </fileset>
        </copy>    	
        <copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
            <fileset dir="${opencms.output.jars}">
                <include name="*.jar"/>
            </fileset>
        </copy>     
        <copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${tomcat.home}/webapps/${app.name}/WEB-INF"/>
        <copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${tomcat.home}/webapps/${app.name}/WEB-INF"/>       
    </target>     
    
    
    <target name="tomcat.update" 
    	depends="jar, tomcat.copy" description="Recompile changed classes and install in Tomcat webapps directory"/>      

    <target name="tomcat.all" 
    	depends="clean, tomcat.update" description="Do a complete recompile of all classes and install in Tomcat webapps directory"/>              
    
    <target name="jboss.copy" 
    	description="Copy updated files to JBoss directory">

       	<copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
            <fileset dir="${opencms.input.libs.runtime}">
                <include name="**/*.jar"/>
            </fileset>
        </copy>    	
        <copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
            <fileset dir="${opencms.output.jars}">
                <include name="*.jar"/>
            </fileset>
        </copy>     
        <copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF"/>
        <copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF"/>       
    </target>     
       
    <target name="jboss.update" 
    	depends="jar, jboss.copy" description="Recompile changed classes and install in JBoss deploy directory"/>      
    
    <target name="bindist" 
    	depends="clean" description="Creates a binary distribution ZIP, including the templateone demopages">
    	
    	<!-- read list of all available modules -->
    	<property file="${opencms.input}/modules/all-modules.properties" />
    	
		<!-- remove org.opencms.workplace.demos modules -->
		<var name="modules.common.selection" unset="true" />
		<for list="${modules.common.all}" param="module" trim="yes">
			<sequential>
				<propertyregex property="pack.name" input="@{module}" regexp="org\.opencms\.workplace\.demos([^\.]*)" select="\1" casesensitive="false" />
				<if>
					<not>
						<isset property="pack.name" />
					</not>
					<then>
						<if>
						  <isset property="modules.common.selection"/>
						  <then>
							<var name="modules.common.selection" value="${modules.common.selection},@{module}" />
						  </then>
						  <else>
							<var name="modules.common.selection" value="@{module}" />
						  </else>
						</if>
					</then>
				</if>
				<var name="pack.name" unset="true" />
			</sequential>
		</for>
    	<echo>${modules.common.selection}</echo>
    	<!-- build war with selected modules -->
	  	<ant antfile="${opencms.input}/modules/build.xml" target="war" inheritAll="false" >
	  		<property name="modules.common.selection" value="${modules.common.selection}" />
	  		<property name="modules.selection.mode" value="selection" />
	  		<property name="app.name" value="${app.name}" />
	  	</ant>    	
    	
    	<!-- build distro -->
        <mkdir dir="${opencms.output.distfiles}" />                    
    	
        <zip destfile="${opencms.output.distfiles}/opencms_${version.number}.zip">
            <zipfileset dir="${opencms.output}/build" includes="${app.name}.war"/>
            <zipfileset dir="${opencms.input}" includes="install.html,license.txt,history.txt"/>
        </zip>

    </target>    
    
    <target name="srcdist" 
    	description="Creates a source distribution ZIP">
    	
    	<echo message="Building OpenCms ${app.name} source distribution " />
        <echo message=" " />
        <echo message="OpenCms input directory is: ${opencms.input}" />
        <echo message="OpenCms output directory is: ${opencms.output}" />
		
	  	<selectionprompt 
	  	  	property="src.comps"
	  	    defaultvalue="${src.all.comps}"
	  		allvalues="${src.all.comps}"
	  		prompt="Please select the additional source components to include:"
	  		title="Additional Source Components Selection" 
	  		columns="1" 
	  	/>

        <mkdir dir="${opencms.output.distfiles}" />                    
		
    	<delete file="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip" failonerror="no"/>
        <zip destfile="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip">
        	<zipfileset dir="${opencms.input}/src" excludes="${excludes}" prefix="src" />
            <zipfileset dir="${opencms.input}" includes="build.xml,install.html,license.txt,history.txt"/>
        </zip>
    	
	    <if>
	      <not>
		      <equals arg1="${src.comps}" arg2="__ABORT__" />
	      </not>
	      <then>
	    	<for list="${src.comps}" param="comp" trim="yes">
	    	  <sequential>
	            <zip destfile="${opencms.output.distfiles}/${app.name}_${version.number}_src.zip" update="true" whenempty="fail">
	            	<zipfileset dir="${opencms.input}/@{comp}" excludes="${excludes}" prefix="@{comp}" />
	            </zip>
	    	  </sequential>
	    	</for>
	      </then>
	    </if>

    </target>
		
    <target name="compile-tests" depends="setup-jar" description="Compile the OpenCms test classes">
    	
        <mkdir dir="${opencms.output.tests}" />    	
    	
       	<javac
            srcdir="${opencms.input}/test"
            destdir="${opencms.output.tests}"
            excludes="**/data/**"
            debug="on"
            optimize="on"
            deprecation="on" 
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
     	      <fileset dir="${opencms.output}/build">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       	</javac>
		
        <copy todir="${opencms.output.tests}">
            <fileset dir="${opencms.input}/test" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd" excludes="${excludes},**/data/**"/>
        </copy>
    	
        <mkdir dir="${opencms.output.tests}/../webapp/" />      	
        <copy todir="${opencms.output.tests}/../webapp/">
            <fileset dir="${opencms.input.warfiles}" />
        </copy>       	    	       
    	
        <mkdir dir="${opencms.output.tests}/../test/data/" />  
        <copy todir="${opencms.output.tests}/../test/data/">
            <fileset dir="${opencms.input}/test/data" />
        </copy>       	    	       
    </target>
	

    <target name="setup-jar" depends="jar" description="Compile the OpenCms setup/updater classes">
    	
        <mkdir dir="${opencms.output}/build/setup" />    	
    	
       	<javac
            srcdir="${opencms.input}/src-setup"
            destdir="${opencms.output}/build/setup"
            debug="on"
            optimize="on"
            deprecation="on" 
       		source="1.4"
    		target="${java.target.version}">
       	    <classpath>
     	      <fileset dir="${opencms.output}/build">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.compile}">
       	        <include name="**/*.jar"/>
       	      </fileset>
     	      <fileset dir="${opencms.input.libs.runtime}">
     	        <include name="**/*.jar"/>
     	      </fileset>
       	      <fileset dir="${opencms.input.libs.db.base}">
       	        <include name="**/*.jar"/>
       	      </fileset>
       	    </classpath>
       	</javac>
    	
        <copy todir="${opencms.output}/build/setup">
            <fileset dir="${opencms.input}/src-setup" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}"/>
        </copy>              
                
        <jar
            jarfile="${opencms.output.jars}/opencms-setup.jar"
            basedir="${opencms.output}/build/setup"
            includes="org/opencms/**" />

    </target>
	

	<target name="unittests" depends="compile-tests"
		description="Runs the core Junit test cases">
		
		<junit showoutput="yes" printsummary="yes" fork="yes" haltonfailure="no" haltonerror="no">
			<classpath>
				<pathelement path="${opencms.output.tests}"/>
        	    <fileset dir="${opencms.output}/build">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
        	    <fileset dir="${opencms.input.libs.compile}">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
	     	    <fileset dir="${opencms.input.libs.runtime}">
	     	        <include name="**/*.jar"/>
	     	    </fileset>
	       	    <fileset dir="${opencms.input.libs.db.base}">
	       	        <include name="**/*.jar"/>
	       	    </fileset>
	       	</classpath>
			
			<formatter type="plain" />
			
			<test name="org.opencms.test.AllTests" />			
		</junit>
	</target>

    <property name="signjar.storepass" value="secret" />

    <target name="uploadjar" description="Build the upload.jar">
        
        <delete dir="${opencms.output}/upload/" />
        <mkdir dir="${opencms.output}/upload/org/opencms/applet/" />
        
        <copy todir="${opencms.output}/upload/org/opencms/applet/">
            <fileset dir="${opencms.input}/src-components/org/opencms/applet">
                <include name="**/*.png"/>
                <include name="**/*.gif"/>
            </fileset>
        </copy>  

    	<unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-logging-1.1.jar" />
        <unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-httpclient-3.0.1.jar" />
        <unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-codec-1.3.jar" />

        <delete>
            <fileset dir="${opencms.output}/upload/">
                <include name="**/*.html" />
            </fileset>
        </delete>
        
        <javac
            srcdir="${opencms.input}/src-components/org/opencms/applet"
            destdir="${opencms.output}/upload"
            debug="on"
            optimize="on"
            deprecation="on"
            source="1.4"
            target="${java.target.version}">
        </javac>
 
        <jar
            jarfile="${opencms.output}/upload/upload_unsigned.jar"
            basedir="${opencms.output}/upload/"
            includes="org/**" >  
        </jar>
       
        <genkey 
            keystore="${opencms.output}/upload/keystore" 
            validity="3650" 
            alias="OpenCms" 
            storepass="${signjar.storepass}">
            <dname>
                <param name="CN" value="OpenCms Upload Applet" />
                <param name="OU" value="opencms.org" />
                <param name="O"  value="Alkacon Software GmbH" />
                <param name="L"  value="<NAME>sfabrik 13" />
                <param name="S"  value="Cologne" />
                <param name="C"  value="DE" />
            </dname>
        </genkey>       

        <signjar 
            signedjar="${opencms.output}/upload/upload.jar" 
            alias="OpenCms" 
            jar="${opencms.output}/upload/upload_unsigned.jar" 
            storepass="${signjar.storepass}"
            keystore="${opencms.output}/upload/keystore" />
        
        <delete file="${opencms.output}/upload/upload_unsigned.jar" />

        <copy 
            todir="${opencms.input}/modules/org.opencms.workplace.explorer/resources/system/workplace/resources/components/upload_applet/"
            file="${opencms.output}/upload/upload.jar" />
    </target>    

</project>
{'fraction_non_alphanumeric': 0.18632030422476514, 'fraction_numerical': 0.004601573217107434, 'mean_word_length': 2.3946360153256707, 'pattern_counts': {'":': 0, '<': 950, '<?xml version=': 2, '>': 950, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 56}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6141629', 'n_tokens_mistral': 20370, 'n_tokens_neox': 18896, 'n_words': 2487}