Hi

Just realized that the problem was that the code was running in the
plugin init instead of the task execution so the project was not be
completely set up at that point. I had the usePlugin "eclipse" before
the usePlugin "scala" in the build file, so the order was backwards.

So, I guess it almost works. However, because the eclipse plugin seems
to do its checking at init time instead of task execution time, it can
fail to properly detect the scala plugin if usePlugin "eclipse" comes
before usePlugin "scala". Presumably the scala plugin detection needs
to move from the initialization to the task execution, I suppose
effectively moving the setProjectType from configureEclipseProject()
in EclipsePlugin to generateProject in EclipseProject?

thanks
Philip



On Mon, Nov 23, 2009 at 1:56 PM, Philip Crotwell <[email protected]> wrote:
> Hi
>
> Is there a way to tell if a project uses a plugin?
>
> I tried
> project.getPlugins().hasPlugin(ScalaPlugin.class)
> but get always get false regardless. It is false even if I am inside
> the executing ecplise plugin and do a hasPlugin(EclipsePlugin.class).
>
> Perhaps a related question, why is the plugin container passed as an
> arg to Plugin.use() if it is accessuble via Project.getPlugins()? The
> second argument seems redundant, unless the Project.getPlugins() is
> not functional.
> void use(Project project,
>         ProjectPluginsContainer projectPluginsHandler)
>
> My goal is to modify the EclipsePlugin in order to add the "scala
> nature" to eclipse projects if usePlugin "scala" is in the build file.
> Attached is a patch that shows what I have tried (along with some
> printlns), but this doesn't work as the hasPlugin returns false.
>
> I have created a issue for this and will upload my patch if/when I
> figure out the hasPlugin issue.
> http://jira.codehaus.org/browse/GRADLE-751
>
> Gradle 0.9-20091123133702-0500
>
> thanks,
> Philip
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to