When do dependencies become available during phase?

Use-case: I am working on an experimental plugin, that will reflect Rake tasks back as Gradle tasks.

(I’ve mentioned in some forum posts before, but I’ve got around to implementing an initial version now).

The idea is to be able to do something like

rake.loadfile('src/ruby/Rakefile')

which will add the tasks during the configuration phase i.e. some stage prior to ‘project.afterEvaluate’ being called.

Dillema: A Rakefile might require certain GEMs which is not in the jruby-complete distribution. These GEMs will need to be unpacked in a similar manner that we do today in the jruby-base plugin, however where should they be declared?

If they are placed in a normal ‘dependencies’ block i.e.

dependencies {
  rake 'rubygems:foobar:1.2.3'
}

will they be available during the configuration phase? Can I thus do

dependencies {
  rake 'rubygems:foobar:1.2.3'
}
rake.loadfile('src/ruby/Rakefile')

OR are they supposed to go into the ‘buildscript’ block i.e.

buildscript {
  dependencies {
    classpath 'rubygems:foobar:1.2.3'
  }
}

You can do this in the configuration phase fine.

You just need to be aware that dependency resolution is expensive, so you want to avoid accessing the configuration unless you really need to.

Thanks. I am aware of that.