Author: adc Date: Wed Nov 16 16:06:45 2005 New Revision: 345152 URL: http://svn.apache.org/viewcvs?rev=345152&view=rev Log: Converted asn1-compiler Added: directory/asn1/branches/adc-compiler/asn1-compiler/pom.xml directory/asn1/branches/adc-compiler/asn1-compiler/src/main/ directory/asn1/branches/adc-compiler/asn1-compiler/src/main/antlr/ - copied from r345132, directory/asn1/branches/adc-compiler/asn1-compiler/src/antlr/ directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/ - copied from r345132, directory/asn1/branches/adc-compiler/asn1-compiler/src/java/ directory/asn1/branches/adc-compiler/asn1-compiler/src/main/resources/ directory/asn1/branches/adc-compiler/asn1-compiler/src/main/resources/vm/ - copied from r345132, directory/asn1/branches/adc-compiler/asn1-compiler/src/vm/ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/ - copied from r345132, directory/asn1/branches/adc-compiler/asn1-compiler/src/test/org/ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/resources/ - copied from r345132, directory/asn1/branches/adc-compiler/asn1-compiler/src/test-data/ Removed: directory/asn1/branches/adc-compiler/asn1-compiler/maven.xml directory/asn1/branches/adc-compiler/asn1-compiler/project.properties directory/asn1/branches/adc-compiler/asn1-compiler/project.xml directory/asn1/branches/adc-compiler/asn1-compiler/src/antlr/ directory/asn1/branches/adc-compiler/asn1-compiler/src/java/ directory/asn1/branches/adc-compiler/asn1-compiler/src/test-data/ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/org/ directory/asn1/branches/adc-compiler/asn1-compiler/src/vm/ directory/asn1/branches/adc-compiler/etc/ directory/asn1/branches/adc-compiler/maven.xml directory/asn1/branches/adc-compiler/project.properties directory/asn1/branches/adc-compiler/project.xml Modified: directory/asn1/branches/adc-compiler/ (props changed) directory/asn1/branches/adc-compiler/asn1-compiler/ (props changed) directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/org/apache/asn1/compiler/stages/codegen/CodeGeneratorStage.java directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/CompilerTest.java directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/stages/parser/ASN1SyntaxTest.java directory/asn1/branches/adc-compiler/asn1-runtime/pom.xml directory/asn1/branches/adc-compiler/pom.xml Propchange: directory/asn1/branches/adc-compiler/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Nov 16 16:06:45 2005 @@ -6,3 +6,6 @@ junit*.properties target classes +*.iml +*.ipr +*.iws Propchange: directory/asn1/branches/adc-compiler/asn1-compiler/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Nov 16 16:06:45 2005 @@ -5,3 +5,6 @@ junit*.properties target classes +*.iml +*.ipr +*.iws Added: directory/asn1/branches/adc-compiler/asn1-compiler/pom.xml URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/asn1-compiler/pom.xml?rev=345152&view=auto ============================================================================== --- directory/asn1/branches/adc-compiler/asn1-compiler/pom.xml (added) +++ directory/asn1/branches/adc-compiler/asn1-compiler/pom.xml Wed Nov 16 16:06:45 2005 @@ -0,0 +1,79 @@ + + + + org.apache.asn1 + asn1-root + 1.0-SNAPSHOT + + + 4.0.0 + org.apache.asn1 + asn1-compiler + Apache ASN1 Compiler :: compiler + jar + + + + + + + org.apache.maven.plugins + maven-antlr-plugin + + asn1.g + + + + + generate + + + + + + + + + + + + + antlr + antlr + + + + org.apache.asn1 + asn1-runtime + + + + commons-lang + commons-lang + + + + velocity + velocity + + + + + + + + maven-checkstyle-plugin + + + maven-clover-plugin + + + maven-pmd-plugin + + + maven-project-info-reports-plugin + + + + + Modified: directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/org/apache/asn1/compiler/stages/codegen/CodeGeneratorStage.java URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/org/apache/asn1/compiler/stages/codegen/CodeGeneratorStage.java?rev=345152&r1=345132&r2=345152&view=diff ============================================================================== --- directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/org/apache/asn1/compiler/stages/codegen/CodeGeneratorStage.java (original) +++ directory/asn1/branches/adc-compiler/asn1-compiler/src/main/java/org/apache/asn1/compiler/stages/codegen/CodeGeneratorStage.java Wed Nov 16 16:06:45 2005 @@ -110,8 +110,8 @@ PrintWriter pw = new PrintWriter( out ); - Velocity.mergeTemplate( "copyright.vm", context, pw ); - Velocity.mergeTemplate( "class.vm", context, pw ); + Velocity.mergeTemplate( "vm/copyright.vm", context, pw ); + Velocity.mergeTemplate( "vm/class.vm", context, pw ); pw.flush(); Modified: directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/CompilerTest.java URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/CompilerTest.java?rev=345152&r1=345132&r2=345152&view=diff ============================================================================== --- directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/CompilerTest.java (original) +++ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/CompilerTest.java Wed Nov 16 16:06:45 2005 @@ -16,27 +16,32 @@ */ package org.apache.asn1.compiler; +import java.io.File; import java.util.HashMap; import java.util.Map; + import junit.framework.TestCase; -import org.apache.asn1.compiler.stages.parser.ParseStage; import org.apache.asn1.compiler.stages.codegen.CodeGeneratorStage; +import org.apache.asn1.compiler.stages.parser.ParseStage; + /** * @version $Revision$ $Date: $ */ public class CompilerTest extends TestCase { + private String basedir; public void testLDAP() throws Exception { Compiler compiler = new Compiler(); Map environment = new HashMap(); - environment.put( ParseStage.SRC_URI, "file:./src/test-data/ldap.asn1" ); + System.err.println( basedir ); + environment.put( ParseStage.SRC_URI, Thread.currentThread().getContextClassLoader().getResource( "./ldap.asn1" ).toString() ); environment.put( CodeGeneratorStage.ROOT_PACKAGE, "org.apache.ldap.asn1" ); - environment.put( CodeGeneratorStage.DESTINATION_PATH, "./target/test-code" ); + environment.put( CodeGeneratorStage.DESTINATION_PATH, basedir ); compiler.compile( environment ); } @@ -46,9 +51,9 @@ Compiler compiler = new Compiler(); Map environment = new HashMap(); - environment.put( ParseStage.SRC_URI, "file:./src/test-data/SPNEGO.asn1" ); + environment.put( ParseStage.SRC_URI, Thread.currentThread().getContextClassLoader().getResource( "./SPNEGO.asn1" ).toString() ); environment.put( CodeGeneratorStage.ROOT_PACKAGE, "org.apache.SPNEGO.asn1" ); - environment.put( CodeGeneratorStage.DESTINATION_PATH, "./target/test-code" ); + environment.put( CodeGeneratorStage.DESTINATION_PATH, basedir ); compiler.compile( environment ); } @@ -58,10 +63,17 @@ Compiler compiler = new Compiler(); Map environment = new HashMap(); - environment.put( ParseStage.SRC_URI, "file:./src/test-data/NBAP-25433-530.asn1" ); + environment.put( ParseStage.SRC_URI, Thread.currentThread().getContextClassLoader().getResource( "./NBAP-25433-530.asn1" ).toString() ); environment.put( CodeGeneratorStage.ROOT_PACKAGE, "org.apache.NBAP.asn1" ); - environment.put( CodeGeneratorStage.DESTINATION_PATH, "./target/test-code" ); + environment.put( CodeGeneratorStage.DESTINATION_PATH, basedir ); compiler.compile( environment ); + } + + public void setUp() throws Exception + { + File file = new File( System.getProperty( "basedir" ), "./target/test-code" ); + file.mkdirs(); + basedir = file.getCanonicalPath(); } } Modified: directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/stages/parser/ASN1SyntaxTest.java URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/stages/parser/ASN1SyntaxTest.java?rev=345152&r1=345132&r2=345152&view=diff ============================================================================== --- directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/stages/parser/ASN1SyntaxTest.java (original) +++ directory/asn1/branches/adc-compiler/asn1-compiler/src/test/java/org/apache/asn1/compiler/stages/parser/ASN1SyntaxTest.java Wed Nov 16 16:06:45 2005 @@ -39,7 +39,7 @@ getParser( "FOOBAR { dOOBAR dd(2) 2 } DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::= BEGIN BSTRING ::= BIT STRING END" ).module_definition(); - env = getParser( new File( "./src/test-data/ldap.asn1" ) ).compile(); + env = getParser( new File( Thread.currentThread().getContextClassLoader().getResource( "./ldap.asn1" ).getFile() ) ).compile(); } public void testTypeAssignment() throws Exception Modified: directory/asn1/branches/adc-compiler/asn1-runtime/pom.xml URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/asn1-runtime/pom.xml?rev=345152&r1=345151&r2=345152&view=diff ============================================================================== --- directory/asn1/branches/adc-compiler/asn1-runtime/pom.xml (original) +++ directory/asn1/branches/adc-compiler/asn1-runtime/pom.xml Wed Nov 16 16:06:45 2005 @@ -2,7 +2,7 @@ org.apache.asn1 - root + asn1-root 1.0-SNAPSHOT @@ -15,6 +15,11 @@ + + commons-collections + commons-collections + + commons-lang commons-lang Modified: directory/asn1/branches/adc-compiler/pom.xml URL: http://svn.apache.org/viewcvs/directory/asn1/branches/adc-compiler/pom.xml?rev=345152&r1=345151&r2=345152&view=diff ============================================================================== --- directory/asn1/branches/adc-compiler/pom.xml (original) +++ directory/asn1/branches/adc-compiler/pom.xml Wed Nov 16 16:06:45 2005 @@ -2,9 +2,10 @@ 4.0.0 org.apache.asn1 - root + asn1-root Apache ASN1 Compiler Project 1.0-SNAPSHOT + pom Apache ASN1 Compiler parent http://directory.apache.org/subprojects/asn1 @@ -99,6 +100,7 @@ asn1-runtime + asn1-compiler @@ -134,15 +136,28 @@ - commons-lang - commons-lang - 2.0 + org.apache.asn1 + asn1-runtime + ${version} commons-beanutils commons-beanutils 1.7.0 + + + + commons-collections + commons-collections + 3.1 + runtime + + + + commons-lang + commons-lang + 2.0