Test task with InputChanges

How do I test a custom task where the execute takes InputChanges?

fun execute(inputChanges: InputChanges)
val project = ProjectBuilder.builder().build()
val task = project.tasks.create("myTask", MyTask::class.java) {
task.execute() // What goes here? How can I construct input changes?

If it is a unit test, then use a mock for InputChanges.

Short answer - consider this more of an integration test.
Long answer -basically I have a multi-build project that creates some Plugins, and then in a subproject I want to use those plugins. I can do it with composite builds, but it’s a lot messier than I’d like.
Ideally I’d be able to have this sub-project use the plugins project as a build dependency, but I can’t. I can use it as a regular dependency though, I just don’t have a way to specify input changes. (I don’t care if it’s not actually incremental)

Well, what I ended up doing that seems to be working –

object NonIncrementalUncheckedInputChanges : InputChanges {

	override fun getFileChanges(parameter: FileCollection): MutableIterable<FileChange> {
		return parameter.files.fold<File, List<FileChange>>(listOf()) { r, it ->
			r + allFileChanges(it)

	override fun getFileChanges(parameter: Provider<out FileSystemLocation>): MutableIterable<FileChange> {
		val file = parameter.get().asFile
		return allFileChanges(file)

	override fun isIncremental() = false

	private fun allFileChanges(root: File): MutableIterable<FileChange> {
		return root.walkTopDown().map {
			DefaultFileChange.added(it.absolutePath, it.name, if (it.isDirectory) FileType.Directory else FileType.RegularFile, it.relativeTo(root).path)