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.
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
}`
Edit: sorry, I misinterpreted your question I think. I'll leave the original
comment here anyways.
> That means the jars could have old kafka-version.properties when its
module has no change
The contents of kafka-version.properties will be the same because we're
overriding the commit ID with `-PcommitId=xxxxxxxxxxxxxxxx`.
--
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]