I've made some progress I think.  In my example, I didn't point out
that I'm only applying the L10N plugin to subprojects.  So I needed to
call my closure on the subproject only - not the root project.

Now I'm getting this - which I don't understand.  Should I descend
from org.gradle.api.plugins.Convention?

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/phil/dev/sag/bas_core/trunk/build.gradle' line: 99

* What went wrong:
A problem occurred evaluating root project 'bas'.
Cause: Cannot cast object
'com.softwareag.bas.plugins.L10NPluginConvention@31cc903c' with class
'com.softwareag.bas.plugins.L10NPluginConvention' to class
'org.gradle.api.plugins.Convention'


On Tue, May 24, 2011 at 4:23 PM, phil swenson <phil.swen...@gmail.com> wrote:
> I have a Plugin Convention such as:
>
> class L10NPluginConvention {
>    String messageOutputFileName, databaseUrl, messageMerge, product,
> userId, projectId, versionId, locales, componentName,
>    resourceInputFileName, resourceOutputFileName, keyPrefix,
> exportTemplate, resourceTemplate, psuedoFilePath,
> localizationOutputPath
>
>    def l10n(Closure closure) {
>        closure.delegate = this
>        closure()
>    }
> }
>
>
> and I apply my plugin here:
>
> public class L10NPlugin implements Plugin<Project> {
>
>    def TASK_GROUP = "L10N (Localization)"
>
>    public void apply(Project project) {
>        def l10nConvention = new L10NPluginConvention()
>        project.convention.plugins.l10n = l10nConvention
>        ExportMessagesTask  exportMessagesTask =
> createExportMessagesTask("exportMessages", project, l10nConvention)
>    }
>
>    private ExportMessagesTask createExportMessagesTask(String name,
> Project project, L10NPluginConvention convention) {
>        ExportMessagesTask exportMessagesTask =
> project.getTasks().add(name, ExportMessagesTask.class)
>        exportMessagesTask.conventionMapping.databaseUrl = {
> convention.databaseUrl }
>        exportMessagesTask.description = "Localization export messages"
>        exportMessagesTask.group = "Localization"
>        return exportMessagesTask
>    }
> }
>
>
> The problem is when I try to configure my plugin in my build.gradle such as:
>
>  project.apply plugin: 'bas-l10n'
>  l10n {
>     databaseUrl = "http://daeg11n1.eur.ad.sag/tamino/Vmsg-dae2";
>  }
>
>
> I get this error when execute my build:
>
> * What went wrong:
> A problem occurred evaluating root project 'bas'.
> Cause: Could not find method l10n() for arguments
> [build_48prs1mcll6m06n2th8aa33mu3$_run_closure3_closure11@65f72a79] on
> root project 'bas'.
>
>
> Any ideas on this?
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to