You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2005/12/04 04:51:03 UTC

svn commit: r353807 - in /struts/scripting/trunk: maven.xml project.xml xdocs/README.xsl xdocs/index.xml xdocs/navigation.xml xdocs/source-guide.xml

Author: mrdon
Date: Sat Dec  3 19:51:00 2005
New Revision: 353807

URL: http://svn.apache.org/viewcvs?rev=353807&view=rev
Log:
 * Adding a source code guide
 * Adding a goal for generating the readme/release notes automatically from
   available website and Maven information

Added:
    struts/scripting/trunk/xdocs/README.xsl   (with props)
    struts/scripting/trunk/xdocs/source-guide.xml   (with props)
Modified:
    struts/scripting/trunk/maven.xml
    struts/scripting/trunk/project.xml
    struts/scripting/trunk/xdocs/index.xml
    struts/scripting/trunk/xdocs/navigation.xml

Modified: struts/scripting/trunk/maven.xml
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/maven.xml?rev=353807&r1=353806&r2=353807&view=diff
==============================================================================
--- struts/scripting/trunk/maven.xml (original)
+++ struts/scripting/trunk/maven.xml Sat Dec  3 19:51:00 2005
@@ -34,4 +34,29 @@
       
 	</postGoal>
 
+    <goal name="readme" description="Generates readme">
+        <!--
+        <ant:java classname="org.mozilla.javascript.tools.shell.Main" fork="true">
+            <ant:classpath>
+                <ant:path refid="maven.dependency.classpath"/>
+            </ant:classpath>
+            <ant:arg value="${basedir}/src/build/releasenotes.js" />
+            <ant:arg value="${basedir}" />
+        </ant:java>    
+        -->
+        <ant:java classname="org.apache.xalan.xslt.Process" fork="true">
+            <ant:classpath>
+                <ant:path refid="maven.dependency.classpath"/>
+            </ant:classpath>
+            <ant:arg value="-IN" />
+            <ant:arg value="${basedir}/project.xml" />
+            <ant:arg value="-OUT" />
+            <ant:arg value="${basedir}/README.txt" />
+            <ant:arg value="-XSL" />
+            <ant:arg value="${basedir}/xdocs/README.xsl" />
+        </ant:java>    
+ 
+    </goal>
+                     
+
 </project>

Modified: struts/scripting/trunk/project.xml
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/project.xml?rev=353807&r1=353806&r2=353807&view=diff
==============================================================================
--- struts/scripting/trunk/project.xml (original)
+++ struts/scripting/trunk/project.xml Sat Dec  3 19:51:00 2005
@@ -152,8 +152,22 @@
       </properties>
       <url>http://www.beanshell.org/</url>
     </dependency>
-    
-  </dependencies>
+
+    <!-- The following two dependencies are only used during the build process -->
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.1</version>
+      <url>http://jakarta.apache.org/commons/logging/</url>
+    </dependency>
+
+    <dependency>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+      <version>2.7.0</version>
+      <url>http://jakarta.apache.org/commons/logging/</url>
+    </dependency>
+ </dependencies>
   
   <build>
     <nagEmailAddress>struts-dev@struts.apache.org</nagEmailAddress>

