<!--
 ! Licensed to the Apache Software Foundation (ASF) under one
 ! or more contributor license agreements.  See the NOTICE file
 ! distributed with this work for additional information
 ! regarding copyright ownership. The ASF licenses this file
 ! to you under the Apache License, Version 2.0 (the
 ! "License"); you may not use this file except in compliance
 ! with the License. You may obtain a copy of the License at
 ! 
 !      http://www.apache.org/licenses/LICENSE-2.0
 ! 
 ! Unless required by applicable law or agreed to in writing, software
 ! distributed under the License is distributed on an "AS IS" BASIS,
 ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ! See the License for the specific language governing permissions and
 ! limitations under the License.
 !-->

<project name="hello" basedir="." default="all">

	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## ENVIRONMENT SETTINGS						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<property name="top" location="../../../../../.."/>
      
	<property name="pkg-path" value="com/sun/jini/example/${ant.project.name}"/>
      
	<!-- ##									-->
	<!-- ## Set java-source for use with the javac task:			-->
	<!-- ##									-->
      
	<property name="java-source" value="${pkg-path}/**/*.java"/>
	
	<import file="${top}/build_common.xml"/>
      
	<property name="hello.lib"    location="${basedir}/lib"/>
	<property name="hello.config" location="${basedir}/config"/>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: all							-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="all"
		description=""
		depends="compile,
			 this.stubs">
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: clean							-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="clean"
		description="Removes all files and dirs created by the build."
		depends="clean.jre.ext">
      
		<delete dir="${build.classes}/${pkg-path}" quiet="true"/>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: hello.lib						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="hello.lib"
		depends="">
      
		<mkdir dir="${basedir}/lib"/>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: this.jars						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="this.jars"
		depends="client.jar,
			 mdprefld.jar,
			 server.jar,
			 server-act.jar,
			 server-dl.jar">
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: client.jar						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="client.jar"
		depends="tools,
			 hello.lib">
      
		<property name="example-client.deps" location="${build.deps}/example-client.deps"/>
		
		<!-- ##								-->
		<!-- ## Run ClassDep.						-->
		<!-- ##								-->
	    
		<java classname="com.sun.jini.tool.ClassDep"
		      failonerror="true"
		      output="${example-client.deps}">
		      
			<classpath refid="path.classdep"/>
			<arg value="-cp"/>
			<arg path="${build.classes}"/>
			<arg value="-files"/>
			<arg line="${jskplatform.exclude}"/>
		  
			<arg line="-in net.jini"/>
			<arg line="-in com.sun.jini"/>
		  
			<arg value="com.sun.jini.example.hello.Client"/>
	    
		</java>
	    
		<!-- ##								-->
		<!-- ## Generate the jar file.					-->
		<!-- ##								-->
	    
		<delete file="${hello.lib}/client.jar" quiet="true"/>
	    
		<jar destfile="${hello.lib}/client.jar" 
		     index="false"
		     manifest="${basedir}/client.mf">
		     
			<fileset dir="${build.classes}" includesfile="${example-client.deps}"/>
	    
		</jar>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: mdprefld.jar						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="mdprefld.jar"
		depends="tools,
			 hello.lib">
      
		<!-- ##								-->
		<!-- ## Generate the jar file.					-->
		<!-- ##								-->
	    
		<delete file="${hello.lib}/mdprefld.jar" quiet="true"/>
	    
		<jar destfile="${hello.lib}/mdprefld.jar" 
		     index="false">
		     
			<fileset dir="${build.classes}"
				 includes="com/sun/jini/example/hello/MdClassAnnotationProvider.class"/>
		</jar>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: server.jar						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="server.jar"
		depends="tools,
			 hello.lib">
      
		<property name="example-server.deps" location="${build.deps}/example-server.deps"/>
		
		<!-- ##								-->
		<!-- ## Run ClassDep.						-->
		<!-- ##								-->
	    
		<java classname="com.sun.jini.tool.ClassDep"
		      failonerror="true"
		      output="${example-server.deps}">
		      
			<classpath refid="path.classdep"/>
			<arg value="-cp"/>
			<arg path="${build.classes}"/>
			<arg value="-files"/>
			<arg line="${jskplatform.exclude}"/>
		  
			<arg line="-in net.jini"/>
			<arg line="-in com.sun.jini"/>
		  
			<arg value="com.sun.jini.example.hello.Server"/>
			<arg value="com.sun.jini.example.hello.Server_Stub"/>
			<arg value="com.sun.jini.example.hello.ConfirmingILFactory"/>
			<arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
			<arg value="com.sun.jini.example.hello.ServerPermission"/>
	    
		</java>
	    
		<!-- ##								-->
		<!-- ## Generate the jar file.					-->
		<!-- ##								-->
	    
		<delete file="${hello.lib}/server.jar" quiet="true"/>
	    
		<jar destfile="${hello.lib}/server.jar" 
		     index="false"
		     manifest="${basedir}/server.mf">
		     
		  <fileset dir="${build.classes}"  includesfile="${example-server.deps}"/>
	    
		</jar>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: server-act.jar						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="server-act.jar"
		depends="tools,
			 hello.lib">
      
		<property name="example-server-act.deps" location="${build.deps}/example-server-act.deps"/>
		
		<!-- ##								-->
		<!-- ## Run ClassDep.						-->
		<!-- ##								-->
	    
		<java classname="com.sun.jini.tool.ClassDep"
		      failonerror="true"
		      output="${example-server-act.deps}">
		      
			<classpath refid="path.classdep"/>
			<arg value="-cp"/>
			<arg path="${build.classes}"/>
			<arg value="-files"/>
		  
			<arg line="${jskplatform.exclude}"/>
		  
			<arg line="-in net.jini"/>
			<arg line="-in com.sun.jini"/>
		  
			<arg value="com.sun.jini.example.hello.ActivatableServer"/>
			<arg value="com.sun.jini.example.hello.ConfirmingILFactory"/>
			<arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
			<arg value="com.sun.jini.example.hello.Server"/>
			<arg value="com.sun.jini.example.hello.Server_Stub"/>
			<arg value="com.sun.jini.example.hello.ServerPermission"/>
	    
		</java>
	    
		<!-- ##								-->
		<!-- ## Generate the jar file.					-->
		<!-- ##								-->
	    
		<delete file="${hello.lib}/server-act.jar" quiet="true"/>
	    
		<jar destfile="${hello.lib}/server-act.jar" 
		     index="false"
		     manifest="${basedir}/server-act.mf">
		     
			<fileset dir="${build.classes}" includesfile="${example-server-act.deps}"/>
	    
		</jar>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: server-dl.jar						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="server-dl.jar"
		depends="tools,
			 hello.lib">
      
		<property name="example-server-dl.deps" location="${build.deps}/example-server-dl.deps"/>
		
		<!-- ##								-->
		<!-- ## Run ClassDep.						-->
		<!-- ##								-->
	    
		<java classname="com.sun.jini.tool.ClassDep"
		      failonerror="true"
		      output="${example-server-dl.deps}">
		  
			<classpath refid="path.classdep"/>
			<arg value="-cp"/>
			<arg path="${build.classes}"/>
			<arg value="-files"/>
		  
			<arg line="${jskplatform.exclude}"/>
		  
			<arg line="-in net.jini"/>
			<arg line="-in com.sun.jini"/>
		  
			<arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
			<arg value="com.sun.jini.example.hello.Hello"/>
			<arg value="com.sun.jini.example.hello.Proxy"/>
			<arg value="com.sun.jini.example.hello.Server_Stub"/>
			<arg value="com.sun.jini.example.hello.ServerPermission"/>
	    
		</java>
	    
		<!-- ##								-->
		<!-- ## Generate the jar file.					-->
		<!-- ##								-->
	    
		<delete file="${hello.lib}/server-dl.jar" quiet="true"/>
	    
		<jar destfile="${hello.lib}/server-dl.jar"
		     index="false">
		     
		  <fileset dir="${build.classes}"  includesfile="${example-server-dl.deps}"/>
		  
		  <metainf dir="${hello.config}/META-INF"/>
	    
		</jar>
      
	</target>
      
      
	<!-- ################################################################	-->
	<!-- ##									-->
	<!-- ## TARGET: this.stubs						-->
	<!-- ##									-->
	<!-- ################################################################	-->
      
	<target name="this.stubs"
		description="Builds the RMI stubs for ${ant.project.name}."
		depends="compile">
      
		<rmic base="${build.classes}" stubversion="1.2">
	    
			<classpath refid="path.jini"/>
	    
			<include name="com/sun/jini/example/hello/Server.class"/>
	    
		</rmic>
      
	</target>

</project>

