Howdy,

Currently, the @Nested task annotation only considers the declared type and not 
the real type. Consider…

interface MarkdownProcessor {
    void markdown(Reader markdown, Writer html)
}

class PegdownMarkdownProcessor implements MarkdownProcessor {
    @Input int options = 0

    void markdown(Reader markdown, Writer html) {
        def processor = new PegDownProcessor(options)
        html << processor.markdownToHtml(markdown.text)
    }
}

class Markdown extends DefaultTask {
    @InputFile File markdown
    @OutputFile File html
    @Input String encoding
    @Nested MarkdownProcessor processor = new PegdownMarkdownProcessor()

    @TaskAction
    void markdown() {
        markdown.withReader(encoding) { markdownReader ->
            html.withWriter(encoding) { htmlWriter ->
                processor.markdown(markdownReader, htmlWriter)
            }
        }
    }

    void processor(Action<MarkdownProcessor> config) {
        config.execute(processor)
    }
}

That's aiming for there being a generic task, with swappable implementations. 
This doesn't work if the different components can have different properties 
that impact incremental build. Is this something we want to support?

It has potential performance implications in that our task introspection is all 
based on the class level. This would mean we'd have to do _some_ per instance 
introspection.

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to