Expose library dependencies for griffon projects via the tooling api

As reported by one of IntelliJ IDEA users:

When I create a vanilla griffon project using griffon 1.3 doing:
 1. griffon create-app myApp
 2. griffon integrate-with --gradle
 3. startup intellij and opening the build.gradle
Intellij can't see that griffon is a declared dependency and asks for me to add it manually.

Target build.gradle looks as below:

buildscript {
    repositories {
        mavenCentral()
        mavenRepo name: 'Codehaus',
     url: 'http://repository.codehaus.org'
        mavenRepo name: 'SpringSource',
 url: 'http://repository.springsource.com/maven/bundles/release'
        mavenRepo name: 'Sonaytpe',
     url: 'http://repository.sonatype.org/content/groups/public'
        mavenRepo name: 'Grails Central', url: 'http://repo.grails.org/grails/core/'
        mavenRepo name: 'JavaNet',
      url: 'http://download.java.net/maven/2/'
    }
      dependencies {
        classpath('org.codehaus.griffon:gradle-griffon-plugin:1.1.0')
        classpath('org.codehaus.griffon:griffon-scripts:1.3.0')
    }
}
  ext.griffonVersion = '1.3.0'
version = '0.1'
  apply plugin: 'griffon'
  repositories {
    mavenLocal()
    mavenCentral()
    mavenRepo name: 'Codehaus', url: 'http://repository.codehaus.org/'
}
  dependencies {
    compile("org.codehaus.griffon:griffon-rt:$griffonVersion")
    compile("dk.flight.information:flightInformation:1.0")
}

A simple program below illustrates that no information about compile dependencies is exposed via the tooling api:

package org.denis;
  import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ModelBuilder;
import org.gradle.tooling.ProjectConnection;
import org.gradle.tooling.internal.consumer.DefaultGradleConnector;
import org.gradle.tooling.model.idea.IdeaDependency;
import org.gradle.tooling.model.idea.IdeaModule;
import org.gradle.tooling.model.idea.IdeaProject;
  import java.io.File;
  /**
 * @author Denis Zhdanov
 * @since 7/23/13 3:10 PM
 */
public class Test {
    public static void main(String[] args) {
        File file = new File("/home/denis/Downloads");
        GradleConnector connector = GradleConnector.newConnector();
        DefaultGradleConnector c = (DefaultGradleConnector) connector;
//
      c.embedded(true);
        c.setVerboseLogging(true);
        connector.useInstallation(new File("/home/denis/dev/gradle/gradle-1.6"));
        connector.forProjectDirectory(file);
        ProjectConnection connection = connector.connect();
        ModelBuilder<IdeaProject> builder = connection.model(IdeaProject.class);
        IdeaProject project = builder.get();
          for (IdeaModule module : project.getModules()) {
            for (IdeaDependency dependency : module.getDependencies()) {
                System.out.println(dependency);
            }
        }
    }
}

‘gradle dependencies’ from console shows a bunch of dependencies however.

One more note - that might be related to a comment from GRADLE-2008:

This is expected behavior. If you don't apply java plugin, your gradle project does not have a concept of runtime / compile configurations, e.g. those are just names. When you do apply the java plugin then 'compile' and 'runtime' (and others) dependencies mean stuff that needs to be on the classpath.
...
groovy/scala plugin apply java plugin behind the hood so it should all good.
Tooling Api is not bound to the java nature of the project. However, the jar dependencies, classpath, source and test compilation units, etc, all that make only sense if the java-related plugin is applied. So if you ask tooling api to provide Idea model of the non-java project you'll get a project, modules but not dependencies, source trees, etc.

It seems that the Tooling API is likely to be updated for Gradle 1.8. I think you should contribute your needs as well, so that it covers as many use cases as reasonably possible. This is being discussed on the dev-list.