That makes sense. I think I'd rather prefer inferred task dependencies. Something along these lines:

    task generateExtraClasspath << { 
        ...
    }

    def myExtraClasspath = files("$buildDir/extraClasspath") {
        builtBy generateExtraClasspath
    }

    cargo {
        local {
            extraClasspath = myExtraClasspath
        }
    }

With that we won't have to create "hard" dependencies. Let me know if that would work for you.