CSourceSet / incremental build not working when only adding/removing files

Hi there

I discovered a potential bug in usage of CSourceSets and incremental building. Let’s say I have this source declaration:

sources {

helloworld {

c {

source {

srcDir ‘src/A’

include ‘file1.c’

include ‘file2.c’


source {

srcDir ‘src/B’

include ‘file3.c’

include ‘file4.c’





Now, if a run a build and then remove one of the included files and run the build again, Gradle says the task ‘compileHelloworldExecutableHelloworldC’ is up to date, although the input source set did change. Same happens for adding a new file without touching existing files that have already been build.

Any ideas how I can work around that?

Edit: I’m using Gradle 2.2.1

We have pretty good test coverage for incremental build with C sources. Can you provide a reproducible sample demonstrating this issue?

Damn, I cannot not reproduce it on my machine. I encountered the behaviour at a customer, using Windows machines. On my Ubuntu machine I couldn’t reproduce it atm … Unfortunately the gig at the customer is finished now, so I cannot access the project anymore where it happened. If I encouter it again, I’ll try to provide an example.