Added: struts/scripting/trunk/xdocs/README.xsl
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/xdocs/README.xsl?rev=353807&view=auto
==============================================================================
--- struts/scripting/trunk/xdocs/README.xsl (added)
+++ struts/scripting/trunk/xdocs/README.xsl Sat Dec  3 19:51:00 2005
@@ -0,0 +1,150 @@
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:java_clang="http://xml.apache.org/xalan/java/org.apache.commons.lang"
+    xmlns:java_lang="http://xml.apache.org/xalan/java/java.lang">
+    
+    <xsl:output method="text" />
+    <xsl:strip-space elements="*" />
+    
+    <xsl:variable name="index" select="document('index.xml')" />
+    <xsl:variable name="changes" select="document('changes.xml')" />
+    <xsl:variable name="source" select="document('source-guide.xml')" />
+    
+    <xsl:template match="/">
+      <xsl:value-of select="concat('The ',project/name,' (Version ',project/currentVersion,')')" />
+<xsl:text> README File
+
+============
+INTRODUCTION:
+============
+</xsl:text>
+        <xsl:apply-templates select="$index/document/body/section" mode="nosubs" />
+        
+        <xsl:apply-templates select="$changes/document/body/release[1]" />
+        
+        <xsl:apply-templates select="$source/document/body/section" />
+        
+        <xsl:variable name="end">
+<xsl:text>This and a lot more information can be found in the Struts Scripting documentation on the website, and if you are reading this after extracting a fresh release, you'll find the same documentation in the /docs directory.
+---------------- http://struts.apache.org ----------------
+</xsl:text>
+        </xsl:variable>
+        <xsl:text>&#10;----------------------------------------------------------&#10;</xsl:text>
+        <xsl:value-of select="java_clang:WordUtils.wrap($end, 80)" />
+        
+    </xsl:template>
+    
+    <xsl:template match="section" mode="nosubs">
+        <xsl:apply-templates select="*[name(.) != 'subsection']" />
+    </xsl:template>
+    
+    <xsl:template match="section">
+<xsl:text> 
+
+========================
+</xsl:text>
+      <xsl:variable name="str" select="java_lang:String.new(string(@name))" />
+      <xsl:variable name="str1" select="java_lang:toUpperCase($str)" />
+      <xsl:value-of select="$str1" />
+<xsl:text>
+========================
+</xsl:text>
+
+        <xsl:apply-templates select="*[name(.) != 'subsection']" />
+
+        <xsl:apply-templates select="subsection" />
+    </xsl:template>
+
+    <xsl:template match="subsection">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:variable name="str" select="java_lang:String.new(string(@name))" />
+      <xsl:variable name="str1" select="java_lang:toUpperCase($str)" />
+      <xsl:value-of select="$str1" />
+      <xsl:text>&#10;</xsl:text>
+      
+      <xsl:apply-templates />
+      
+    </xsl:template>
+
+    
+    <xsl:template match="release">
+<xsl:text> 
+
+========================
+NEW AND REVISED FEATURES:
+========================
+</xsl:text>
+      <xsl:text>&#10;New Features:&#10;</xsl:text>
+      <xsl:apply-templates select="action[@type='add']" />
+      <xsl:text>&#10;Fixes:&#10;</xsl:text>
+      <xsl:apply-templates select="action[@type='fix']" />
+      <xsl:text>&#10;Miscellaneous:&#10;</xsl:text>
+      <xsl:apply-templates select="action[@type != 'fix' and type != 'add']" />      
+    </xsl:template>
+    
+    <xsl:template match="action">
+      <xsl:variable name="txt">
+          <xsl:apply-templates />
+         <xsl:value-of select="concat(' (',@dev,')&#10;')" />
+        </xsl:variable>
+        <xsl:text> * </xsl:text>
+        <xsl:value-of select="java_clang:WordUtils.wrap($txt, 77)" />
+    </xsl:template>
+    
+    <xsl:template match="a[@href and not(starts-with(@href, '#'))]">
+      <xsl:text> </xsl:text>
+      <xsl:apply-templates  /><xsl:value-of select="concat(' (',@href,')')" />
+      <xsl:text> </xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="li[starts-with(a/@href, '#')]" />
+    
+    <xsl:template match="li[not(starts-with(a/@href, '#'))]">
+      <xsl:text> * </xsl:text> 
+      <xsl:variable name="txt1">  
+        <xsl:apply-templates />
+      </xsl:variable>
+      <xsl:value-of select="java_clang:WordUtils.wrap($txt1, 77)" />
+      <xsl:text>&#10;</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="ul[not(starts-with(li/a/@href, '#'))]">
+      <xsl:text>&#10;</xsl:text><xsl:apply-templates /><xsl:text>&#10;</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="p">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:variable name="txt1">  
+        <xsl:apply-templates />
+      </xsl:variable>
+      <xsl:value-of select="java_clang:WordUtils.wrap($txt1, 80)" />
+      <xsl:text>&#10;</xsl:text>
+    </xsl:template>
+    
+    <xsl:template match="node()|@*" priority="-1">
+      <xsl:copy>
+        <xsl:apply-templates select="@*|node()"/>
+      </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="li/text()|p/text()|action/text()">
+      <xsl:variable name="str" select="java_lang:String.new(string(.))" />
+      <xsl:variable name="str1" select="java_lang:replaceAll($str, '\s+',' ')" />
+      <xsl:choose>
+        <xsl:when test="number(.) > 1 and name(..) = 'p'">
+          <xsl:value-of select="$str1" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:variable name="str2" select="java_clang:StringUtils.trim($str1)" />
+          <xsl:value-of select="$str2" />
+        </xsl:otherwise>
+      </xsl:choose>  
+      
+    </xsl:template>
+    
+    <xsl:template match="text()" priority="-1">
+      <xsl:value-of select="." />
+    </xsl:template>
+    
+        
+</xsl:stylesheet>

