Closed jponge closed 9 years ago
For the sake of exhaustiveness, switching back to the current Maven layout:
src/main/jjtree
└── Golo.jjt
src/main/java/
├── fr
│ └── insalyon
│ └── citi
│ └── golo
│ ├── cli
│ │ ├── Main.java
│ │ ├── command
│ │ │ ├── CompilerCommand.java
│ │ │ ├── DiagnoseCommand.java
│ │ │ ├── DocCommand.java
│ │ │ ├── GoloGoloCommand.java
│ │ │ ├── InitCommand.java
│ │ │ ├── Metadata.java
│ │ │ ├── RunCommand.java
│ │ │ ├── VersionCommand.java
│ │ │ └── spi
│ │ │ └── CliCommand.java
│ │ └── package-info.java
│ ├── compiler
│ │ ├── ClosureCaptureGoloIrVisitor.java
│ │ ├── CodeGenerationResult.java
│ │ ├── GoloClassLoader.java
│ │ ├── GoloCompilationException.java
│ │ ├── GoloCompiler.java
│ │ ├── JavaBytecodeGenerationGoloIrVisitor.java
│ │ ├── JavaBytecodeStructGenerator.java
│ │ ├── JavaBytecodeUnionGenerator.java
│ │ ├── JavaBytecodeUtils.java
│ │ ├── LocalReferenceAssignmentAndVerificationVisitor.java
│ │ ├── PackageAndClass.java
│ │ ├── ParseTreeToGoloIrVisitor.java
│ │ ├── ir
│ │ │ ├── AbstractInvocation.java
│ │ │ ├── AssignmentStatement.java
│ │ │ ├── BinaryOperation.java
│ │ │ ├── Block.java
│ │ │ ├── ClosureReference.java
│ │ │ ├── CollectionLiteral.java
│ │ │ ├── ConditionalBranching.java
│ │ │ ├── ConstantStatement.java
│ │ │ ├── Decorator.java
│ │ │ ├── ExpressionStatement.java
│ │ │ ├── FunctionInvocation.java
│ │ │ ├── GoloElement.java
│ │ │ ├── GoloFunction.java
│ │ │ ├── GoloIrVisitor.java
│ │ │ ├── GoloModule.java
│ │ │ ├── GoloStatement.java
│ │ │ ├── IrTreeDumper.java
│ │ │ ├── LocalReference.java
│ │ │ ├── LoopBreakFlowStatement.java
│ │ │ ├── LoopStatement.java
│ │ │ ├── MethodInvocation.java
│ │ │ ├── ModuleImport.java
│ │ │ ├── NamedArgument.java
│ │ │ ├── PositionInSourceCode.java
│ │ │ ├── ReferenceLookup.java
│ │ │ ├── ReferenceTable.java
│ │ │ ├── ReturnStatement.java
│ │ │ ├── Struct.java
│ │ │ ├── ThrowStatement.java
│ │ │ ├── TryCatchFinally.java
│ │ │ ├── UnaryOperation.java
│ │ │ ├── Union.java
│ │ │ └── package-info.java
│ │ ├── package-info.java
│ │ ├── parser
│ │ │ ├── ASTAdditiveExpression.java
│ │ │ ├── ASTAndExpression.java
│ │ │ ├── ASTAnonymousFunctionInvocation.java
│ │ │ ├── ASTArgument.java
│ │ │ ├── ASTAssignment.java
│ │ │ ├── ASTAugmentDeclaration.java
│ │ │ ├── ASTBlock.java
│ │ │ ├── ASTBreak.java
│ │ │ ├── ASTCase.java
│ │ │ ├── ASTCollectionLiteral.java
│ │ │ ├── ASTConditionalBranching.java
│ │ │ ├── ASTContinue.java
│ │ │ ├── ASTDecoratorDeclaration.java
│ │ │ ├── ASTDestructuringAssignment.java
│ │ │ ├── ASTEqualityExpression.java
│ │ │ ├── ASTForEachLoop.java
│ │ │ ├── ASTForLoop.java
│ │ │ ├── ASTFunction.java
│ │ │ ├── ASTFunctionDeclaration.java
│ │ │ ├── ASTFunctionInvocation.java
│ │ │ ├── ASTImportDeclaration.java
│ │ │ ├── ASTInvocationExpression.java
│ │ │ ├── ASTLetOrVar.java
│ │ │ ├── ASTLiteral.java
│ │ │ ├── ASTMethodInvocation.java
│ │ │ ├── ASTModuleDeclaration.java
│ │ │ ├── ASTMultiplicativeExpression.java
│ │ │ ├── ASTNamedAugmentationDeclaration.java
│ │ │ ├── ASTOrExpression.java
│ │ │ ├── ASTOrIfNullExpression.java
│ │ │ ├── ASTReference.java
│ │ │ ├── ASTRelationalExpression.java
│ │ │ ├── ASTReturn.java
│ │ │ ├── ASTStructDeclaration.java
│ │ │ ├── ASTThrow.java
│ │ │ ├── ASTTryCatchFinally.java
│ │ │ ├── ASTUnaryExpression.java
│ │ │ ├── ASTUnionDeclaration.java
│ │ │ ├── ASTUnionValue.java
│ │ │ ├── ASTWhileLoop.java
│ │ │ ├── GoloASTNode.java
│ │ │ ├── GoloOffsetParser.java
│ │ │ ├── GoloOffsetParserTokenManager.java
│ │ │ ├── GoloTokenBase.java
│ │ │ ├── JavaOffsetCharStream.java
│ │ │ ├── NamedNode.java
│ │ │ └── package-info.java
│ │ └── utils
│ │ ├── AbstractRegister.java
│ │ ├── NamingUtils.java
│ │ ├── Register.java
│ │ ├── StringBlockIndenter.java
│ │ ├── StringUnescaping.java
│ │ └── package-info.java
│ ├── doc
│ │ ├── AbstractProcessor.java
│ │ ├── AugmentationDocumentation.java
│ │ ├── CtagsProcessor.java
│ │ ├── DocumentationElement.java
│ │ ├── FunctionDocumentation.java
│ │ ├── HtmlProcessor.java
│ │ ├── MarkdownProcessor.java
│ │ ├── ModuleDocumentation.java
│ │ ├── NamedAugmentationDocumentation.java
│ │ ├── StructDocumentation.java
│ │ ├── UnionDocumentation.java
│ │ └── package-info.java
│ └── runtime
│ ├── AmbiguousFunctionReferenceException.java
│ ├── ArrayHelper.java
│ ├── ArrayMethodFinder.java
│ ├── AugmentationMethodFinder.java
│ ├── ClassReferenceSupport.java
│ ├── ClosureCallSupport.java
│ ├── ClosureReferenceSupport.java
│ ├── DecoratorsHelper.java
│ ├── FunctionCallSupport.java
│ ├── MethodFinder.java
│ ├── MethodInvocationSupport.java
│ ├── Module.java
│ ├── OperatorSupport.java
│ ├── OperatorType.java
│ ├── PrimitiveArrayIterator.java
│ ├── RegularMethodFinder.java
│ ├── TypeMatching.java
│ ├── adapters
│ │ ├── AdapterDefinition.java
│ │ ├── AdapterDefinitionProblem.java
│ │ ├── AdapterSupport.java
│ │ ├── JavaBytecodeAdapterGenerator.java
│ │ └── package-info.java
│ └── package-info.java
└── gololang
├── AbstractRange.java
├── AdapterFabric.java
├── CharRange.java
├── DynamicObject.java
├── DynamicVariable.java
├── EvaluationEnvironment.java
├── FunctionReference.java
├── GoloAdapter.java
├── GoloStruct.java
├── HeadTail.java
├── HeadTailIterator.java
├── IntRange.java
├── LazyList.java
├── LongRange.java
├── Observable.java
├── Predefined.java
├── Range.java
├── TemplateEngine.java
├── Tuple.java
├── annotations
│ ├── DecoratedBy.java
│ └── package-info.java
├── concurrent
│ ├── async
│ │ ├── AssignedFuture.java
│ │ ├── Future.java
│ │ ├── Promise.java
│ │ └── package-info.java
│ └── workers
│ ├── Port.java
│ ├── WorkerEnvironment.java
│ ├── WorkerFunction.java
│ └── package-info.java
└── package-info.java
19 directories, 176 files
And with this build:
plugins {
id "ca.coglinc.javacc" version "2.2.0"
}
apply plugin: 'java'
apply plugin: 'maven'
repositories {
jcenter()
}
group = 'org.eclipse.golo'
version = '3.0.0-SNAPSHOT'
description = 'Golo Programming Language (Incubation)'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJavacc {
include '**/*.java'
}
dependencies {
compile group: 'org.ow2.asm', name: 'asm', version:'5.0.4'
compile(group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1') {
exclude(module: 'junit')
}
compile group: 'com.beust', name: 'jcommander', version:'1.48'
compile group: 'com.github.rjeschke', name: 'txtmark', version:'0.13'
testCompile group: 'org.ow2.asm', name: 'asm-util', version:'5.0.4'
testCompile group: 'org.ow2.asm', name: 'asm-analysis', version:'5.0.4'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version:'1.3'
testCompile group: 'org.skyscreamer', name: 'jsonassert', version:'1.2.3'
testCompile(group: 'org.testng', name: 'testng', version:'6.9.4') {
exclude(module: 'junit')
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.5'
description 'Generates the Gradle wrapper scripts'
}
...then I get the same error:
$ ./gradlew clean compileJava
:clean
:compileJjtree
Java Compiler Compiler Version 6.1_2 (Tree Builder)
(type "jjtree" with no arguments for help)
Reading from file /Users/jponge/Code/gololang/src/main/jjtree/Golo.jjt . . .
opt:java
File "Node.java" does not exist. Will create one.
File "SimpleNode.java" does not exist. Will create one.
File "ASTerror.java" does not exist. Will create one.
File "ASTCompilationUnit.java" does not exist. Will create one.
File "ASTModuleDeclaration.java" does not exist. Will create one.
File "ASTImportDeclaration.java" does not exist. Will create one.
File "ASTToplevelDeclaration.java" does not exist. Will create one.
File "ASTStructDeclaration.java" does not exist. Will create one.
File "ASTUnionValue.java" does not exist. Will create one.
File "ASTUnionDeclaration.java" does not exist. Will create one.
File "ASTNamedAugmentationDeclaration.java" does not exist. Will create one.
File "ASTAugmentDeclaration.java" does not exist. Will create one.
File "ASTFunctionDeclaration.java" does not exist. Will create one.
File "ASTDecoratorDeclaration.java" does not exist. Will create one.
File "ASTContinue.java" does not exist. Will create one.
File "ASTBreak.java" does not exist. Will create one.
File "ASTThrow.java" does not exist. Will create one.
File "ASTWhileLoop.java" does not exist. Will create one.
File "ASTForLoop.java" does not exist. Will create one.
File "ASTForEachLoop.java" does not exist. Will create one.
File "ASTTryCatchFinally.java" does not exist. Will create one.
File "ASTExpressionStatement.java" does not exist. Will create one.
File "ASTUnaryExpression.java" does not exist. Will create one.
File "ASTInvocationExpression.java" does not exist. Will create one.
File "ASTMultiplicativeExpression.java" does not exist. Will create one.
File "ASTAdditiveExpression.java" does not exist. Will create one.
File "ASTRelationalExpression.java" does not exist. Will create one.
File "ASTEqualityExpression.java" does not exist. Will create one.
File "ASTAndExpression.java" does not exist. Will create one.
File "ASTOrExpression.java" does not exist. Will create one.
File "ASTOrIfNullExpression.java" does not exist. Will create one.
File "ASTMethodInvocation.java" does not exist. Will create one.
File "ASTBlock.java" does not exist. Will create one.
File "ASTFunction.java" does not exist. Will create one.
File "ASTLiteral.java" does not exist. Will create one.
File "ASTCollectionLiteral.java" does not exist. Will create one.
File "ASTReference.java" does not exist. Will create one.
File "ASTDestructuringAssignment.java" does not exist. Will create one.
File "ASTLetOrVar.java" does not exist. Will create one.
File "ASTAssignment.java" does not exist. Will create one.
File "ASTReturn.java" does not exist. Will create one.
File "ASTArgument.java" does not exist. Will create one.
File "ASTAnonymousFunctionInvocation.java" does not exist. Will create one.
File "ASTFunctionInvocation.java" does not exist. Will create one.
File "ASTConditionalBranching.java" does not exist. Will create one.
File "ASTCase.java" does not exist. Will create one.
File "ASTMatch.java" does not exist. Will create one.
File "GoloParserTreeConstants.java" does not exist. Will create one.
File "GoloParserVisitor.java" does not exist. Will create one.
File "GoloParserDefaultVisitor.java" does not exist. Will create one.
File "JJTGoloParserState.java" does not exist. Will create one.
Annotated grammar generated successfully in /Users/jponge/Code/gololang/build/generated/jjtree/Golo.jj
:compileJavacc
Java Compiler Compiler Version 6.1_2 (Parser Generator)
(type "javacc" with no arguments for help)
Reading from file /Users/jponge/Code/gololang/build/generated/jjtree/Golo.jj . . .
Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
File "TokenMgrError.java" does not exist. Will create one.
File "ParseException.java" does not exist. Will create one.
File "Token.java" does not exist. Will create one.
File "JavaCharStream.java" does not exist. Will create one.
Parser generated successfully.
:compileJavacc FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJavacc'.
> Could not copy file /Users/jponge/Code/gololang/build/generated/jjtree/ASTAdditiveExpression.java to /Users/jponge/Code/gololang/build/generated/jjtree/ASTAdditiveExpression.java
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.495 secs
coogee:gololang jponge$
Ok, I think I got it, sorry, I'm not familiar with the use of JJTree. As of 2.2.1, I only added support for custom classes in the compileJavacc task. Will add this support for compileJjtree as well.
Is it possible for you to please provide a minimal .jjt file that produces a few .java files along with the .jj grammar file, so that I can use that in my acceptance tests?
You can use 2.2.2, which fixes your issue, here is the build file (just slightly different from yours):
plugins {
id 'eclipse'
id 'java'
id 'maven'
id 'ca.coglinc.javacc' version '2.2.2'
}
repositories {
jcenter()
}
group = 'org.eclipse.golo'
version = '3.0.0-SNAPSHOT'
description = 'Golo Programming Language (Incubation)'
sourceCompatibility = 1.8
targetCompatibility = 1.8
eclipse {
project {
name = 'golo-lang'
}
}
sourceSets {
main {
java {
srcDir compileJjtree.outputDirectory
srcDir compileJavacc.outputDirectory
}
}
}
eclipseClasspath.dependsOn("compileJavacc")
dependencies {
compile group: 'org.ow2.asm', name: 'asm', version:'5.0.4'
compile(group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1') {
exclude(module: 'junit')
}
compile group: 'com.beust', name: 'jcommander', version:'1.48'
compile group: 'com.github.rjeschke', name: 'txtmark', version:'0.13'
testCompile group: 'org.ow2.asm', name: 'asm-util', version:'5.0.4'
testCompile group: 'org.ow2.asm', name: 'asm-analysis', version:'5.0.4'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version:'1.3'
testCompile group: 'org.skyscreamer', name: 'jsonassert', version:'1.2.3'
testCompile(group: 'org.testng', name: 'testng', version:'6.9.4') {
exclude(module: 'junit')
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.5'
description 'Generates the Gradle wrapper scripts'
}
You will notice that there is no compileJavacc configuration necessary, as your custom AST classes are in the Java source set.
You also need to put the .jjt file inside its package, as such:
src/main/jjtree/fr/insalyon/citi/golo/compiler/parser/Golo.jjt
:+1: many thanks @johnmartel :smiley:
Works like a charm.
I find using the support for custom classes with JJTree difficult.
Based on the current layout of
org.eclipse.golo
, I tried making a rudimentary Gradle build.My Gradle build contains:
The
.jjt
file that I am using with Maven sits undersrc/main/jjtree
. I now have moved it to its package namespace, thinking that perhaps this would help the plugin find my custom classes (they sit undersrc/main/java
):This didn't work much better, so I moved the custom classes (a package actually) to
src/main/javacc
:And then the build fails, because it tries copying a generated file to itself :smiley:
Any idea of where I'm wrong?
Thanks!