Skip to content

CompilerConfiguration.targetDirectory is null in AST tranformation #575

@ZacharyKlein

Description

@ZacharyKlein

I'm doing some work with an AST transformation, and it appears that when using the Groovy-Eclipse compiler, the targetDirectory property is not being set correctly when the transform is executed. The property is set correctly when the same transform is executed from a Gradle project. The sample project/s attached demonstrates the issue.

Sample project: https://github.com/ZacharyKlein/groovy-ast-demo
AST lib (JAR included in the above project): https://github.com/ZacharyKlein/groovy-ast-lib

@CompileStatic
@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
class GroovyAST implements ASTTransformation, CompilationUnitAware {
    CompilationUnit unit
    @Override
    void visit(ASTNode[] nodes, SourceUnit source) {
        println "targetDirectory: ${source.configuration.targetDirectory}" // null when executed by Groovy-Eclipse compiler
    }

    @Override
    void setCompilationUnit(CompilationUnit unit) {
        this.unit = unit
    }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions