Gradle kotlin?fm=jpg&fl=progressive&q=75&w=300

Gradle Adopts Kotlin

In a surprise announcement at Kotlin Night SF, Gradle will soon support Kotlin! Starting with Gradle 3.0, you can specify your build scripts in Kotlin, the new statically-typed language from JetBrains. Finally, your IDE can help you out! Watch the reveal below.

Read more on the Gradle blog and the Kotlin blog.

Gradle & Kotlin (0:00)

Hello everyone.

I’m super excited about the opportunity to present here at the Kotlin Night. First, congratulations to Andre, the founder of Kotlin, and the many other engineers that are creating the wonderful Kotlin language and ecosystem.

I don’t do much coding now a days, but when we started to explore Kotlin, I needed to get a feel for the language. So, I did the Kotlin Koans, I got the Kotlin In Action book and wrote quite a bit of my Java code into Kotlin and it was very clear to me that Kotlin hit a sweet spot and it has all of the ingredients to be successful in one of the most challenging fields of engineering and that’s quite an achievement.

Get more development news like this

So, the announcement went out earlier today that Gradle embraces Kotlin as a build language and I want to talk about that.

Why Kotlin Just Fits (1:06)

How did it start? We were impressed with the Kotlin language and with the uptake, even before reaching 1.0 in the Android community, but also beyond the Android community.

There are also areas of pain that the Gradle community has that we need to address. One is that Gradle needs more sophisticated tooling when it comes to writing build logic. We want code navigation from script to plug-ins to the greater core, content assist, debugging help, refactoring, quick fixes, etc.

Related to that, we wanted to improve scaling build logic. So what do we mean by that? Many of the Gradle builds that are out there are massive. I talked with the Netflix guys who are here tonight; they have 5,000 Gradle build files, a tremendous number of Gradle plug-ins, and complex work flows. The build requires more and more serious engineering - excellent engineering. The domain is often at least as complex as the business domain and making build logic scale has many aspects, but the build language is an important one.

Detect configuration errors at compile time, make it easier to connect all the different pieces of your build logic, and tooling support and scaling are closely related to static typing.

We could have achieved that with Java, but the downside would be tremendous in terms of heavy weightiness of Gradle and the ease of use so this is why we never started that way.

This is where the virtues and the innovations of Kotlin comes into the game. There is no major downside for us moving to this statically-typed language. You can create wonderful DSLs; it’s scripting and spec friendly, it has first class functions, extension methods… everything you’d want from a modern language.

This all looked very, very promising. As a result, Gradle and JetBrains got their heads together and here we go!

Live Demo (3:30)

Click the timestamp above to jump to the demo in the video at the top of the page.

Blog Posts (8:33)

I want to give credit to the amazing engineers that made that possible, they did an amazing job. You can do this demo yourself. Go to the Gradle script Kotlin repo at GitHub and you will find all the set up instructions on how to do this.

We also just published a blog post where we talk in more detail about the Gradle-Kotlin story. The JetBrains folks further published a similar blog post from their perspective.

FAQ (9:25)

Q: Will existing plug-ins work with Kotlin Gradle builds?


Q: What about Eclipse?

Will be supported once we integrate the Eclipse-Kotlin support into the Eclipse-Gradle support.

Q: Will the usage of Groovy become deprecated?

No, that is still a fully supported way to write your Gradle builds.

Roadmap (9:50)

What is the roadmap for the Kotlin support? We are just at the beginning, but we’re moving very fast. Gradle 3.0, milestone one. Our next release will have experimental Kotlin support built in. At the moment you need to use a custom distribution but that will be built in in Gradle 3.0 and that will be next month at the Gradle Summit at the latest, it will have greater Kotlin support 1.O-M1.

Right now the created Kotlin support is a separate project so that you can update independently of the Gradle release lifecycle. At one point, we will move into the core. When it’s fully production ready, we expect that later this year so we’re moving very fast; we are investing a lot in to this.

A detailed roadmap will be published over the next weeks.

About Gradle (10:42)

I want to talk a little about the people who don’t know Gradle so well about the Gradle momentum and a little bit of background. We had 10.4 million downloads in 2015. In April, we almost had 2 million downloads just in one month and the download numbers have a special relationship with Kotlin. They are calculated by my code that I then migrated to Kotlin which analyzes our history log files.

The download numbers do not even include the Android Studio downloads which bundles Gradle. We have 800+ community plug-ins, growing very fast with support for any language and platform you can imagine. This includes Java, Android, C/C++, Python, Hadook and, of course, Kotlin.

Gradle is a generic automation platform to model all aspects of continuous delivery. That is we’re moving more and more in this direction, filing the empty spaces.

We are on an exciting journey and we are super thrilled about what Kotlin can provide to the Gradle community. At the same time, I think Gradle can be a tremendous multiplier for Kotlin adoption so it is just awesome! So, if ever there has been an example for win-win, this is a good example.

If you want to learn more about Gradle, come to the upcoming Gradle Summit. We have an amazing set up of excellent speakers from Google, Netflix, LinkedIn, JetBrains, Gradle Inc., Uber, Elastic Surge and many more. We talk about Gradle 3.0, new Gradle module repo support, the Gradle distributive cache that is in the making, continuous delivery for iOS and Android, and of course, Gradle-Kotlin support. That’s it, thank you!

Next Up: Kotlin in Depth #6: Better Android Development with Kotlin & Gradle

General link arrow white

About the content

This content has been published here with the express permission of the author.

Hans Dockter

Hans Dockter

Hans is the founder and project lead of the Gradle build system and the CEO of Gradle Inc., a company that provides training, support and consulting for Gradle and all forms of enterprise software project automation in general.

4 design patterns for a RESTless mobile integration »