title: Gradle task is never up-to-date
body: <p>In the configuration phase of the task I register some dir as <code>builtBy: thisTask</code>. I expect gradle to automatically detect if sources were changed, but the task always being executed.<br>
  Here is the task:  </p>
  
  <pre><code>subprojects {
  
      def srcMainMirah = file('src/main/mirah')
      if (srcMainMirah.exists()) {
  
          idea.module.sourceDirs += srcMainMirah
  
          task compileMirah {
  
              def classesMirahMain = file("$buildDir/classes-mirah/main")
  
              inputs.sourceDir srcMainMirah
              def thisTask = delegate
              sourceSets.main {
                  output.dir(classesMirahMain, builtBy: thisTask)
                  java.srcDir srcMainMirah
              }
              dependsOn tasks.compileJava
  
              doFirst {
                  def classpath = files("$buildDir/classes/main").plus(configurations.compile)
                  mirahc(srcMainMirah, classesMirahMain, classpath)
              }
          }
      }
  }
  </code></pre>
  
  <p>It is for compiling sources in mirah language, which produces <code>*.class</code> files just like java compiler does.</p>