title: Gradle inputs and outputs
body: <p>I'm learning Gradle and trying to understand how input and output files determine whether a task is up to date.</p>
  
  <p>This task is never up to date, even when the build file doesn't change.</p>
  
  <pre><code>    task printFoo() {
          inputs.file(getBuildFile())
  
          doLast {
              println 'foo'
          }
      }
  </code></pre>
  
  <p>This task is always up to date, even when the build file changes.</p>
  
  <pre><code>    task printFoo() {
          outputs.file(getBuildFile())
  
          doLast {
              println 'foo'
          }
      }
  </code></pre>
  
  <p>I had expected both examples to consider the task out of date only when the build file changes, and up to date otherwise. What am I missing?</p>