jstrachan    2002/06/11 03:28:01

  Modified:    src/bin  example-userbuild.jelly mediator.jelly
  Log:
  Added some example scripts for how Jelly could be used as a possible Ant-XML-like 
declarative language
  for specifying user callbacks as well as a possible mediator implementation using 
Werkz. 
  
  Using Jelly for the mediator is probably the more controversial option. Certainly I 
don't expect James T to vote for this ;-).
  Though as a user defined callback definition mechanism it certainly looks like a 
possibility
  
  Revision  Changes    Path
  1.3       +3 -4      jakarta-turbine-maven/src/bin/example-userbuild.jelly
  
  Index: example-userbuild.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/bin/example-userbuild.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- example-userbuild.jelly   11 Jun 2002 07:50:47 -0000      1.2
  +++ example-userbuild.jelly   11 Jun 2002 10:28:01 -0000      1.3
  @@ -12,6 +12,9 @@
     xmlns:j="jelly:core"
     xmlns:maven="jelly:maven">
   
  +  <!-- call Maven to define all the core targets and create the variables, POM 
beans etc --> 
  +  <maven:include uri="${maven.home}/mediator.jelly"/>
  +  
     <!-- 
       || Create all the callbacks using the Maven/Wertz tag library.
       ||
  @@ -36,8 +39,4 @@
       </delete>
     </maven:postAction>                
   
  -
  -  <!-- now call Maven to do all the work and to call whatever targets need to be 
run -->     
  -  <j:import uri="${maven.home}/build.jelly"/>
  -  
   </j:jelly>
  
  
  
  1.2       +59 -46    jakarta-turbine-maven/src/bin/mediator.jelly
  
  Index: mediator.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/bin/mediator.jelly,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mediator.jelly    10 Jun 2002 14:17:48 -0000      1.1
  +++ mediator.jelly    11 Jun 2002 10:28:01 -0000      1.2
  @@ -1,56 +1,69 @@
  +<?xml version="1.0"?>
  +
   <!--
     ||   An example mediator file
     -->
  -<j:jelly
  -  trim="true"
  -  xmlns:ant="jelly:ant"
  -  xmlns:jelly="jelly:core"
  -  xmlns:util="maven:util"
  -  xmlns:maven="jelly:org.apache.maven.jelly.MavenTagLibrary">
  +<maven:maven
  +  xmlns="jelly:ant"
  +  xmlns:j="jelly:core"
  +  xmlns:maven="jelly:maven">
     
     <!-- 
  -    || Initializes Maven, creates the variables etc
  -    || export the POM as a variable that we can use to populate 
  -    || maven-beans or Ant Tasks or Jelly tags
  +    || By this point Maven will be initialized, all the POM parsed etc.
  +    || Now we can use Jexl as the expression language to access all properties
  +    || as well as to access POM beans via the Velcity-style ${foo.bar} expresssion 
language.
  +    ||
  +    || So here we may import propoerties files from the users directory etc.
     -->
  -  <maven:init var="pom"/>
  +
  +  <!-- Allow any user specific values to override the defaults -->  
  +  <property file="${user.home}/build.properties" />
  +  
  +  <!-- Allow user defaults for this project -->
  +  <property file="${project.home}/build.properties" />
  +  
  +  <!-- Set default values for the build -->
  +  <property file="${project.home}/project.properties" />
  +  
     
     <!--
  -    || now lets process all the arguments
  +    || now lets define all the Maven targets
  +    || which could use Werkz under neath the covers to allow
  +    || a flexible way of registering callbacks
     -->
  -  <j:forEach 
  -    var="target"
  -    items="${args}"
  -    begin="1">
  -    
  -     <!-- It'd be cleaner to have a <mavem:target> tag -->
  -         
  -    <j:choose>
  -       <j:when test="${target=='compile'}>
  -
  -             <!-- check dependencies -->
  -             <maven:check type="compile"/>
  -             
  -             <!-- compile target -->
  -             <ant:javac 
  -           srcdir="${pom.build.sourceDirectory}"
  -               destdir="${pom.properties['maven.build.dest]}"
  -               excludes="**/package.html"
  -               debug="${pom.properties['maven.compile.debug']}"
  -               deprecation="${pom.properties['maven.compile.deprecation']}"
  -               optimize="${pom.properties['maven.compile.optimize']}">
  -               <classpath>
  -             <path refid="maven.dependency.classpath"/>
  -             <pathelement path="${pom.build.dest}"/>
  -               </classpath>
  -     </ant:javac>
  -       </j:when>
  -             
  -       <j:otherwise>
  -         Unknown target ${target}
  -       </j:otherwise>
  -    </j:choose>
  -    
  -  </j:forEach>
  +
  +  <maven:target name="compile">
     
  -</j:jelly>
  +     <!-- 
  +       || notice this stuff can just be cut and pasted from existing build files
  +       || though we can also access the POM beans as well to configure Ant tasks or 
maven beans
  +     -->
  +     
  +     <javac 
  +      srcdir="${pom.build.sourceDirectory}"
  +       destdir="${maven.build.dest}"
  +       excludes="**/package.html"
  +       debug="${maven.compile.debug}"
  +       deprecation="${maven.compile.deprecation}"
  +       optimize="${maven.compile.optimize'}">
  +       <classpath>
  +     <path refid="maven.dependency.classpath"/>
  +             <pathelement path="${pom.build.dest}"/>
  +       </classpath>
  +     </javac>
  +             
  +  </maven:target>
  +
  +
  +  <maven:target name="some-funky-plugin">
  +
  +     <!--
  +       || some external plugins can be moved into seperate build files
  +       || though this file should be pretty small anyways as it doesn't contain
  +       || all the callback-stuff. So most plugins could just be included in this 
file
  +     -->
  +     <j:include uri="${maven.home}/plugins/funky/build.jelly"/>
  +     
  +  </maven:target>
  +      
  +</maven:maven>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to