Open OlegYch opened 4 months ago
as a workaround i use Compile / scalafmt / unmanagedSources ++= (Compile / managedSources).value
but that breaks caching of generated files
I think there's an opportunity to run the transformation before emission, which would solve the caching issue.
I don't have the time to look into this at the moment, but I'm happy to tend the release were a patch to arrive.
Looking though this, I believe the most sensible thing seems to be to create a new Key
, perhaps guardrailFormatter
, dereferenced on this line:
scope / Keys.guardrail := cachedGuardrailTask(SbtKeys.name.value, scope.name, SbtKeys.scalaBinaryVersion.value)(name, _root_.sbt.Keys.streams.value)((scope / Keys.guardrailTasks).value, (scope / SbtKeys.managedSourceDirectories).value),
(Pardon for not directly linking the file, GitHub for mobile is quite limited for stuff like this.)
I'd think it could match whatever the type of sbt-scalafmt
's corresponding Task
, so we could guardrailFormatter := scalafmt
or so, but I'm open to other ideas as well.
turns out it was easier, submitted #236
I couldn't find a way to hook scalafmt into generated guardrail sources. Ideally it should run automatically without need for manual configuration, but that's probably sbt or scalafmt responsibility.