Can gradle identify required unversioned files?


(asaf david) #1

it happened to me more than once that i create some new source files but forget to add one of them. the tests pass fine on my computer, but fail in the build server. to prevent these embarrassing moments, i’d like to ask gradle to print some warning when it finds a source /resource file which is used in the tests, but is unversioned. is there any way to do it?


(Peter Niederwieser) #2

This isn’t provided out-of-the-box, but you can write a task that, depending on your version control system, executes a command that checks for unversioned files. With Groovy, executing a command can be as simple as ‘“git stat”.execute()’.


(Luke Daley) #3

As Peter said, ‘“git stat”.execute()’ will work, but if you need some more flexibility take a look at dsl:org.gradle.api.Project:exec.

It also may be worth looking at the Git plugin