There are two possibilities:
-
Publish a build script to a web server, and include it with
apply from: "http://path/to/script.gradle"
-
Write a Gradle plugin, publish it as a Jar to a Maven or Ivy repository, and include it with:
buildscript { repositories { .. } dependencies "mygroup:myplugin:1.0" } apply plugin: "myplugin"
The second option is more complicated, but also somewhat more powerful. For example, plugin Jars will be cached, whereas remote build scripts currently won’t. In general, I recommend to start with 1., and move to 2. if and once it becomes necessary. In the future, Gradle will likely offer a mechanism which combines the ease of use of 1. with the advantages of 2.