To avoid rewriting code I would like to use a subscript. This works fine for simple stuff but gets harder for implementing other plugins.
I’m using a docker plugin (com.bmuschko.gradle.docker) to create images for my projects. Until now I would just copy past all my code in the build.gradle file. I would like to use a seperate .gradle file for this.
How would I go about doing this? I won’t mind having to include stuff in the build.gradle file other than the apply from “subscript.gradle”.
I currently have something like this in my docker subscript:
apply plugin: ‘com.bmuschko.docker-remote-api’
def dockerRegistryHost = “registry:5000”
docker {
url = ‘https://docker-builder:2375’
}
task createDockerfile(type: com.bmuschko.gradle.docker.tasks.image.Dockerfile) {
destFile = project.file(‘build/docker/Dockerfile’)
…
}
however, this crashes on the class name on DockerFile (com.bm…DockerFile)
I have the feeling I’m missing something fundamental about how gradle scripts are build and that “apply from” doesn’t just insert the code into the main gradle file.