Result of FileCollection.minus(...) does not appear to support further calls to minus(...) properly


#1

When working with FileCollections in gradle 1.8, given file collections A, B and C such that C is A+B I would expect that when I have a larger FileCollection D (that has stuff neither in A or B or C) I would be able to get those extras by doing:

D.minus(A).minus(B)

This does NOT work, however - it results in the same files that are in D (including those that are also in A and B). The following does:

D.minus©

I listed the actual files in each and compared them. They are equal.

Here’s a snippet of what I actually have:

configurations {
 config_A {
    description = 'Some stuff'
  }
      config_B {
    description = 'some additional stuff'
  }
      config_C {
    extendsFrom config_A
    description = 'A+B: Extends A and B is added below in dependencies'
  }
      config_D {
    description = 'Lots of stuff out of which we only need what is not in either A or B'
  }
}
  ...
  dependencies {
  config_A ...
  config_A ...
    config_B b_stuff
      config_C b_stuff //same as config_B
    config_D ...
}
  ...
    println "config_A:"
  configurations.config_A.files.each { println "
 - " + it.getAbsolutePath() }
      println "config_B:"
  configurations.config_B.files.each { println "
 - " + it.getAbsolutePath() }
      println "config_D:"
  configurations.config_D.files.each { println "
 - " + it.getAbsolutePath() }
      FileCollection d1 = configurations.config_D.minus(configurations.config_A).minus(configurations.config_B)
  println "d1:"
  d1.files.each { println "
 - " + it.getAbsolutePath() } // Shows entire config_D
      FileCollection d2 = configurations.config_D.minus(configurations.config_C)
  println "d2:"
  d2.files.each { println "
 - " + it.getAbsolutePath() } // Shows proper D - A - B = D - (A + B)

(Peter Niederwieser) #2

Can you provide a reproducible, and possibly simplified, example?


#3

Tried in a small, isolated example, but in it all works fine. This must be more complex. Will try to figure it out.