Treating a task as a Dependency

I would like to be able to use a Task to generate a Dependency, for example:

configurations {
    transformerInput
}
dependencies {
    transformerInput "com.someone:somepackage:version"
}
task('transform', type: BinaryTransform) { // BinaryTransform extends AbstractArchiveTask
    from configurations.transformerInput // a FileCollection
}
// And now the magic:
dependencies {
    compile transform
}

But that last bit where I want to make a task magically be treated as a dependency source doesn’t work. I can treat it as an artifact because it generates an Archive, but I can’t treat it as a class path entry. Saying

artifacts {
    compile transform
}

does work, but does not produce the desired effect, that is, running compileJava or jar does not invoke transform and put the result on the classpath.

HALP!

Thank you all.

Edit: You can use a file collection dependency.

dependencies {
     transformerInput files(transform)
}