commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r493673 - in /jakarta/commons/proper/validator/trunk: build-javascript.xml build.xml maven.xml
Date Sun, 07 Jan 2007 07:24:57 GMT
Author: niallp
Date: Sat Jan  6 23:24:56 2007
New Revision: 493673

URL: http://svn.apache.org/viewvc?view=rev&rev=493673
Log:
Move creating the compressed JavaScript to a separate and common ant build file

Added:
    jakarta/commons/proper/validator/trunk/build-javascript.xml   (with props)
Modified:
    jakarta/commons/proper/validator/trunk/build.xml
    jakarta/commons/proper/validator/trunk/maven.xml

Added: jakarta/commons/proper/validator/trunk/build-javascript.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/build-javascript.xml?view=auto&rev=493673
==============================================================================
--- jakarta/commons/proper/validator/trunk/build-javascript.xml (added)
+++ jakarta/commons/proper/validator/trunk/build-javascript.xml Sat Jan  6 23:24:56 2007
@@ -0,0 +1,142 @@
+<!--
+    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="Compress JavaScript" default="compress" basedir=".">
+
+<!-- ============================================================================ -->
+<!--
+    This ant file creates compressed versions of Validator's JavaScript
+    files using the Dojo compressor.
+
+    See http://dojotoolkit.org/docs/compressor_system.html for further information.
+
+    $Revision$  $Date$
+ -->
+<!-- ============================================================================ -->
+
+    <property file="build-javascript.properties"/>
+
+    <property name="build.dir"           value="target"/>
+    <property name="dist.dir"            value="${build.dir}"/>
+    <property name="output.dir"          value="${build.dir}/classes"/>
+    <property name="source.dir"          value="src/javascript"/>
+    <property name="javascript.input"    value="${source.dir}/org/apache/commons/validator/javascript"/>
+    <property name="javascript.output"   value="${output.dir}/org/apache/commons/validator/javascript"/>
+    <property name="compressor.lib"      value="${build.dir}/compressor"/>
+    <property name="download.jar"        value="custom_rhino.jar"/>
+    <property name="final.name"          value="commons-validator"/>
+    
+    <!-- ======================================================================== -->
+    <!--                 Get the JavaScript Compressor                            -->
+    <!-- ======================================================================== -->
+    <target name="compress">
+        <available file="${compressor.jar}" property="compressor.found"/>
+        <antcall target="compressor-specified" />
+        <antcall target="download-compressor-check" />
+    </target>
+
+    <target name="compressor-specified" if="compressor.found">
+        <antcall target="compress-files" />
+    </target>
+
+    <!-- Download the Compressor jar (unless its already been done) -->
+    <target name="download-compressor-check" unless="compressor.found">
+        <mkdir dir="${compressor.lib}" />
+        <property name="compressor.jar"  value="${compressor.lib}/${download.jar}"/>
+        <available file="${compressor.jar}" property="download.done"/> 
+        <antcall target="download-compressor" />
+        <antcall target="compress-files" />
+    </target>
+
+    <!-- Download the Compressor jar -->
+    <target name="download-compressor" unless="download.done">
+        <echo message="Downloading JavaScript Compressor...."/>
+        <get dest="${compressor.jar}"
+            usetimestamp="true" ignoreerrors="true"
+            src="http://dojotoolkit.org/svn/dojo/trunk/buildscripts/lib/${download.jar}"/>
+    </target>
+
+    <!-- ======================================================================== -->
+    <!--                        Compress Files                                    -->
+    <!-- ======================================================================== -->
+    <target name="compress-files">
+        <echo message="Compressing JavaScript files using ${compressor.jar}"/>
+        <mkdir dir="${dist.dir}" />
+        <mkdir dir="${javascript.output}" />
+
+        <concat destfile="${dist.dir}/${final.name}.js">
+            <fileset dir="${javascript.input}" includes="*.js"/>
+        </concat>
+        <echo message="Compressing ${final.name}.js"/>
+        <java jar="${compressor.jar}" fork="true" output="${dist.dir}/${final.name}-compress.js">
+            <arg value="-c"/> 
+            <arg value="${dist.dir}/${final.name}.js"/>
+        </java>
+
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateByte"/>
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateCreditCard"/>
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateDate"/>
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateEmail"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateFloat"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateFloatRange"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateInteger"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateIntRange"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateMask"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateMaxLength"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateMinLength"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateRequired"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateShort"/> 
+        </antcall>
+        <antcall target="compress-file">
+            <param name="jsfilename" value="validateUtilities"/> 
+        </antcall>
+    </target>
+
+    <target name="compress-file">
+        <echo message="Compressing ${jsfilename}.js"/>
+        <java jar="${compressor.jar}" fork="true" output="${javascript.output}/${jsfilename}-compress.js">
+            <arg value="-c"/> 
+            <arg value="${javascript.input}/${jsfilename}.js"/>
+        </java>
+    </target>
+
+</project>
+

