gradle-docker
gradle-docker copied to clipboard
Is gradle incremental build supported?
My expectation is :
./gradlew docker
(builds docker image)
then:
<don't change anything>
Now:
./gradlew docker
(should skip all tasks because nothing changed)
What I see is:
docker container is rebuilt every time ./gradlew docker
is run.
Initially I suspected this is as designed, but this issue suggests that incremental build is expected to work: https://github.com/palantir/gradle-docker/issues/413
Gradle says:
Caching disabled for task ':docker' because:
Gradle would require more information to cache this task
Task ':docker' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Came here wondering the same thing, as I'm in the market for a plugin to simplify my build pipelines.
Looks like the answer is no based on the fact that the project doesn't use the @Input annotation anywhere, most importantly on the getters for all the parameters:
https://github.com/palantir/gradle-docker/blob/ade8ef3553d2443986e1338ad4bca4e5a0fe7b3a/src/main/groovy/com/palantir/gradle/docker/DockerExtension.groovy#L175
The workaround from #413 would therefore be required unless somebody made a contribution, which may be tricky given how the getters/setters have been setup.
EDIT: On the off-chance a future explorer comes looking, it seems like gradle-docker-plugin supports incremental builds, as it's using the necessary annotations OOTB. I've put it into a project of mine and it's doing a lovely job: