- 
                Notifications
    
You must be signed in to change notification settings  - Fork 100
 
fix: mark tasks as cacheable #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
resolves #100
| 
           Honestly, this is a bit scary. Can you please hold off? 
  | 
    
| 
           I think the OP in #100 (comment) is highlighting what I mention in #3) by suggesting that the "update" bits would need to be factored out into a separate task which can basically run every time to check NVD/OssIndex etc. If those don't lead to a change in the  Unfortunately, the way the engine is set up and the way many analyzers are "online" (not cacheable), I think it probably makes it a bit difficult to do this task/build caching in a predictable manner and to be useful? Conceptually, you'd want every analyzer to be marked as to whether it depends on a "mutable online source" and then for the up-to-date-ness of the Gradle tasks to depend on the analyzers enabled.  | 
    
| 
           This PR and #474 are not going to be merged without a lot more review, testing, and consideration of consequences. Regarding point 3 above - I understand the need/desire to re-run the task if a day or more has passed and nothing has changed. However, if I run a build back-to-back that invokes the task, I believe it is fair to expect the task to be skipped if none of the inputs or outputs have been changed.  | 
    
| 
           Ok, cool - I thouhht perhaps you wanted to get it into the fix release today 😅 But yes I agree it'd be nice to define some semantics on up-to-date-ness here that are cache-aware (for NVD) and allow the user to, say, opt-out of rechecking certain online sources more frequently than X minutes even if they don't support caching of their results  | 
    
| 
           I guess you could try and make this dynamic based on information using custom https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskOutputs.html if the engine configuration can answer some questions somehow. Like in pseudo-code: outputs.cacheIf("All enabled analyzers are cacheable") { task ->
  task.forceCachingOfOnlineAnalyzers.get() || task.engine.allEnabledAnalyzersAreCacheable()
}
outputs.upToDateWhen { task ->
  !task.engine.needsDataSourceCacheRefresh()
} | 
    
resolves #100
This should only be merged after #476.