Propchange: struts/scripting/trunk/xdocs/README.xsl
------------------------------------------------------------------------------
    svn:executable = *

Modified: struts/scripting/trunk/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/xdocs/index.xml?rev=353807&r1=353806&r2=353807&view=diff
==============================================================================
--- struts/scripting/trunk/xdocs/index.xml (original)
+++ struts/scripting/trunk/xdocs/index.xml Sat Dec  3 19:51:00 2005
@@ -22,7 +22,7 @@
   </properties>
 
   <body>
-    <section name="Struts BSF Scripting">
+    <section name="Struts Scripting">
     <a name="overview"/>
       <p>This project allows Struts Actions to be written in the scripting 
       language of one's choice rather than as Java classes.  It uses the 
@@ -56,6 +56,7 @@
         <a name="documentation"/>
         <ul>
             <li><a href="user-guide.html">User Guide</a> - Covers installation and usage</li>
+            <li><a href="source-guide.html">Source Code Guide</a> - Covers the source layout and how to build Struts Scripting</li>
             <li><a href="apidocs/index.html">Javadocs</a> - Includes 
                 <a href="apidocs/org/apache/struts/scripting/StrutsInfo.html"><code>struts</code></a> variable and 
                 <a href="apidocs/org/apache/struts/scripting/BSFManagerFilter.html">Filter</a> API's.</li>

Modified: struts/scripting/trunk/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/xdocs/navigation.xml?rev=353807&r1=353806&r2=353807&view=diff
==============================================================================
--- struts/scripting/trunk/xdocs/navigation.xml (original)
+++ struts/scripting/trunk/xdocs/navigation.xml Sat Dec  3 19:51:00 2005
@@ -7,6 +7,7 @@
         <item name="Features" href="index.html#features"/>
         <item name="Documentation" href="index.html#documentation"/>
         <item name="User Guide" href="user-guide.html"/>
+        <item name="Source Guide" href="source-guide.html"/>
         <item name="Download (Sourceforge)" href="http://sourceforge.net/project/showfiles.php?group_id=49385&amp;package_id=84734"/>
     </menu>
 

