Groovy 2.+

Hi I was wondering what the chances for having groovy 2.0 available for plugin development come gradle 1.8 would be? I understand that it could be a lot of work to update the DSL parsing for groovy 2.0, however I feel that the preformance boost from using @CompileStatic would be worthwhile.

The problem is that Groovy 2.x isn’t backwards-compatible with 1.8, and therefore switching imposes a very real risk of breaking builds and third-party plugins out there. We have longer-term plans to offer support for 2.0, but it isn’t going to happen soon. ‘@CompileStatic’ is a nice feature, but unlikely to substantially improve performance for most builds.

Oh trust me Peter, if we had @CompileStatic, our massive build would run at least 20% faster (Another developer on AbrarSyed’s plugin)

If build script performance is such a concern, isn’t it possible to move your build scripts into buildSrc and use Java wherever conveniently feasible?

Do you have any data to prove this? Also remember that ‘@CompileStatic’ will only help for your custom plugin and task classes. If some of these classes are really CPU-bound (and make up a large enough portion of total build time), consider implementing them in Java.

The most performance intensive parts our plugin take full advantage groovy’s dynamic typing, and… it is extremely difficult to port that over to java, if not impossible. I guess I should mention its a gradle plugin for of a wad of python scripts we used to use for building.

On the note of groovy being backwards compatible. I did some googling and couldn’t find anything that said it was incompatible. All the information about groovy 2 points to the new features of static type checking and static compilation, while no features from the old groovy 1.8 were lost. Im sure there is something im missing here… but anyways. thanks for the reply.

Nobody knows how well Groovy 2.x runs code compiled against 1.8. Groovy doesn’t give any backwards compatibility guarantees and doesn’t have any tests for it. Given that we weren’t even able to update from Groovy 1.8.6 to either of 1.8.7/8/9, chances are that switching to 2.x would cause major breakages. If you need dynamic typing, you can’t use ‘@CompileStatic’ anyway.