More Advice on plugin architecture

(thirsch81) #1

When I have code like this in a plugin:

def instantiateXltConfiguration = { String name ->, name, project)
  def instantiateXltTransaction = { String name ->, name, project)
  xlt {
    extensions.create "installation", XltInstallation, project
    extensions.create "mastercontroller", XltMasterController, project
    extensions.create "reportgenerator", XltReportGenerator, project
    extensions.create "testsuite", XltTestsuite, project
    extensions.create "test", XltTest, project
    extensions.configurations = container XltConfiguration, instantiateXltConfiguration
    extensions.configRepo = container XltConfiguration, instantiateXltConfiguration
      mastercontroller.extensions.create "configuration", XltConfiguration, "configuration", project
    reportgenerator.extensions.create "configuration", XltConfiguration, "configuration", project
      extensions.agents = container XltConfiguration, instantiateXltConfiguration
    test.extensions.transactions = container XltTransaction, instantiateXltTransaction

What I would like is to show this structure in some generated documentation like groovydoc. Would there be way to implement it into the domain classes, so it just show up in the docs?

Also with code like this:

task("copyLibs", group: "Build", type: Sync) {
    dependsOn compileJava
    project.afterEvaluate {
        from sourceSets.main.runtimeClasspath
 include "**/*.jar"
 into xlt.testsuite.libDir

I figured I would need the afterEvaluate so if the testsuiteLibDir gets reconfigured after the plugin being applied, this would still have the correct value. Am I missing something when resorting to this? Would it be better to have the task be created inside the domain class, e.g. XltTestsuite, that knows about the directories? The plugin code is here, if you would like to take a look: Thanks again for advice!