It was rough because I had to write the script myself (one year ago).
You need to know some things that are not obvious at first glance, like the fact that the databinding compiler is versioned with the android plugin for gradle.
Nowadays, you can just copy paste it from an existing github project.