mumrah commented on code in PR #17066:
URL: https://github.com/apache/kafka/pull/17066#discussion_r1744153701


##########
build.gradle:
##########
@@ -882,6 +882,7 @@ project(':server') {
     inputs.property "commitId", commitId
     inputs.property "version", version
     outputs.file receiptFile
+    outputs.cacheIf { true }

Review Comment:
   `outputs.cacheIf` is one way to tell Gradle that a task is cacheable 
https://docs.gradle.org/current/userguide/build_cache.html#using_the_runtime_api.
   
   Even with this declaration, the task will only be up-to-date / cacheable if 
the inputs are unchanged. 
   
   So, taking the previous task definition:
   
   ```
   task createVersionFile() {
       inputs.property "commitId", commitId 
       inputs.property "version", version
       outputs.file receiptFile
   ```
   
   For incremental builds, this task will be considered UP-TO-DATE as long as 
the two inputs don't change. In order to actually allow this output to be 
_cached_, we need to tell gradle that it's cacheable. That's done by adding the 
`@CacheableTask` for custom task classes, or by adding `outputs.cacheIf { true 
}`
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to