Added: struts/scripting/trunk/xdocs/source-guide.xml
URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/xdocs/source-guide.xml?rev=353807&view=auto
==============================================================================
--- struts/scripting/trunk/xdocs/source-guide.xml (added)
+++ struts/scripting/trunk/xdocs/source-guide.xml Sat Dec  3 19:51:00 2005
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<!--
+Copyright 1999-2005 The Apache Software Foundation
+Licensed 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.
+-->
+<!--
+// ======================================================================== 78
+-->
+<document>
+  <properties>
+    <title>Struts Scripting Source Code Guide</title>
+  </properties>
+
+  <body>
+    <section name="Struts Scripting Source Code Guide">
+      <a name="overview"/>
+      <p>The Struts Scripting project, for the most part, follows Apache Struts build and
+      source code layout, so if you are familiar with another Struts project, you'll be
+      at home here.  If not, this guide first walks you though what is where and why.
+      Next, it gives help on how to build common artifacts.
+      </p>
+      <p>Again, since the heavy lifting is done by the 
+      <a href="http://jakarta.apache.org/bsf">Beans Scripting Framework </a> 
+      and the scripting engines themselves, there isn't much code to this project itself.
+      </p>
+      <ul>
+        <li><a href="#layout">Source code layout</a></li>
+        <li><a href="#build">Build instructions</a></li>
+      </ul>  
+    <subsection name="Source code layout">
+      <a name="layout"/>
+         <p>When you unzip the latest release Struts Scripting or check it out from subversion
+         (more help on subversion at the Struts <a href="http://struts.apache.org/acquiring.html#Source_Code">source code</a>), you'll be staring at the following directory structure:
+         </p>
+         <ul>
+         <li><code>/src</code> - All source code can be found here</li>
+         <li><code>/src/java</code> - The source code for the Struts Scripting framework itself</li>
+         <li><code>/src/struts-example</code> - A modified version of the Struts 1.2.8 Mailreader example application.  
+         This version replaces Java-coded Struts Actions with <a href="http://www.beanshell.org">Beanshell</a> scripts.</li>
+         </ul>
+         <ul>
+         <li><code>/xdocs</code> - The XML source code for all documentation, including this guide.</li>
+         <li><code>/lib</code> - This directory is only created if you build the project using the Ant script.</li>
+         <li><code>/target</code> - Maven puts all compiled files into this temporary directory.</li>
+         <li><code>/build</code> - Likewise, Apache Ant stores all compiled files in this temporary folder.</li>
+         <li><code>/dist</code> - The final results of the files Ant creates will be placed here.</li>
+         </ul>
+        <p>Next, we'll look at how to build both Struts Scripting library and the included example application.</p>
+    </subsection>     
+    <subsection name="Build Instructions">
+      <a name="build"/>
+         <p>Currently, Struts Scripting uses a hybrid build system composed of both Maven and Ant build scripts.  The Maven scripts handle building the distribution files and provide a consistent build environment to users of other Struts subprojects.  To follow these build instructions, you will need to have <a href="http://ant.apache.org">Apache Ant</a> and/or <a href="http://maven.apache.org">Apache Maven</a> installed and their executables available in your command path.
+         </p>
+         <p>
+         The Apache Ant build script is primarily in charge of building the Struts Mailreader example application.  In fact, when the Maven script creates a Struts Scripting distribution, it calls the Ant build script to create the example application.
+         </p>
+         <p>
+         Since there are a bunch of build targets, we will break the build down into tasks that you might want to accomplish and show the best way to complete them.
+         </p>
+         <ul>
+         <li><strong>Build the Struts Scripting jar</strong> - Run '<code>maven jar:jar</code>' which will create the jar as <code>/target/struts-scripting-VERSION.jar</code>.</li>
+         <li><strong>Build the Mailreader example</strong> - Run '<code>ant example</code>' to create <code>/dist/struts-example.war</code>.</li>
+         <li><strong>Build the documentation</strong> - Run '<code>maven site:generate</code>' to create the Struts Scripting website at <code>/target/docs</code>.</li>
+         </ul>
+         <p>While this list only covers a few build targets, there are many other you can discover by typing '<code>ant -p</code>' or '<code>maven -g</code>' from the Struts Scripting directory.</p>
+      </subsection>
+   </section> 
+          
+          </body>
+
+</document>

Propchange: struts/scripting/trunk/xdocs/source-guide.xml
------------------------------------------------------------------------------
    svn:executable = *



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


Generated release notes (was Re: svn commit: r353807 - in /struts/scripting/trunk: ...)