Propchange: jakarta/commons/proper/validator/trunk/build-javascript.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/validator/trunk/build-javascript.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/validator/trunk/build.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/build.xml?view=diff&rev=493673&r1=493672&r2=493673
==============================================================================
--- jakarta/commons/proper/validator/trunk/build.xml (original)
+++ jakarta/commons/proper/validator/trunk/build.xml Sat Jan  6 23:24:56 2007
@@ -191,7 +191,6 @@
     <filter  token="compilesource"         value="${compile.source}"/>
     <filter  token="compiletarget"         value="${compile.target}"/>
     <available property="jsdoc.found" type="file" file="${jsdoc.home}/jsdoc.pl"/>
-    <available file="${dojo_custom_rhino.jar}" property="dojo.found"/>
   </target>
 
 
@@ -322,13 +321,12 @@
    description="Create binary distribution">
     <mkdir      dir="${dist.home}"/>
 
-    <!-- Create Single file of static JavaScript -->
-    <concat destfile="${dist.home}/commons-${component.name}-${component.version}.js">
-      <fileset dir="${javascript.home}/org/apache/commons/validator/javascript" includes="*.js"/>
-    </concat>
-
-    <!-- Create compressed javascript versions -->
-    <antcall target="compress.javascript"/> 
+    <ant antfile="build-javascript.xml" target="compress">
+        <property name="source.dir" value="${javascript.home}"/>
+        <property name="dist.dir"   value="${dist.home}"/>
+        <property name="build.dir"  value="${build.home}"/>
+        <property name="final.name" value="commons-${component.name}-${component.version}"/>
+    </ant>
 
     <copy      file="LICENSE.txt"
               todir="${dist.home}"/>
@@ -346,64 +344,6 @@
            manifest="${build.home}/conf/MANIFEST.MF"/>
   </target>
 
-  <target name="compress.javascript" if="dojo_custom_rhino.jar">
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${dist.home}/commons-${component.name}-${component.version}"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateByte"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateCreditCard"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateDate"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateEmail"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateFloat"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateFloatRange"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateInteger"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateIntRange"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMask"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMaxLength"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMinLength"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateRequired"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateShort"/>

-    </antcall>
-    <antcall target="dojo.compress"> 
-        <param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateUtilities"/>

-    </antcall>
-
-  </target>
-
-  <target name="dojo.compress">
-
-    <java jar="${dojo_custom_rhino.jar}" fork="true"
-              output="${jsfilename}-compress.js">
-        <arg value="-c"/> 
-        <arg value="${jsfilename}.js"/> 
-    </java>
-  </target>
-
 <!-- ========== Unit Test Targets ========================================= -->
 
 
@@ -529,14 +469,13 @@
 <!-- ========== Download Dependencies =========================================== -->
 
     <target name="download-dependencies" 
-           depends="check-availability, check-dojo-lib" unless="skip.download">
+           depends="check-availability" unless="skip.download">
         <echo message="doing download-dependencies..." />
         <antcall target="download-beanutils" />
         <antcall target="download-digester" />
         <antcall target="download-logging" />
         <antcall target="download-oro" />
         <antcall target="download-junit" />
-        <antcall target="download-dojo-compress" />
     </target>
 
     <target name="check-availability">
@@ -546,13 +485,6 @@
         <available file="${commons-logging.jar}"   property="logging.found"/> 
         <available file="${oro.jar}"               property="oro.found"/>
         <available file="${junit.jar}"             property="junit.found"/>
-        <available file="${dojo_custom_rhino.jar}" property="dojo.found"/>
-    </target>
-
-    <target name="check-dojo-lib" unless="dojo.found">
-        <echo message="doing check-dojo-lib..." />
-        <available file="${download.lib.dir}/custom_rhino.jar" property="dojo.found"/>
-        <property name="dojo_custom_rhino.jar" value="${download.lib.dir}/custom_rhino.jar"/>
     </target>
 
     <target name="download-beanutils" unless="beanutils.found">
