Must delete .gradle directory if broken build didn't produce the output file

Mostly the inputs.files and outputs.files is working but for a native build I contributed a task that wasn’t running correctly due to a bug in my build. The bug meant the output file wasn’t created (the actual output was going to the wrong path). So as I understand it gradle marked the output as expected to be missing (as I’ve read in other posts).

Once I corrected this gradle still wouldn’t re-run the task unless I removed the outputs.files and inputs.files. I couldn’t see any solution until I realised that the hashes were probably cached in the .gradle directory. I deleted it and it was working fine, it was up to date when I expected and deleting the output caused a rebuild.

I am using 2.11 and the tasks were defined as:

tasks { allTasks ->
    $("components.main").binaries { binaries ->
      binaries.values().each { binary ->
        if ( == 'pnacl' && binary.buildType != buildTypes.debug) {
          def finalizeTask = binary.tasks.taskName("pnaclFinalize")
          def pexeFile = + ".pexe"
          allTasks.create(finalizeTask) {
            FileCollection myInputs = files(
            inputs.files myInputs
            FileCollection myOutputs = files(file(pexeFile))
            outputs.files myOutputs
            println file(pexeFile)
            doFirst {
              def finalizeProcess = [toolChains.pnacl.ext.finalizeCommand, "-o", pexeFile,].execute()
          def zipTask = binary.tasks.taskName("zip")
          println pexeFile
          allTasks.create(zipTask, Zip) {
            dependsOn finalizeTask
            FileCollection zipFiles = files('csdk.nmf',, pexeFile)
            destinationDir project.buildDir
            baseName binary.component.baseName
            inputs.files zipFiles
            from zipFiles
            outputs.files archiveName

The failing task was the pnaclFinalize one and the other was doing up to date checks correctly the whole time.