You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2004/02/18 20:25:53 UTC

cvs commit: xml-xmlbeans/v2/test/src/jamtest build.xml

pcal        2004/02/18 11:25:53

  Modified:    v2       build.xml
               v2/src/jam/org/apache/xmlbeans/impl/jam/editable
                        EMember.java
               v2/src/repackage/repackage Repackage.java
               v2/test/src/jamtest build.xml
  Added:       v2/src/jam/org/apache/xmlbeans/impl/jam/internal/parser
                        JavaSourceParser.java
  Log:
  preliminary work on java source parser for jam, adjust repackaging to fix jamdrts as well at antlr templates, re-enable jamdrts
  
  Revision  Changes    Path
  1.36      +24 -18    xml-xmlbeans/v2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/build.xml,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- build.xml	18 Feb 2004 17:48:32 -0000	1.35
  +++ build.xml	18 Feb 2004 19:25:53 -0000	1.36
  @@ -183,9 +183,7 @@
     </target>
   
     <target name='jamdrt'>
  -<!-- FIXME - repackaging issues
       <ant dir='test/src/jamtest' target='all' inheritAll='false' />
  --->
     </target>
   
     <target name="builddrt" depends="drt.jar, random.jar, eric"/>
  @@ -758,28 +756,36 @@
   
     <!-- jam target =============================================== -->
   
  -  <target name="jam.classes" depends="dirs">
  -    <mkdir dir="build/classes/jam"/>
  -    <javac srcdir="src/jam" destdir="build/classes/jam" source="1.4" debug="on">
  +  <target name='jam' depends='jam.parser,jam.compile'/>
  +
  +  <property name='jam_gendir' value='build/generatedsrc'/>
  +
  +  <target name='jam.parser'>
  +    <mkdir dir='${jam_gendir}'/>
  +    <antlr outputdirectory='${jam_gendir}'
  +           target='src/jam/java.g'>
  +       <classpath>
  +         <pathelement location='external/lib/antlr.jar'/>
  +         <pathelement path='${java.class.path}'/>
  +       </classpath>
  +    </antlr>
  +  </target>
  +
  +  <target name='jam.compile' depends='dirs'>
  +    <mkdir dir='build/classes/jam'/>
  +    <javac srcdir='src/jam' destdir='build/classes/jam' source='1.4' debug='on'>
  +      <src path='src/jam'/>
  +      <src path='${jam_gendir}'/>
         <classpath>
  -        <pathelement location="build/classes/configschema"/>
  -        <pathelement location="build/classes/xmlinputstream"/>
  -        <pathelement location="build/classes/xmlpublic"/>
  -        <pathelement location="build/classes/common"/>
  -        <pathelement location="build/classes/repackage"/>
  -        <pathelement location="build/classes/typeimpl"/>
  -        <pathelement location="build/classes/xmlconfig"/>
  -        <pathelement location="build/classes/configschema"/>
  -        <pathelement location="build/classes/toolschema"/>
  -        <pathelement location="build/classes/xsdschema"/>
  +        <pathelement location='external/lib/antlr-runtime.jar'/>
  +        <pathelement path='${java.class.path}'/>
         </classpath>
       </javac>
  -
     </target>
   
     <!-- binding target =============================================== -->
   
  -  <target name="binding.classes" depends="dirs, repackage.classes, typeimpl.classes, xmlpublic.classes, typestore.classes, configschema.classes, xmlcomp.classes, jam.classes, jsr173.jar">
  +  <target name="binding.classes" depends="dirs, repackage.classes, typeimpl.classes, xmlpublic.classes, typestore.classes, configschema.classes, xmlcomp.classes, jam, jsr173.jar">
       <mkdir dir="build/classes/binding"/>
       <javac srcdir="src/binding" destdir="build/classes/binding" source="1.4" debug="on">
         <classpath>
  @@ -1165,7 +1171,7 @@
       </target>
   
       <!-- temporary build utils ... zieg =============
  -    <target name='binding-test' depends='declare-tasks, jam.classes'>
  +    <target name='binding-test' depends='declare-tasks, jam'>
           <mkdir dir='build/private/classes/marshal'/>
           <java2schema
               srcdir='test/cases/marshal'
  
  
  
  1.3       +1 -1      xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/editable/EMember.java
  
  Index: EMember.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/editable/EMember.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EMember.java	12 Feb 2004 20:06:11 -0000	1.2
  +++ EMember.java	18 Feb 2004 19:25:53 -0000	1.3
  @@ -21,7 +21,7 @@
    *
    * @author Patrick Calahan <pc...@bea.com>
    */
  -public interface EMember extends JMember {
  +public interface EMember extends EElement, JMember {
   
     public void setModifiers(int modifiers);
   
  
  
  
  1.1                  xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/parser/JavaSourceParser.java
  
  Index: JavaSourceParser.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  package org.apache.xmlbeans.impl.jam.internal.parser;
  
  import org.apache.xmlbeans.impl.jam.internal.parser.generated.JavaLexer;
  import org.apache.xmlbeans.impl.jam.internal.parser.generated.JavaParser;
  import org.apache.xmlbeans.impl.jam.internal.JamPrinter;
  import org.apache.xmlbeans.impl.jam.editable.EClass;
  import org.apache.xmlbeans.impl.jam.editable.EService;
  import org.apache.xmlbeans.impl.jam.editable.EServiceFactory;
  import org.apache.xmlbeans.impl.jam.editable.EServiceParams;
  
  import java.io.File;
  import java.io.FileReader;
  import java.io.PrintWriter;
  import java.io.Reader;
  
  /**
   *
   * @author Patrick Calahan <pc...@bea.com>
   */
  public class JavaSourceParser {
  
    public static EClass parse(Reader in) throws Exception {
      EServiceFactory esf = EServiceFactory.getInstance();
      EServiceParams params = esf.createServiceParams();
      EService defaultService = esf.createService(params);
      return parse(in,defaultService);
    }
  
    public static EClass parse(Reader in, EService service) throws Exception {
      JavaLexer lexer = new JavaLexer(in);
      JavaParser parser = new JavaParser(lexer);
      parser.setService(service);
      parser.start();
      return parser.getResult();
    }
  
    public static void main(String[] files) {
      try {
        PrintWriter sout = new PrintWriter(System.out);
        for(int i=0; i<files.length; i++) {
          File input = new File(files[i]);
          EClass clazz = parse(new FileReader(input));
          JamPrinter jp = JamPrinter.newInstance();
          jp.print(clazz,sout);
          sout.flush();
        }
      } catch(Exception e) {
        e.printStackTrace();
      }
      System.out.flush();
      System.err.flush();
    }
  
  }
  
  
  
  1.4       +8 -1      xml-xmlbeans/v2/src/repackage/repackage/Repackage.java
  
  Index: Repackage.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/repackage/repackage/Repackage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Repackage.java	12 Feb 2004 20:06:20 -0000	1.3
  +++ Repackage.java	18 Feb 2004 19:25:53 -0000	1.4
  @@ -106,7 +106,14 @@
       {
           if (name.endsWith( ".java" ))
               repackageJavaFile( name );
  -        else if (name.endsWith( ".xsdconfig" ))
  +        else if (name.endsWith( ".xsdconfig" ) ||
  +                (name.endsWith(".xml") &&
  +                //REVIEW skip repackaging the main build file because it
  +                //does some complicated things already and we don't want
  +                //to mess with it right now.  This feels a little gross,
  +                //though.  pcal 2/18/04
  +                !name.equals("build.xml")) ||
  +                name.endsWith(".g") )
               repackageNonJavaFile( name );
           else if (name.startsWith( "bin" + File.separatorChar ))
               repackageNonJavaFile( name );
  
  
  
  1.3       +1 -1      xml-xmlbeans/v2/test/src/jamtest/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/jamtest/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml	18 Feb 2004 02:55:26 -0000	1.2
  +++ build.xml	18 Feb 2004 19:25:53 -0000	1.3
  @@ -1,4 +1,4 @@
  -<project name='jam' default='all' >
  +<project name='jam' default='all' basedir='.'>
   
   <!-- Build file to build and run JAM tests -->
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org