That’s a bit of a misuse of extensions. Extensions are meant as a way of extending the build script DSL. You are really just trying to add a dynamic property to your project. That is exactly what extra properties are for. Putting this in a separate gradle file would remove the code from you main build script, and allow you to avoid having to write a binary plugin as you did above. Your example, using the method I described above, would simply look like this:
configure(project.rootProject) {
ext {
svn = [
revision : {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true)
SVNClientManager clientManager = SVNClientManager.newInstance(options)
SVNStatusClient statusClient = clientManager.getStatusClient()
SVNStatus status = statusClient.doStatus(project.getProjectDir(), false)
SVNRevision revision = status.getRevision()
revision.getNumber().toString()
}.call()
]
}
}