@@ -593,14 +525,6 @@
         <get dest="${download.lib.dir}/junit.jar"
             usetimestamp="true" ignoreerrors="true"
             src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar"/>
-    </target>
-
-    <target name="download-dojo-compress" unless="dojo.found">
-        <mkdir dir="${download.lib.dir}" />
-        <echo message="Downloading dojo compress...."/>
-        <get dest="${download.lib.dir}/custom_rhino.jar"
-            usetimestamp="true" ignoreerrors="true"
-            src="http://dojotoolkit.org/svn/dojo/trunk/buildscripts/lib/custom_rhino.jar"/>
     </target>
       
 </project>

Modified: jakarta/commons/proper/validator/trunk/maven.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/maven.xml?view=diff&rev=493673&r1=493672&r2=493673
==============================================================================
--- jakarta/commons/proper/validator/trunk/maven.xml (original)
+++ jakarta/commons/proper/validator/trunk/maven.xml Sat Jan  6 23:24:56 2007
@@ -43,11 +43,10 @@
   </postGoal>
 
   <preGoal name="jar:jar">
-    <!-- Use Dojo/Rhino to create compressed JavaScript files -->
-    <ant:available property="dojoPresent" type="file" file="${dojo_custom_rhino.jar}"/>
-    <j:if test="${dojoPresent}">
-        <attainGoal name="dojo.compress.files"/>
-    </j:if>
+    <ant:ant antfile="build-javascript.xml" target="compress">
+      <property name="build.dir"  value="${maven.build.dir}"/>
+      <property name="final.name" value="${maven.final.name}"/>
+    </ant:ant>
   </preGoal>
 
   <!-- ================================================================== -->
@@ -59,46 +58,10 @@
     <copy todir="${maven.dist.bin.assembly.dir}">
       <fileset file='${basedir}/NOTICE.txt'/>
       <fileset file="${basedir}/RELEASE-NOTES.txt"/>
+      <fileset file='${maven.build.dir}/*.js'/>
     </copy>
 
-    <!-- Create Single file of static JavaScript -->
-    <ant:concat destfile="${maven.dist.bin.assembly.dir}/${maven.final.name}.js">
-      <fileset dir="${basedir}/src/javascript/org/apache/commons/validator/javascript"
includes="*.js"/>
-    </ant:concat>
-
-    <!-- Use Dojo/Rhino to create single compressed JavaScript file -->
-    <ant:available property="dojoPresent"  type="file" file="${dojo_custom_rhino.jar}"/>
-    <j:if test="${dojoPresent}">
-        <attainGoal name="dojo.compress.single"/>
-    </j:if>
-
   </postGoal>
-
-  <!-- ================================================================== -->
-  <!-- Uses Dojo/Rhino to created compressed JavaScript files             -->
-  <!-- 1) Download Dojo/Rhino jar from:                                   -->
-  <!--         http://dojotoolkit.org/docs/compressor_system.html         -->
-  <!-- 2) set dojo_custom_rhino.jar in build.properties to jar location   -->
-  <!-- ================================================================== -->
-  <goal name="dojo.compress.single">
-    <ant:java jar="${dojo_custom_rhino.jar}" fork="true"
-              output="${maven.dist.bin.assembly.dir}/${maven.final.name}-compress.js">
-        <ant:arg value="-c"/> 
-        <ant:arg value="${maven.dist.bin.assembly.dir}/${maven.final.name}.js"/> 
-    </ant:java>
-  </goal>
-
-  <goal name="dojo.compress.files">
-    <j:set var="scriptDir" value="${maven.build.dir}/classes/org/apache/commons/validator/javascript"
/>
-    <util:tokenize var="scriptFiles" delim=",">${validator.script.files}</util:tokenize>
-    <j:forEach items="${scriptFiles}" var="scriptFile">
-        <ant:java jar="${dojo_custom_rhino.jar}" fork="true"
-              output="${scriptDir}/${scriptFile}-compress.js">
-            <ant:arg value="-c"/> 
-            <ant:arg value="${scriptDir}/${scriptFile}.js"/> 
-        </ant:java>
-    </j:forEach> 
-  </goal>
 
   <!-- ================================================================== -->
   <!-- Copy into the source distribution                                  -->



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message