Posted by Don Brown <mr...@twdata.org>.
I was walking through the release checklist and saw I had to make 
release notes.  Being an avid fan of the DRY (Don't Repeat Yourself) 
principle, I created a stylesheet that generates release notes/readme 
files from available documentation.  It is still kind of a custom 
stylesheet (rather than a Maven plugin, for example), but I think it 
could be used for other projects, especially those that used the 
changes.xml file.

BTW, if you are wondering why I didn't use the Ant <style> task, 
apparently it doesn't mix well with Maven.  Stupid classloader problems 
had me going in circles, but I think this solution will work.  Wrangling 
with Maven plugin and classloader hassles has caused my appreciation of 
Maven to drop a notch :(

Don

mrdon@apache.org wrote:

>Author: mrdon
>Date: Sat Dec  3 19:51:00 2005
>New Revision: 353807
>
>URL: http://svn.apache.org/viewcvs?rev=353807&view=rev
>Log:
> * Adding a source code guide
> * Adding a goal for generating the readme/release notes automatically from
>   available website and Maven information
>
>Added:
>    struts/scripting/trunk/xdocs/README.xsl   (with props)
>    struts/scripting/trunk/xdocs/source-guide.xml   (with props)
>Modified:
>    struts/scripting/trunk/maven.xml
>    struts/scripting/trunk/project.xml
>    struts/scripting/trunk/xdocs/index.xml
>    struts/scripting/trunk/xdocs/navigation.xml
>
>Modified: struts/scripting/trunk/maven.xml
>URL: http://svn.apache.org/viewcvs/struts/scripting/trunk/maven.xml?rev=353807&r1=353806&r2=353807&view=diff
>==============================================================================
>--- struts/scripting/trunk/maven.xml (original)
>+++ struts/scripting/trunk/maven.xml Sat Dec  3 19:51:00 2005
>@@ -34,4 +34,29 @@
>       
>  
>


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


Re: svn commit: r353807 - in /struts/scripting/trunk: maven.xml project.xml xdocs/README.xsl xdocs/index.xml xdocs/navigation.xml xdocs/source-guide.xml

Posted by Don Brown <mr...@twdata.org>.
Thanks, I think I got them all.  Let me know if I missed something.

Don

Wendy Smoak wrote:

>On 12/3/05, mrdon@apache.org <mr...@apache.org> wrote:
>  
>
>>Author: mrdon
>>Date: Sat Dec  3 19:51:00 2005
>>New Revision: 353807
>>
>>URL: http://svn.apache.org/viewcvs?rev=353807&view=rev
>>    
>>
>
>  
>
>>+    <!-- The following two dependencies are only used during the build process -->
>>    
>>
>
>Don, before you tag it, can you please add
>   <properties>
>       <scope>compile</scope>
>   </properties>
>to these two?
>
>The project.xml file will get used to generate a pom for Maven 2, and
>the conversion process picks up these hints.  (They don't do anything
>for the Maven 1 build.)
>
>Also, it looks like most of the recent additions have gone in with
>svn:executable, and without svn:eol-style and svn:keywords.
>
>Thanks,
>--
>Wendy
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>For additional commands, e-mail: dev-help@struts.apache.org
>
>  
>


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


Re: svn commit: r353807 - in /struts/scripting/trunk: maven.xml project.xml xdocs/README.xsl xdocs/index.xml xdocs/navigation.xml xdocs/source-guide.xml

Posted by Wendy Smoak <ws...@gmail.com>.
On 12/3/05, mrdon@apache.org <mr...@apache.org> wrote:
> Author: mrdon
> Date: Sat Dec  3 19:51:00 2005
> New Revision: 353807
>
> URL: http://svn.apache.org/viewcvs?rev=353807&view=rev

> +    <!-- The following two dependencies are only used during the build process -->

Don, before you tag it, can you please add
   <properties>
       <scope>compile</scope>
   </properties>
to these two?

The project.xml file will get used to generate a pom for Maven 2, and
the conversion process picks up these hints.  (They don't do anything
for the Maven 1 build.)

Also, it looks like most of the recent additions have gone in with
svn:executable, and without svn:eol-style and svn:keywords.

Thanks,
--
Wendy

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