groovy / groovy/groovy-eclipse

Add option to New Groovy Project wizard for compiler config script

Open
#610 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Filling in name (and project-relative path) would create the script in the proper location with the following stub code:

withConfig(configuration) {
  |
}

Project preference linking the config script to the builder would be set. And the destination would be confirmed to not be within a project source folder.

Supporting DSLD could be added to org.codehaus.groovy2x/plugin_dsld_support/dsld/. Here is some partial descriptor code:

def configBlock = { -> enclosingCall(name('withConfig') & hasArgument('configuration')) & inClosure() & isThisType() }

contribute(configBlock()) {
  provider = '{@link org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder CompilerCustomizationBuilder}'

  method(name:'imports', type:void, params:[block:Closure])
  method(name:'ast', type:void, params:[xform:'Class<? extends Annotation>'], optionalParams:[attributes:Map])
  method(name:'customizers', type:void, params:[customizers:'Collection<org.codehaus.groovy.control.customizers.CompilationCustomizer>'])
  method(name:'inline', type:void, params:[code:Closure], namedParams:[phase:String], optionalParams:[superClass:Class, interfaces:Class[]], provider:'org.codehaus.groovy.control.customizers.builder.InlinedASTCustomizerFactory')

  method  name: 'source',
          type: void,
          params: [block: Closure],
          optionalParams: [
            basename: String,
            basenames: String[],
            basenameValidator: 'Closure<Boolean>', //params:[String]
            extension: String,
            extensions: String[],
            extensionValidator: 'Closure<Boolean>', //params:[String]
            unitValidator: 'Closure<Boolean>', //params:[SourceUnit]
            classValidator: 'Closure<Boolean>' //params:[ClassNode]
          ]
  //org.codehaus.groovy.control.customizers.builder.SourceAwareCustomizerFactory
  //secureAst org.codehaus.groovy.control.customizers.builder.SecureASTCustomizerFactory
}

contribute(configBlock() & enclosingCallName('imports')) {
  provider = '{@link org.codehaus.groovy.control.customizers.builder.ImportCustomizerFactory ImportCustomizerFactory}'
  setDelegateType(  'org.codehaus.groovy.control.customizers.builder.ImportCustomizerFactory.ImportHelper')
}

contribute(configBlock() & enclosingCallName('ast')) {
  provider = '{@link org.codehaus.groovy.control.customizers.builder.ASTTransformationCustomizerFactory ASTTransformationCustomizerFactory}'
  setDelegateType(  'org.codehaus.groovy.control.customizers.ASTTransformationCustomizer')
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the New Groovy Project wizard and inspect how project preferences link scripts to the builder. Review org.codehaus.groovy2x/plugin_dsld_support/dsld/ and the partial descriptor in the issue. Done means the wizard creates the requested script with the stub, links it to the builder, rejects project source-folder destinations, and optionally provides DSLD support.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.