Author: rgardler
Date: Mon Apr 16 00:45:00 2012
New Revision: 1326454

URL: http://svn.apache.org/viewvc?rev=1326454&view=rev
Log:
don't include images or libs when removing comments (temporary workaround, this 
is stripping all comments which means that the copyright we want is stripped 
too)

Modified:
    incubator/wookie/trunk/widgets/templates/build.xml

Modified: incubator/wookie/trunk/widgets/templates/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/build.xml?rev=1326454&r1=1326453&r2=1326454&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/build.xml (original)
+++ incubator/wookie/trunk/widgets/templates/build.xml Mon Apr 16 00:45:00 2012
@@ -1,470 +1,471 @@
-<!--
-  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 default="build-widget" basedir="." name="widget_templates_build_file">
-
-    <property name="wookie.root.dir" location="../../"/>
-    <property name="project.build.dir" location="${wookie.root.dir}/build"/>
-    <property name="template.dir" location="."/>
-    <property name="widget.build.dir" location="./build"/>
-    <property name="widget.defintions.dir" location="widgets"/>
-
-    <import file="${wookie.root.dir}/widgets/build.xml"/>
-       
-    <target name="build-widget">
-      <zip destfile="${widget.build.dir}/${widget.shortname}.wgt"
-           basedir="${widget.build.dir}/${widget.shortname}"
-           />
-      <echo>Widget package created at 
${widget.build.dir}/${widget.shortname}.wgt</echo>
-    </target>
-
-    <target name="generate-widgets"
-            description="Generate all the required widgets from the templates">
-
-      <property name="widget.include" value="*"/>
-
-      <echo message="+------------------------------------------+"/>
-      <echo message="|                                          |"/>
-      <echo message="|  Generating widgets                      |"/>
-      <echo message="|  include: ${widget.include}              |"/>
-      <echo message="|  in: ${basedir}                          |"/>
-      <echo message="|                                          |"/>
-      <echo message="+------------------------------------------+"/>
-
-
- 
-      <subant target="_generate_and_deploy_widget"
-              genericantfile="${basedir}/build.xml"
-              inheritall="true">
-        <dirset dir="${widget.definitions.dir}">
-          <include name="${widget.include}"/>
-         <exclude name="common"/>
-        </dirset>
-      </subant>
-    </target>
-       
-       <target name="_remove_comments">
-             <echo message="+------------------------------------------"/>
-             <echo message="|  Removing comments from files:           |"/>
-             <echo message="|  in: ${widget.build.dir}/${widget.shortname}"  />
-             <echo message="+------------------------------------------"/>
-       <replaceregexp match="&lt;\%[^&gt;]*&gt;" flags="g" replace="" >
-                 <fileset dir="${widget.build.dir}/${widget.shortname}" >
-                 </fileset>
-       </replaceregexp>
-       </target>
-
-    <target name="generate-test-widgets"
-            description="Generate a single test widget from the template">
-
-      <property name="widget.include" value="*TestWidget"/>
-
-      <!-- This target is intended to be used to test any changes to the 
-      template before all widgets are regenerated -->
-      <echo message="+------------------------------------------+"/>
-      <echo message="|                                          |"/>
-      <echo message="|  Generating test widgets                 |"/>
-      <echo message="|                                          |"/>
-      <echo message="+------------------------------------------+"/>
-
-      <subant target="_generate_and_deploy_widget"
-              genericantfile="${basedir}/build.xml"
-              inheritall="true">
-        <dirset dir="testWidgets">
-          <include name="${widget.include}"/>
-        </dirset>
-      </subant>
-    </target>
-
-    <target name="_generate_widget"
-            depends="_init_widget_generation"
-            description="Generate a widget from a template">
-      <echo message="+------------------------------------------"/>
-      <echo message="|  Widget Shortname: ${widget.shortname}"/>
-      <echo message="|  Widget: ${widget.name}"/>
-      <echo message="|  Template: ${template.name}"/>
-      <echo message="+------------------------------------------"/>
-       
-      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
-       target="_init_template"/>
-
-      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
-           target="_generate_from_parent_templates"/>
-
-      <antcall target="_process_template" inheritAll="false">
-        <propertyset id="properties-starting-with-foo">
-          <propertyref prefix="wookie"/>
-          <propertyref prefix="template."/>
-          <propertyref prefix="widget."/>
-          <propertyref prefix="${widget.shortname}"/>
-        </propertyset>
-      </antcall>
-        <antcall target="_remove_comments"/>
-
-      <antcall target="_copy_widget_files"/>
-        <antcall target="_remove_comments"/>
-    </target>
-
-    <target name="_copy_widget_files"
-           unless="copyWidgetFiles">
-      <echo message="+------------------------------------------"/>
-      <echo message="|  Copying widget files: ${widget.shortname}"  />
-      <echo message="+------------------------------------------"/>
-
-      <!-- Copy/Create root files -->
-
-      <copy todir="${widget.build.dir}/${widget.shortname}"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common">
-          <exclude name="widget.properties"/>
-          <exclude name="scripts/*"/>
-          <exclude name="style/*"/>
-          <exclude name="images/*"/>
-          <exclude name="lib/*"/>
-          <exclude name="legal/*"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir=".">
-          <exclude name="widget.properties"/>
-          <exclude name="scripts/*"/>
-          <exclude name="style/*"/>
-          <exclude name="images/*"/>
-          <exclude name="lib/*"/>
-          <exclude name="legal/*"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <!-- Copy/Create images -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/images"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common/images">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}/images"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="./images">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-
-      <!-- Copy/Create the javascript -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common/scripts">
-          <exclude name="**/*_controller.js"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="./scripts">
-          <exclude name="**/*_controller.js"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <concat 
destfile="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
-             fixlastline="true">
-        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
-                 erroronmissingdir="false">
-          <include name="controller.js"/>
-        </fileset>
-        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
-                 erroronmissingdir="false">
-          <include name="**/*_controller.js"/>
-        </fileset>
-        <fileset dir="../common/scripts"
-                 erroronmissingdir="false">
-          <include name="**/*_controller.js"/>
-        </fileset>     
-        <fileset dir="./scripts"
-                 erroronmissingdir="false">
-          <include name="**/*_controller.js"/>
-        </fileset>
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </concat>
-      <move 
tofile="${widget.build.dir}/${widget.shortname}/scripts/controller.js" 
-            
file="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
-            failonerror="false"/>
-
-
-      <!-- Copy/Create the stylesheets -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/style"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common/style">
-          <include name="**/*.css"/>
-          <include name="**/*.css.add"/>
-       </fileset>  
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain>  
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}/style"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="./style">
-          <include name="**/*.css"/>
-          <include name="**/*.css.add"/>
-        </fileset>    
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain> 
-      </copy>
-
-      <concat 
destfile="${widget.build.dir}/${widget.shortname}/style/all.css.new"
-                 fixlastline="true">
-        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
-                 erroronmissingdir="false">
-          <include name="all.css"/>
-        </fileset>
-        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
-                 erroronmissingdir="false">
-          <include name="*.css.add"/>
-        </fileset>
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </concat>
-      <move tofile="${widget.build.dir}/${widget.shortname}/style/all.css" 
-            file="${widget.build.dir}/${widget.shortname}/style/all.css.new"
-            failonerror="false"/>
-      
-      <!-- Copy/Create the libraries -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common/lib">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="./lib">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-
-      <!-- Copy/Create the legal -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="../common/legal">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="./legal">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-    </target>
-
-    <target name="_process_template">
-      <echo message="+------------------------------------------"/>
-      <echo message="|  Processing template: ${template.name}"/>
-      <echo message="+------------------------------------------"/>
-
-      <mkdir dir="${widget.build.dir}/${widget.shortname}"/>
-
-      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
-           target="_init_template"/>
-       
-      <property file="${widget.build.dir}/${widget.shortname}.properties"/>
-      <property file="${template.dir}/default.widget.properties"/>
-
-      <!-- Copy/Create the build.xml file -->
-      <copy file="${template.dir}/${template.name}/build.xml"
-            todir="${widget.build.dir}/${widget.shortname}"
-            overwrite="true"
-            failonerror="false">
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <!-- Copy/Create the config.xml file -->
-      <copy file="${template.dir}/${template.name}/config.xml"
-            todir="${widget.build.dir}/${widget.shortname}"
-            overwrite="true"
-            failonerror="false">
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <!-- Copy/Create root files -->
-      <copy todir="${widget.build.dir}/${widget.shortname}"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}">
-          <exclude name="widget.properties"/>
-          <exclude name="scripts/*"/>
-          <exclude name="style/*"/>
-          <exclude name="images/*"/>
-          <exclude name="lib/*"/>
-          <exclude name="legal/*"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <!-- Copy/Create images -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/images"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}/images">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-
-      <!-- Copy/Create the javascript -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}/scripts">
-          <include name="**/*.js"/>
-          <exclude name="**/*_controller.js"/>
-        </fileset>     
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-
-      <concat 
destfile="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new">
-        <fileset dir="${template.dir}/${template.name}/scripts"
-                 erroronmissingdir="false">
-          <include name="**/*_controller.js"/>
-        </fileset>
-        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
-                 erroronmissingdir="false">
-          <include name="controller.js"/>
-        </fileset>
-        <header filtering="yes" trimleading="yes">
-          /*
-           *  Javascript from template: ${template.name}
-           */ 
-        </header>
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </concat>
-      <move 
tofile="${widget.build.dir}/${widget.shortname}/scripts/controller.js" 
-            
file="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
-            failonerror="false"/>
-
-      <!-- Copy/Create the stylesheets -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/style"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}/style">
-          <include name="**/*.css"/>
-        </fileset>     
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </copy>
-      <concat 
destfile="${widget.build.dir}/${widget.shortname}/style/all.css.new">
-        <fileset dir="${template.dir}/${template.name}/style"
-                 erroronmissingdir="false">
-          <include name="*.css.add"/>
-        </fileset>
-        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
-                 erroronmissingdir="false">
-          <include name="all.css"/>
-        </fileset>
-
-        <filterchain>
-          <expandproperties/>
-        </filterchain>
-      </concat>
-      <move tofile="${widget.build.dir}/${widget.shortname}/style/all.css" 
-            file="${widget.build.dir}/${widget.shortname}/style/all.css.new"
-            failonerror="false"/>
-      
-      <!-- Copy/Create the libraries -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}/lib">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-
-      <!-- Copy/Create the legal -->
-      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
-            overwrite="true"
-            failonerror="false">
-        <fileset dir="${template.dir}/${template.name}/legal">
-          <include name="**/*.*"/>
-        </fileset>     
-      </copy>
-    </target>
-
-    <target name="_generate_and_deploy_widget"
-            description="Generates a widget from its template and then deploys 
to a live server"
-            depends="_generate_widget">
-      <!-- Deploy the widget -->
-      <antcall target="deploy-widget">
-        <param name="widget.shortname" value="${widget.shortname}"/>
-      </antcall>
-    </target>
-
-    <target name="_init_widget_generation">
-      <!-- Read widget defined properties -->
-      <property file="widget.properties"/>
-      <!-- Read template default properties -->
-      <property 
file="${template.dir}/${template.name}/default.widget.properties"/>
-      <!-- Read master default properties -->
-      <property file="${template.dir}/default.widget.properties"/>
-
-      <mkdir dir="${widget.build.dir}"/>
-
-      <!-- Copy/Clean up old widget -->
-      <delete dir="${widget.build.dir}/${widget.shortname}"/>
-    </target>
-
+<!--
+  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 default="build-widget" basedir="." name="widget_templates_build_file">
+
+    <property name="wookie.root.dir" location="../../"/>
+    <property name="project.build.dir" location="${wookie.root.dir}/build"/>
+    <property name="template.dir" location="."/>
+    <property name="widget.build.dir" location="./build"/>
+    <property name="widget.defintions.dir" location="widgets"/>
+
+    <import file="${wookie.root.dir}/widgets/build.xml"/>
+       
+    <target name="build-widget">
+      <zip destfile="${widget.build.dir}/${widget.shortname}.wgt"
+           basedir="${widget.build.dir}/${widget.shortname}"
+           />
+      <echo>Widget package created at 
${widget.build.dir}/${widget.shortname}.wgt</echo>
+    </target>
+
+    <target name="generate-widgets"
+            description="Generate all the required widgets from the templates">
+
+      <property name="widget.include" value="*"/>
+
+      <echo message="+------------------------------------------+"/>
+      <echo message="|                                          |"/>
+      <echo message="|  Generating widgets                      |"/>
+      <echo message="|  include: ${widget.include}              |"/>
+      <echo message="|  in: ${basedir}                          |"/>
+      <echo message="|                                          |"/>
+      <echo message="+------------------------------------------+"/>
+
+
+ 
+      <subant target="_generate_and_deploy_widget"
+              genericantfile="${basedir}/build.xml"
+              inheritall="true">
+        <dirset dir="${widget.definitions.dir}">
+          <include name="${widget.include}"/>
+         <exclude name="common"/>
+        </dirset>
+      </subant>
+    </target>
+       
+       <target name="_remove_comments">
+             <echo message="+------------------------------------------"/>
+             <echo message="|  Removing comments from files:           |"/>
+             <echo message="|  in: ${widget.build.dir}/${widget.shortname}"  />
+             <echo message="+------------------------------------------"/>
+       <replaceregexp match="&lt;\%[^&gt;]*&gt;" flags="g" replace="" >
+                 <fileset dir="${widget.build.dir}/${widget.shortname}" >
+                   <exclude name="images/*"/>
+                 </fileset>
+       </replaceregexp>
+       </target>
+
+    <target name="generate-test-widgets"
+            description="Generate a single test widget from the template">
+
+      <property name="widget.include" value="*TestWidget"/>
+
+      <!-- This target is intended to be used to test any changes to the 
+      template before all widgets are regenerated -->
+      <echo message="+------------------------------------------+"/>
+      <echo message="|                                          |"/>
+      <echo message="|  Generating test widgets                 |"/>
+      <echo message="|                                          |"/>
+      <echo message="+------------------------------------------+"/>
+
+      <subant target="_generate_and_deploy_widget"
+              genericantfile="${basedir}/build.xml"
+              inheritall="true">
+        <dirset dir="testWidgets">
+          <include name="${widget.include}"/>
+        </dirset>
+      </subant>
+    </target>
+
+    <target name="_generate_widget"
+            depends="_init_widget_generation"
+            description="Generate a widget from a template">
+      <echo message="+------------------------------------------"/>
+      <echo message="|  Widget Shortname: ${widget.shortname}"/>
+      <echo message="|  Widget: ${widget.name}"/>
+      <echo message="|  Template: ${template.name}"/>
+      <echo message="+------------------------------------------"/>
+       
+      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
+       target="_init_template"/>
+
+      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
+           target="_generate_from_parent_templates"/>
+
+      <antcall target="_process_template" inheritAll="false">
+        <propertyset id="properties-starting-with-foo">
+          <propertyref prefix="wookie"/>
+          <propertyref prefix="template."/>
+          <propertyref prefix="widget."/>
+          <propertyref prefix="${widget.shortname}"/>
+        </propertyset>
+      </antcall>
+        <antcall target="_remove_comments"/>
+
+      <antcall target="_copy_widget_files"/>
+        <antcall target="_remove_comments"/>
+    </target>
+
+    <target name="_copy_widget_files"
+           unless="copyWidgetFiles">
+      <echo message="+------------------------------------------"/>
+      <echo message="|  Copying widget files: ${widget.shortname}"  />
+      <echo message="+------------------------------------------"/>
+
+      <!-- Copy/Create root files -->
+
+      <copy todir="${widget.build.dir}/${widget.shortname}"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common">
+          <exclude name="widget.properties"/>
+          <exclude name="scripts/*"/>
+          <exclude name="style/*"/>
+          <exclude name="images/*"/>
+          <exclude name="lib/*"/>
+          <exclude name="legal/*"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir=".">
+          <exclude name="widget.properties"/>
+          <exclude name="scripts/*"/>
+          <exclude name="style/*"/>
+          <exclude name="images/*"/>
+          <exclude name="lib/*"/>
+          <exclude name="legal/*"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <!-- Copy/Create images -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/images"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common/images">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}/images"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="./images">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+
+      <!-- Copy/Create the javascript -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common/scripts">
+          <exclude name="**/*_controller.js"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="./scripts">
+          <exclude name="**/*_controller.js"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <concat 
destfile="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
+             fixlastline="true">
+        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
+                 erroronmissingdir="false">
+          <include name="controller.js"/>
+        </fileset>
+        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
+                 erroronmissingdir="false">
+          <include name="**/*_controller.js"/>
+        </fileset>
+        <fileset dir="../common/scripts"
+                 erroronmissingdir="false">
+          <include name="**/*_controller.js"/>
+        </fileset>     
+        <fileset dir="./scripts"
+                 erroronmissingdir="false">
+          <include name="**/*_controller.js"/>
+        </fileset>
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </concat>
+      <move 
tofile="${widget.build.dir}/${widget.shortname}/scripts/controller.js" 
+            
file="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
+            failonerror="false"/>
+
+
+      <!-- Copy/Create the stylesheets -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/style"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common/style">
+          <include name="**/*.css"/>
+          <include name="**/*.css.add"/>
+       </fileset>  
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain>  
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}/style"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="./style">
+          <include name="**/*.css"/>
+          <include name="**/*.css.add"/>
+        </fileset>    
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain> 
+      </copy>
+
+      <concat 
destfile="${widget.build.dir}/${widget.shortname}/style/all.css.new"
+                 fixlastline="true">
+        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
+                 erroronmissingdir="false">
+          <include name="all.css"/>
+        </fileset>
+        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
+                 erroronmissingdir="false">
+          <include name="*.css.add"/>
+        </fileset>
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </concat>
+      <move tofile="${widget.build.dir}/${widget.shortname}/style/all.css" 
+            file="${widget.build.dir}/${widget.shortname}/style/all.css.new"
+            failonerror="false"/>
+      
+      <!-- Copy/Create the libraries -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common/lib">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="./lib">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+
+      <!-- Copy/Create the legal -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="../common/legal">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="./legal">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+    </target>
+
+    <target name="_process_template">
+      <echo message="+------------------------------------------"/>
+      <echo message="|  Processing template: ${template.name}"/>
+      <echo message="+------------------------------------------"/>
+
+      <mkdir dir="${widget.build.dir}/${widget.shortname}"/>
+
+      <ant antfile="${template.dir}/${template.name}/template_build.xml" 
+           target="_init_template"/>
+       
+      <property file="${widget.build.dir}/${widget.shortname}.properties"/>
+      <property file="${template.dir}/default.widget.properties"/>
+
+      <!-- Copy/Create the build.xml file -->
+      <copy file="${template.dir}/${template.name}/build.xml"
+            todir="${widget.build.dir}/${widget.shortname}"
+            overwrite="true"
+            failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <!-- Copy/Create the config.xml file -->
+      <copy file="${template.dir}/${template.name}/config.xml"
+            todir="${widget.build.dir}/${widget.shortname}"
+            overwrite="true"
+            failonerror="false">
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <!-- Copy/Create root files -->
+      <copy todir="${widget.build.dir}/${widget.shortname}"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}">
+          <exclude name="widget.properties"/>
+          <exclude name="scripts/*"/>
+          <exclude name="style/*"/>
+          <exclude name="images/*"/>
+          <exclude name="lib/*"/>
+          <exclude name="legal/*"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <!-- Copy/Create images -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/images"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}/images">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+
+      <!-- Copy/Create the javascript -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/scripts"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}/scripts">
+          <include name="**/*.js"/>
+          <exclude name="**/*_controller.js"/>
+        </fileset>     
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+
+      <concat 
destfile="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new">
+        <fileset dir="${template.dir}/${template.name}/scripts"
+                 erroronmissingdir="false">
+          <include name="**/*_controller.js"/>
+        </fileset>
+        <fileset dir="${widget.build.dir}/${widget.shortname}/scripts"
+                 erroronmissingdir="false">
+          <include name="controller.js"/>
+        </fileset>
+        <header filtering="yes" trimleading="yes">
+          /*
+           *  Javascript from template: ${template.name}
+           */ 
+        </header>
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </concat>
+      <move 
tofile="${widget.build.dir}/${widget.shortname}/scripts/controller.js" 
+            
file="${widget.build.dir}/${widget.shortname}/scripts/controller.js.new"
+            failonerror="false"/>
+
+      <!-- Copy/Create the stylesheets -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/style"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}/style">
+          <include name="**/*.css"/>
+        </fileset>     
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </copy>
+      <concat 
destfile="${widget.build.dir}/${widget.shortname}/style/all.css.new">
+        <fileset dir="${template.dir}/${template.name}/style"
+                 erroronmissingdir="false">
+          <include name="*.css.add"/>
+        </fileset>
+        <fileset dir="${widget.build.dir}/${widget.shortname}/style"
+                 erroronmissingdir="false">
+          <include name="all.css"/>
+        </fileset>
+
+        <filterchain>
+          <expandproperties/>
+        </filterchain>
+      </concat>
+      <move tofile="${widget.build.dir}/${widget.shortname}/style/all.css" 
+            file="${widget.build.dir}/${widget.shortname}/style/all.css.new"
+            failonerror="false"/>
+      
+      <!-- Copy/Create the libraries -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/lib"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}/lib">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+
+      <!-- Copy/Create the legal -->
+      <copy todir="${widget.build.dir}/${widget.shortname}/legal"
+            overwrite="true"
+            failonerror="false">
+        <fileset dir="${template.dir}/${template.name}/legal">
+          <include name="**/*.*"/>
+        </fileset>     
+      </copy>
+    </target>
+
+    <target name="_generate_and_deploy_widget"
+            description="Generates a widget from its template and then deploys 
to a live server"
+            depends="_generate_widget">
+      <!-- Deploy the widget -->
+      <antcall target="deploy-widget">
+        <param name="widget.shortname" value="${widget.shortname}"/>
+      </antcall>
+    </target>
+
+    <target name="_init_widget_generation">
+      <!-- Read widget defined properties -->
+      <property file="widget.properties"/>
+      <!-- Read template default properties -->
+      <property 
file="${template.dir}/${template.name}/default.widget.properties"/>
+      <!-- Read master default properties -->
+      <property file="${template.dir}/default.widget.properties"/>
+
+      <mkdir dir="${widget.build.dir}"/>
+
+      <!-- Copy/Clean up old widget -->
+      <delete dir="${widget.build.dir}/${widget.shortname}"/>
+    </target>
+
 </project>
\ No newline at end of file


Reply via email to