commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly build.xml
Date Wed, 12 Jun 2002 14:38:57 GMT
jstrachan    2002/06/12 07:38:57

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/werkz
                        ProjectTag.java
               jelly    build.xml
  Added:       jelly/src/test/org/apache/commons/jelly/maven project.jelly
                        maven.jelly
  Log:
  Added example of using a Maven style local project build and then a global (Maven) build,
allowing callbacks to be defined locally in a projects jelly script while still using the
global build options.
  
  It appears to work nicely
  
  Once we move to lazily creating Goal objects and attaching Action objects to the goals in
the GoalTag, then we can move most of this stuff into the Maven.jelly and just define the
callbacks first, then include Maven to do the rest.
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/maven/project.jelly
  
  Index: project.jelly
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- this file represents an optional local project's build -->
  <werkz:project xmlns:j="jelly:core" xmlns="jelly:ant" xmlns:werkz="jelly:werkz">
  
    <!-- now include Maven's build -->
    <j:include uri="maven.jelly"/>
  
    <!-- define some callbacks that will be fired inside the Maven build -->
    <werkz:preGoal name="compile">
   	<echo message="I am a callback: doing something before I compile"/> 	  		
    </werkz:preGoal>
  
    <!-- call all the targets made on the command line -->	
    <werkz:attain>
      <j:forEach var="arg" items="${args}" begin="1">
        <werkz:attainGoal name="${arg}"/>
      </j:forEach>
    </werkz:attain>
    	
    
  </werkz:project>
  
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/maven/maven.jelly
  
  Index: maven.jelly
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- 
    || An example common Maven build mediator
    || This file could exist inside the ${maven.home}/build.jelly 
  -->
    
  <werkz:project xmlns:j="jelly:core" xmlns="jelly:ant" xmlns:werkz="jelly:werkz">
  
    <werkz:goal name="init">
    	<echo message="Initializing the project!"/>
    </werkz:goal>
    		
    <werkz:goal name="compile">
    	<echo message="About to compile the project!"/>
    </werkz:goal>
  
    <werkz:goal name="test">
    	<echo message="About to run the tests!"/>
    </werkz:goal>
  
  
  </werkz:project>
  
  
  
  
  
  
  1.5       +4 -1      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/ProjectTag.java
  
  Index: ProjectTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/ProjectTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProjectTag.java	12 Jun 2002 14:00:40 -0000	1.4
  +++ ProjectTag.java	12 Jun 2002 14:38:57 -0000	1.5
  @@ -106,7 +106,10 @@
        * Evaluate the body to register all the various goals and pre/post conditions
        * then run all the current targets
        */
  -    public void doTag(XMLOutput output) throws Exception {        
  +    public void doTag(XMLOutput output) throws Exception {       
  +        // force project to be lazily constructed        
  +        getProject(); 
  +        
           getBody().run(context, output);
       }
   }
  
  
  
  1.43      +18 -18    jakarta-commons-sandbox/jelly/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/build.xml,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- build.xml	12 Jun 2002 06:07:29 -0000	1.42
  +++ build.xml	12 Jun 2002 14:38:57 -0000	1.43
  @@ -14,15 +14,6 @@
     <!-- Set default values for the build -->
     <property file="project.properties" />
     
  -  <path id="test.classpath">
  -    <pathelement path="${maven.build.dest}"/>
  -    <pathelement path="${maven.src.dir}/java"/>
  -    <pathelement path="${basedir}"/>
  -    <path refid="maven.dependency.classpath"/>
  -    <pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
  -    <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
  -  </path>
  -
     <!-- maven:start -->
     
     <!-- ================================================================== -->
  @@ -191,15 +182,14 @@
   	
   	<target name="compile" depends="maven:compile, maven:jar-resources">
   
  -        <path refid="test.classpath"/>
  -<!--	
   	  <path id="test.classpath">
   	    <pathelement path="${maven.build.dest}"/>
  -        <path refid="maven.dependency.classpath"/>
  -        <pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
  -        <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
  +	    <pathelement path="${maven.src.dir}/java"/>
  +	    <pathelement path="${basedir}"/>
  +	    <path refid="maven.dependency.classpath"/>
  +	    <pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
  +	    <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
   	  </path>
  --->
   	  
         <taskdef
           name="jelly"
  @@ -336,13 +326,13 @@
   	
      </target>
   
  -   <target name="demo.werkz2">
  +   <target name="demo.werkz2" depends="compile">
        <property name="maven.core.callback.post-compile.buildFile" value="build.xml"/>
        <property name="maven.core.callback.post-compile.buildTarget" value="demo.werkz2.callback"/>
        <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="compile"/>
      </target>
   
  -   <target name="demo.werkz2.callback">
  +   <target name="demo.werkz2.callback" depends="compile">
       <java classname="org.apache.commons.jelly.Jelly" fork="yes">
         <classpath refid="test.classpath"/>
         <arg value="src/test/org/apache/commons/jelly/werkz/example.jelly"/> 
  @@ -351,11 +341,21 @@
       </java>
      </target>
   
  -   <target name="demo.werkz" depends="maven:compile" 
  +   <target name="demo.werkz" depends="compile" 
         description="Runs a Werkz sample">
       <java classname="org.apache.commons.jelly.Jelly" fork="yes">
         <classpath refid="test.classpath"/>
         <arg value="src/test/org/apache/commons/jelly/werkz/example.jelly"/> 
  +      <arg value="compile"/> 
  +      <arg value="test"/> 
  +    </java>
  +   </target>
  +
  +   <target name="demo.maven" depends="compile" 
  +      description="Runs a Maven example using Jelly and Werkz">
  +    <java classname="org.apache.commons.jelly.Jelly" fork="yes">
  +      <classpath refid="test.classpath"/>
  +      <arg value="src/test/org/apache/commons/jelly/maven/project.jelly"/> 
         <arg value="compile"/> 
         <arg value="test"/> 
       </java>
  
  
  

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


Mime
View raw message