SourceSetContainer.all removed in 1.0m9?


(Eric Wendelin) #1

Just upgraded to m9 and trying to fix our build that had some deprecated/removed stuff in it. Running into an issue that’s stumping me a bit. Below is a sample build file that fails with the message: “Could not find property ‘all’ on SourceSet container.” Now, it’s seems to be there in the docs so I must be using it wrong or something.

apply plugin: ‘scala’

group = “foo.bar”

groupId = group

artifactId = “baz”

version = “0.1”

jar {

baseName = artifactId

}

afterEvaluate {

configure(allProcessResourcesTasks()) {

filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [‘project_version’: “${project.version}”.toString()])

}

}

def allProcessResourcesTasks() {

sourceSets.all.processResourcesTaskName.collect {

tasks[it]

}

}

Happy to give more detail as needed.

Cheers, Eric


(Luke Daley) #2

The property all has been removed, there are still two different ‘all()’ methods.

The ‘getAll()’ method went away because ‘SourceSetContainer’ (and all the other containers) used to not be ‘java.util.Collection’ implementations whereas now they are. The ‘getAll()’ method used to return our container type as a ‘Collection’, which is now unnecessary.

So, you just need to drop the ‘.all’ in most cases. However, in your case you are relying on Groovy’s auto spread feature (which is nasty IMO).

The solution is:

def allProcessResourcesTasks() {
      sourceSets*.processResourcesTaskName.collect {
          tasks[it]
      }
  }

(Eric Wendelin) #3

That is exactly the problem and solution.

Thank you for your genius, Luke :slight_smile:


(Luke Daley) #4

No probs :slight_smile: