You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by fe...@apache.org on 2004/03/02 04:43:35 UTC
cvs commit: jakarta-taglibs/standard build.xml
felipeal 2004/03/01 19:43:35
Modified: standard Tag: STANDARD_1_0_BRANCH build.xml
Log:
added targets that check for properties - useful if your're compiling it agains JDK 1.4
Revision Changes Path
No revision
No revision
1.23.2.4 +112 -146 jakarta-taglibs/standard/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/build.xml,v
retrieving revision 1.23.2.3
retrieving revision 1.23.2.4
diff -u -r1.23.2.3 -r1.23.2.4
--- build.xml 28 Feb 2004 06:32:39 -0000 1.23.2.3
+++ build.xml 2 Mar 2004 03:43:35 -0000 1.23.2.4
@@ -48,25 +48,18 @@
<!-- ********************** Destination Preparation ********************* -->
<target name="prepare">
- <available file="${jaxp-api.jar}" property="isJaxp12" value="true"/>
<!-- Make sure required dependencies are available -->
- <antcall target="checkRequiredFile">
+
+ <antcall target="requiredJar">
+ <param name="prop" value="servlet23.jar"/>
<param name="file" value="${servlet23.jar}"/>
- <param name="fail.message" value="A jar file containing the Servlet 2.3 and JSP1.2 classes is required to compile the Standard Taglib. ${servlet23.jar} Please define the property servlet23.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- <antcall target="checkRequiredFile">
- <param name="file" value="${jdbc2_0-stdext.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires the Sun JDBC 2.0 Optional Package (Standard Extensions). Please define the property jdbc2_0-stdext.jar in your build.properties file and ensure that the file exists."/>
+ <param name="desc" value="Servlet 2.3 API classes"/>
</antcall>
- <!-- JAXP 1.1 and 1.2 -->
- <antcall target="checkJaxp11"/>
- <antcall target="checkJaxp12"/>
- <antcall target="checkRequiredFile">
- <param name="file" value="${xalan.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires xalan.jar. Please define the property xalan.jar in your build.properties file and ensure that the file exists."/>
+ <antcall target="processJars">
+ <param name="task" value="requiredJarIfPropSet"/>
</antcall>
-
+
<!-- Set up build directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.doc}"/>
@@ -83,48 +76,10 @@
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/${taglib.name}"/>
</target>
-
- <!-- **************** JAXP 1.1, 1.2 checks ******************** -->
-
- <target name="checkJaxp11" unless="isJaxp12">
- <antcall target="checkRequiredFile">
- <param name="file" value="${crimson.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires a JAXP 1.1-compliant XML parser, such as crimson.jar. Please define the property crimson.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- </target>
-
- <target name="checkJaxp12" if="isJaxp12">
- <antcall target="checkRequiredFile">
- <param name="file" value="${jaxp-api.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires jaxp-api.jar from JAXP 1.2. Please define the property jaxp-api.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- <antcall target="checkRequiredFile">
- <param name="file" value="${dom.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires dom.jar from JAXP 1.2. Please define the property dom.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- <antcall target="checkRequiredFile">
- <param name="file" value="${sax.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires sax.jar from JAXP 1.2. Please define the property sax.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- <antcall target="checkRequiredFile">
- <param name="file" value="${xercesImpl.jar}"/>
- <param name="fail.message" value="This build process for the Standard Taglib requires a xercesImpl.jar from JAXP 1.2. Please define the property xercesImpl.jar in your build.properties file and ensure that the file exists."/>
- </antcall>
- </target>
+
<!-- **************** JAXP 1.1, 1.2 copying ******************** -->
- <target name="copyJaxp11" unless="isJaxp12">
- <copy file="${crimson.jar}" tofile="${build.examples}/WEB-INF/lib/crimson.jar" />
- </target>
-
- <target name="copyJaxp12" if="isJaxp12">
- <copy file="${jaxp-api.jar}" tofile="${build.examples}/WEB-INF/lib/jaxp-api.jar" />
- <copy file="${dom.jar}" tofile="${build.examples}/WEB-INF/lib/dom.jar" />
- <copy file="${sax.jar}" tofile="${build.examples}/WEB-INF/lib/sax.jar" />
- <copy file="${xercesImpl.jar}" tofile="${build.examples}/WEB-INF/lib/xercesImpl.jar" />
- </target>
-
<target name="copyJaxp11Dist" unless="isJaxp12">
<copy file="${crimson.jar}" todir="${dist.dir}/${taglib.name}/lib"/>
</target>
@@ -141,72 +96,15 @@
<target name="compileJaxp11" unless="isJaxp12">
<javac srcdir="${library.src}" destdir="${build.library}"
classpath="${servlet23.jar}:${jdbc2_0-stdext.jar}:${crimson.jar}:${xalan.jar}:${jaxen-full.jar}:${saxpath.jar}"
- excludes="org/apache/taglibs/standard/lang/jstl/parser/jsp20/*"
debug="on"/>
</target>
<target name="compileJaxp12" if="isJaxp12">
<javac srcdir="${library.src}" destdir="${build.library}"
classpath="${servlet23.jar}:${jdbc2_0-stdext.jar}:${jaxp-api.jar}:${dom.jar}:${sax.jar}:${xercesImpl.jar}:${xalan.jar}:${jaxen-full.jar}:${saxpath.jar}"
- excludes="org/apache/taglibs/standard/lang/jstl/parser/jsp20/*"
debug="on"/>
</target>
- <!-- **************** Special JSP 2.0 EL target ******************** -->
-
- <target name="jsp20el.build">
- <echo message="Building JSP 2.0 expression language."/>
- <property name="jsp20el.build.dir" value="${build.dir}/${taglib.name}/jsp20el"/>
- <property name="jsp20el.scratch.dir" value="${build.dir}/${taglib.name}/jsp20el/scratch"/>
- <property name="jsp20el.package.dir" value="org/apache/jasper/runtime/el"/>
-
- <mkdir dir="${jsp20el.build.dir}"/>
- <mkdir dir="${jsp20el.scratch.dir}"/>
-
- <copy todir="${jsp20el.scratch.dir}/${jsp20el.package.dir}">
- <fileset dir="${library.src}/org/apache/taglibs/standard/lang">
- <include name="jstl/*"/>
- <include name="jstl/parser/*"/>
- <include name="jstl/parser/jsp20/*"/>
- <include name="support/*"/>
- </fileset>
- </copy>
- <!-- rename packages and imports for JSP 2.0 -->
- <replace dir="${jsp20el.scratch.dir}/${jsp20el.package.dir}">
- <include name="**/*"/>
- <replacetoken>org.apache.taglibs.standard.lang</replacetoken>
- <replacevalue>org.apache.jasper.runtime.el</replacevalue>
- </replace>
-
- <javac srcdir="${jsp20el.scratch.dir}"
- destdir="${jsp20el.build.dir}"
- classpath="${servlet23.jar}:${build.library}"
- debug="on">
- <include name="${jsp20el.package.dir}/jstl/*"/>
- <include name="${jsp20el.package.dir}/jstl/parser/*"/>
- <exclude name="${jsp20el.package.dir}/jstl/parser/ELParser.java"/>
- <include name="${jsp20el.package.dir}/jstl/parser/jsp20/*"/>
- <include name="${jsp20el.package.dir}/support/**"/>
- </javac>
- <copy todir="${jsp20el.build.dir}/${jsp20el.package.dir}/jstl">
- <fileset dir="${jsp20el.scratch.dir}/${jsp20el.package.dir}/jstl">
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- <delete dir="${jsp20el.scratch.dir}"/>
- </target>
-
- <target name="jsp20el.dist" depends="jsp20el.build">
- <mkdir dir="${dist.dir}/jsp20el"/>
- <jar jarfile="${dist.dir}/jsp20el/jsp20el.jar"
- basedir="${build.dir}/${taglib.name}/jsp20el"/>
- </target>
-
- <target name="jsp20el.clean">
- <delete dir="${build.dir}/${taglib.name}/jsp20el"/>
- <delete dir="${dist.dir}/jsp20el"/>
- </target>
-
<!-- **************** Compile Tag Library Components ******************** -->
<!-- Compile the documentation application -->
@@ -235,15 +133,11 @@
<copy todir="${build.examples}">
<fileset dir="${examples.src}/web"/>
</copy>
- <!-- Copy implementation-detail jar files -->
- <copy todir="${build.examples}/WEB-INF/lib">
- <fileset dir="lib" includes="*.jar"/>
- </copy>
- <copy file="${jdbc2_0-stdext.jar}" tofile="${build.examples}/WEB-INF/lib/jdbc2_0-stdext.jar" />
- <copy file="${xalan.jar}" tofile="${build.examples}/WEB-INF/lib/xalan.jar" />
-
- <antcall target="copyJaxp11"/>
- <antcall target="copyJaxp12"/>
+
+ <antcall target="processJars">
+ <param name="task" value="copyIfPropSet"/>
+ <param name="todir" value="${build.examples}/WEB-INF/lib"/>
+ </antcall>
<!-- Copy required external API jar files -->
<!-- Copy the 'standard' TLD files -->
@@ -332,13 +226,11 @@
<copy file="../LICENSE" tofile="${dist.dir}/${taglib.name}/LICENSE"/>
<copy file="../NOTICE" tofile="${dist.dir}/${taglib.name}/NOTICE"/>
<copy file="README.dist" tofile="${dist.dir}/${taglib.name}/README"/>
- <copy file="${jaxen-full.jar}" todir="${dist.dir}/${taglib.name}/lib"/>
- <copy file="${saxpath.jar}" todir="${dist.dir}/${taglib.name}/lib"/>
- <copy file="${jdbc2_0-stdext.jar}" todir="${dist.dir}/${taglib.name}/lib"/>
- <copy file="${xalan.jar}" todir="${dist.dir}/${taglib.name}/lib"/>
- <antcall target="copyJaxp11Dist"/>
- <antcall target="copyJaxp12Dist"/>
+ <antcall target="processJars">
+ <param name="todir" value="${dist.dir}/${taglib.name}/lib"/>
+ <param name="task" value="copyIfPropSet"/>
+ </antcall>
<copy file="${conf.src}/c.tld" todir="${dist.dir}/${taglib.name}/tld"/>
<copy file="${conf.src}/c-rt.tld" todir="${dist.dir}/${taglib.name}/tld"/>
@@ -350,6 +242,54 @@
<copy file="${conf.src}/sql-rt.tld" todir="${dist.dir}/${taglib.name}/tld"/>
</target>
+ <target name="processJars">
+ <!-- All jar files required at runtime are copied in the 'lib' dir -->
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="jdbc2_0-stdext.jar"/>
+ <param name="file" value="${jdbc2_0-stdext.jar}"/>
+ <param name="desc" value="Sun JDBC 2.0 API classes"/>
+ </antcall>
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="jaxp-api.jar"/>
+ <param name="file" value="${jaxp-api.jar}"/>
+ <param name="desc" value="JAXP 1.2 API classes"/>
+ </antcall>
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="dom.jar"/>
+ <param name="file" value="${dom.jar}"/>
+ <param name="desc" value="JAXP 1.2 DOM API classes"/>
+ </antcall>
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="sax.jar"/>
+ <param name="file" value="${sax.jar}"/>
+ <param name="desc" value="JAXP 1.2 SAX API classes"/>
+ </antcall>
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="xalan.jar"/>
+ <param name="file" value="${xalan.jar}"/>
+ <param name="desc" value="Xalan implementation"/>
+ </antcall>
+
+ <antcall target="processIfPropSet">
+ <param name="prop" value="xercesImpl.jar"/>
+ <param name="file" value="${xercesImpl.jar}"/>
+ <param name="desc" value="Xerces implementation"/>
+ </antcall>
+
+ <antcall target="copyOldJars"/>
+
+ </target>
+
+ <target name="copyOldJars" if="todir">
+ <copy file="${jaxen-full.jar}" todir="${todir}"/>
+ <copy file="${saxpath.jar}" todir="${todir}"/>
+ </target>
+
<!-- javadoc -->
<target name="javadoc-dist">
<mkdir dir="${dist.library}/javadoc"/>
@@ -361,7 +301,7 @@
</target>
<!-- Create the entire set of distribution files -->
- <target name="dist" depends="library-dist,examples-dist,documentation-dist,javadoc-dist,jsp20el.dist"/>
+ <target name="dist" depends="library-dist,examples-dist,documentation-dist,javadoc-dist"/>
@@ -373,27 +313,53 @@
<delete dir="${dist.dir}/${taglib.name}"/>
</target>
- <!-- =================================================================== -->
- <!-- Scripts used with antcall for checking for required classes or jars -->
- <!-- Must provide "class" or "file" and "fail.message" parameters -->
- <!-- =================================================================== -->
- <target name="checkRequiredClass">
- <available classname="${class}" property="requirement.satisfied"/>
- <antcall target="checkRequired.fail"/>
- </target>
- <target name="checkRequiredFile">
- <available file="${file}" property="requirement.satisfied"/>
- <antcall target="checkRequired.fail"/>
- </target>
- <target name="checkOptionalFile">
+ <!-- Check the availability of a required jar -->
+ <target name="requiredJar">
+ <echo message=" ${prop}"/>
<available file="${file}" property="requirement.satisfied"/>
- <antcall target="checkRequired.warn"/>
- </target>
- <target name="checkRequired.fail" unless="requirement.satisfied">
- <fail message="${fail.message}"/>
- </target>
- <target name="checkRequired.warn" unless="requirement.satisfied">
- <echo message="WARNING: ${warn.message}"/>
+ <antcall target="requiredJarFailed"/>
</target>
+ <!-- Support for target 'requiredJar' -->
+ <target name="requiredJarFailed" unless="requirement.satisfied">
+ <echo message="The property ${prop} must be set to a jar file containing"/>
+ <echo message="the '${desc}'."/>
+ <fail message="Current value for ${prop} is: ${file}."/>
+ </target>
+
+ <!-- Process a target only if a property is set.
+ Allows us to ignore some dependencies that are included in
+ J2SE 1.4 but were not prior to that. -->
+ <target name="processIfPropSet">
+ <echo message=" ${prop}"/>
+ <condition property="prop.specified">
+ <isSet property="${prop}"/>
+ </condition>
+ <antcall target="${task}"/>
+ <antcall target="${task}Not"/>
+ </target>
+
+ <!-- Check the availability of a required jar only if property is set -->
+ <target name="requiredJarIfPropSet" if="prop.specified">
+ <antcall target="requiredJar"/>
+ </target>
+
+ <!-- Warning message when required jar is ignored because the property
+ is not set. -->
+ <target name="requiredJarIfPropSetNot" unless="prop.specified">
+ <echo message=" Ignoring dependency on ${prop} because property is not set."/>
+ <echo message=" OK as long as both compile and run-time environments are at least J2SE 1.4."/>
+ </target>
+
+ <!-- Copy file only if property is set -->
+ <target name="copyIfPropSet" if="prop.specified">
+ <copy file="${file}" todir="${todir}"/>
+ </target>
+
+ <!-- Warning message when file is not copied because the property
+ is not set. -->
+ <target name="copyIfPropSetNot" unless="prop.specified">
+ <echo message=" Ignoring copy of ${prop} because property is not set."/>
+ </target>
+
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org