Skip to content

Commit

Permalink
properly isolate the cache stores
Browse files Browse the repository at this point in the history
  • Loading branch information
bpholt committed Oct 5, 2024
1 parent c25381b commit d588328
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,13 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
(config / sourceManaged).value / "smithy" / "generated-metadata.smithy"
},
config / smithy4sGeneratedSmithyFiles := {
val cacheFactory = (config / streams).value.cacheStoreFactory
val cacheFactory =
(config / streams).value.cacheStoreFactory.sub(scalaVersion.value)
val cached = Tracked.inputChanged[(String, Boolean), Seq[File]](
cacheFactory.make(
s"smithy4sGeneratedSmithyFilesInput${scalaVersion.value}"
)
cacheFactory.make("smithy4sGeneratedSmithyFilesInput")
) { case (changed, (wildcardArg, shouldGenerateOptics)) =>
val lastOutput = Tracked.lastOutput[Boolean, Seq[File]](
cacheFactory.make(
s"smithy4sGeneratedSmithyFilesOutput${scalaVersion.value}"
)
cacheFactory.make("smithy4sGeneratedSmithyFilesOutput")
) { case (changed, prevResult) =>
if (changed || prevResult.isEmpty) {
val file =
Expand Down Expand Up @@ -458,14 +455,15 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
smithyBuild = smithyBuildValue
)

val cacheStoreFactory = s.cacheStoreFactory.sub(scalaVersion.value)
val cached =
CachedTask.inputChanged[CodegenArgs, Seq[File]](
s.cacheStoreFactory.make(s"input${scalaVersion.value}"),
cacheStoreFactory.make("input"),
s.log
) {
Function.untupled {
Tracked.lastOutput[(Boolean, CodegenArgs), Seq[File]](
s.cacheStoreFactory.make(s"output${scalaVersion.value}")
cacheStoreFactory.make("output")
) { case ((inputChanged, args), outputs) =>
if (inputChanged || outputs.isEmpty) {
s.log.debug(s"[smithy4s] Input changed: $inputChanged")
Expand Down

0 comments on commit d588328

Please sign in to comment.