Skip to content

[2.x] Cache deactivation on task #7658

@adpi2

Description

@adpi2

I imagine it can be very frustrating for the user if the cache does not work as expected (inconsistencies, corrupted output, performance degradation). I think we should always be able to deactivate the cache globally, on a project, at the task level.

  1. Global / cacheStores := Seq.empty

If cacheStores is empty I think the user would expect no cache at all, even not a local cache. We should make sure that sbt still works if there is no cache.

  1. compileIncremental / cachingEnabled := false

At different level, it should be possible to deactivate the cache. This should be clearly documented.

I think the logic can be generated automatically by Def.cachedTask: we add a taskScope parameter, to generate the following automatically:

if (taskScope /cachingEnabled).value then ActionCache.get(...)(doAction) else doAction()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions