jvanzyl     2002/07/10 18:41:44

  Modified:    src/bin  driver.jelly
  Log:
  o Adding the sourceDirectory and unitTestSourceDirectory checks to the
    driver.
  
  o There is the start of the little dynamic tag library in here as well
    but by default dynamic tags do not inherit or export from/to the
    parent context so they are a little isolationist! We'll sort that
    out in Jelly. Bob had the same problem when getting werkz going
    so we'll figure it out.
  
  Revision  Changes    Path
  1.11      +82 -7     jakarta-turbine-maven/src/bin/driver.jelly
  
  Index: driver.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/bin/driver.jelly,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- driver.jelly      9 Jul 2002 23:15:00 -0000       1.10
  +++ driver.jelly      11 Jul 2002 01:41:44 -0000      1.11
  @@ -1,17 +1,42 @@
   <project
     xmlns:j="jelly:core"
     xmlns:define="jelly:define"
  -  xmlns:m="maven">
  -  
  +  xmlns:m="maven"
  +  xmlns:f="foo">
  +
  +  <j:set var="dir" value="${pom.build.sourceDirectory}X"/>
  +  <j:if test="${dir != 'X'}">
  +    <available
  +      property="sourcesPresent"
  +      file="${pom.build.sourceDirectory}"
  +    />
  +  </j:if>
  +
  +  <j:set var="dir" value="${pom.build.unitTestSourceDirectory}X"/>
  +  <j:if test="${dir != 'X'}">
  +    <available
  +      property="unitTestSourcesPresent"
  +      file="${pom.build.unitTestSourceDirectory}"
  +    />
  +  </j:if>
  +
     <!-- ================================================================== -->
  -  <!-- U S E R N A M E  C H E C K                                         -->
  +  <!-- M A V E N  T A G  L I B R A R Y                                    -->
     <!-- ================================================================== -->
  -  <!-- For several goals we need to make sure that Maven can grab         -->
  -  <!-- hold of a valid username. For deployment goals in particular       -->
  -  <!-- where Maven needs to upload an artifact to a server.               -->
  +  <!-- A collection of dynamic tag libraries that make writing            -->
  +  <!-- plugins convenient.                                                -->
     <!-- ================================================================== -->
  -    
  +
     <define:taglib uri="maven">
  +    
  +    <!-- ================================================================== -->
  +    <!-- U S E R N A M E  C H E C K                                         -->
  +    <!-- ================================================================== -->
  +    <!-- For several goals we need to make sure that Maven can grab         -->
  +    <!-- hold of a valid username. For deployment goals in particular       -->
  +    <!-- where Maven needs to upload an artifact to a server.               -->
  +    <!-- ================================================================== -->
  +    
       <define:tag name="user-check">
         <j:set var="tmp" value="${user}"/>
         <j:if test="${tmp.equals('USERNAME_NOT_SET')}">
  @@ -28,6 +53,56 @@
           </fail>
         </j:if>
       </define:tag>
  +
  +    <!-- ================================================================== -->
  +    <!-- D I R E C T O R Y  C H E C K                                       -->
  +    <!-- ================================================================== -->
  +
  +    <define:tag name="check-directory">
  +      
  +      <j:set var="dirX" value="${dir}X"/>
  +      <j:if test="${dirX != 'X'}">
  +        <j:set var="propertyName" value="${property}"/>
  +
  +        <fileScanner var="scanner">
  +          <fileset dir="${dir}" includes="${includes}"/>
  +        </fileScanner>
  +
  +        <j:if test="${scanner.hasFiles()}">
  +          ${context.parent.setVariable(property, true)}
  +        </j:if>
  +      </j:if>
  +    </define:tag>
  +
  +    <!-- ================================================================== -->
  +    <!-- S O U R C E S  T A G                                               -->
  +    <!-- ================================================================== -->
  +    <!-- Looks at the POM's source directory entry and if it's present      -->
  +    <!-- the body defined inside the tag will be execute.                   -->
  +    <!-- ================================================================== -->
  +
  +    <define:tag name="sources">
  +      
  +      <j:set var="dir" 
value='${context.parent.getVariable("pom").build.sourceDirectory}'/>
  +      
  +      <j:choose>
  +        <j:when test="${sourcesPresent}">
  +          <define:invokeBody/>
  +        </j:when>
  +        <j:otherwise>
  +          <m:check-directory 
  +            dir="${dir}" 
  +            includes="**/*.java"
  +            property="sourcesPresent"
  +          />
  +          <j:if test="${sourcesPresent}">
  +            <define:invokeBody/>
  +          </j:if>
  +        </j:otherwise>
  +      </j:choose>
  +    </define:tag>
  +  
     </define:taglib>
  +  
   </project>
   
  
  
  

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

Reply via email to