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

<!--
     Copyright (c) 2005, 2015 IBM Corporation and others.

     This program and the accompanying materials
     are made available under the terms of the Eclipse Public License 2.0
     which accompanies this distribution, and is available at
     https://www.eclipse.org/legal/epl-2.0/

     SPDX-License-Identifier: EPL-2.0
    
     Contributors:
         IBM Corporation - initial API and implementation
 -->

<!-- ===================================================================== -->
<!-- Ant build script for JSPs                                             -->
<!-- ===================================================================== -->
<project name="JSP Build">

	<!-- ===================================================================== -->
	<!-- Workspace (dev) build; called as an Ant builder                       -->
	<!-- ===================================================================== -->
	<target name="build">

		<!-- Construct the full classpath -->
		<path id="@dot.classpath" >
			<pathelement path="${target.folder}"/>
			<dirset dir="${workspace_loc}">
				<patternset>
					<include name="org.eclipse.help/bin"/>
					<include name="org.eclipse.help.base/bin"/>
				</patternset>
			</dirset>
			<fileset dir="${target_home}/plugins">
				<patternset>
					<include name="jakarta.servlet*.jar"/>
					<include name="javax.servlet.jsp*.jar"/>
					<include name="javax.el*.jar"/>
					<include name="com.sun.el*.jar"/>
					<include name="org.apache.ant*/lib/ant.jar"/>
					<include name="org.apache.commons.logging*.jar"/>
					<include name="org.apache.jasper.glassfish*.jar"/>
					<include name="org.eclipse.core.runtime*.jar"/>
					<include name="org.eclipse.osgi*.jar"/>
					<include name="org.eclipse.help*.jar"/>
					<include name="org.eclipse.help.base*.jar"/>
				</patternset>
			</fileset>
		</path>

		<!-- Compile the JSPs -->
		<antcall target="compile">
			<reference refid="@dot.classpath"/>
		</antcall>
		
	</target>

	<!-- ===================================================================== -->
	<!-- Compile the JSPs                                                      -->
	<!-- ===================================================================== -->
	<target name="compile">
		
		<!-- Invoke Jasper compiler -->
		<java
			classname="org.apache.jasper.JspC"
			classpathref="@dot.classpath"
			fork="true"
			failonerror="true">
			<jvmarg value="-Dorg.apache.jasper.compiler.disablejsr199=true"/>
			<arg value="-compile"/>
			<arg value="-d"/>
			<arg value="${target.folder}" />
			<arg value="-p"/>
			<arg value="org.eclipse.help.internal.webapp.jsp"/>
			<arg value="-webapp"/>
			<arg value="${basedir}"/>
			<arg value="-die"/>
		</java>
		
	</target>
	
	<!-- ===================================================================== -->
	<!-- Steps to do before the target build.jars                              -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder to contain the build results           -->
	<!-- ===================================================================== -->
	<target name="pre.build.jars">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the target build.jars                               -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder to contain the build results           -->
	<!-- ===================================================================== -->
	<target name="post.build.jars">
	</target>
	
	<!-- ===================================================================== -->
	<!-- Steps to do before the target build.sources                           -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder to contain the build results           -->
	<!-- ===================================================================== -->
	<target name="pre.build.sources">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the target build.sources                            -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder to contain the build results           -->
	<!-- ===================================================================== -->
	<target name="post.build.sources">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before the compilation target <name>                      -->
	<!-- Substitute "name" with the name of the compilation target, eg @dot    -->
	<!-- Available parameters :                                                -->
	<!--   source.foldern : n = 1 ... N, the source folders                    -->
	<!--   target.folder  : where the results of the compilation go            -->
	<!--   <name>.classpath : name = name of the compilation target. A         -->
	<!--                      reference to the classpath structure.            -->
	<!-- ===================================================================== -->
	<target name="pre.@dot">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do during the compilation target <name>, after the compile   -->
	<!-- but before jaring.  Substitute "name" with the name of the compilation-->
	<!-- target, eg @dot                                                       -->
	<!-- Available parameters :                                                -->
	<!--   source.foldern : n = 1 ... N, the source folders                    -->
	<!--   target.folder  : where the results of the compilation go            -->
	<!--   <name>.classpath : name = name of the compilation target. A         -->
	<!--                      reference to the classpath structure.            -->
	<!-- ===================================================================== -->
	<target name="post.compile.@dot">
		
		<!-- Compile the JSPs -->
		<antcall target="compile">
			<reference refid="@dot.classpath"/>
		</antcall>
		
		<!-- JspC always generates .java files; delete them -->
		<delete>
			<fileset dir="${target.folder}" includes="**/*.java"/>
		</delete>

	</target>
	
	<!-- ===================================================================== -->
	<!-- Steps to do after the compilation target <name>                       -->
	<!-- Substitute "name" with the name of the compilation target, eg @dot    -->
	<!-- Available parameters :                                                -->
	<!--   jar.location - the location of the compilation results              -->
	<!--   <name>.classpath : name = name of the compilation target. A         -->
	<!--                      reference to the classpath structure.            -->
	<!-- ===================================================================== -->
	<target name="post.@dot">
	</target>
	
	<!-- ===================================================================== -->
	<!-- Steps to do before the target gather.bin.parts                         -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder containing the build results           -->
	<!--   target.folder - destination folder                                  -->
	<!-- ===================================================================== -->
	<target name="pre.gather.bin.parts">
	</target>
		
	<!-- ===================================================================== -->
	<!-- Steps to do after the target gather.bin.parts                         -->
	<!-- Available parameters :                                                -->
	<!--   build.result.folder - folder containing the build results           -->
	<!--   target.folder - destination folder                                  -->
	<!-- ===================================================================== -->
	<target name="post.gather.bin.parts">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before the target gather.sources                          -->
	<!-- Available parameters :                                                -->
	<!--   destination.temp.folder - destination folder                        -->
	<!-- ===================================================================== -->
	<target name="pre.gather.sources">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the target gather.sources                           -->
	<!-- Available parameters :                                                -->
	<!--   destination.temp.folder - destination folder                        -->
	<!-- ===================================================================== -->
	<target name="post.gather.sources">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before the target gather.logs                             -->
	<!-- Available parameters :                                                -->
	<!--   destination.temp.folder - destination folder                        -->
	<!-- ===================================================================== -->
	<target name="pre.gather.logs">        
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the target gather.logs                              -->
	<!-- Available parameters :                                                -->
	<!--   destination.temp.folder - destination folder                        -->
	<!-- ===================================================================== -->
	<target name="post.gather.logs">       
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before the target clean                                   -->
	<!-- Available parameters :                                                -->
	<!--   destination.temp.folder - destination folder                        -->
	<!-- ===================================================================== -->
	<target name="pre.clean">              
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the target clean                                    -->
	<!-- Available parameters :                                                -->
	<!--   plugin.destination - final destination of the build                 -->
	<!--   build.result.folder - results of the compilation                    -->
	<!--   temp.folder - temporary folder                                      -->
	<!-- ===================================================================== -->
	<target name="post.clean">             
	</target>

</project>
