Generic NamedCheckOps so non-Unit tasks can use .named - #375
Merged
Conversation
`NamedCheckOps` was pinned to `Def.Initialize[Task[Unit]]`, so wrapping bare task keys whose result type isn't `Unit` (e.g. `compile: TaskKey[CompileAnalysis]`, `doc: TaskKey[File]`) into `fixCheckExtra` failed with `value named is not a member of sbt.TaskKey[...]`. Re-introduce the `[A]` type parameter and have `.named` discard the result via `task.map(_ => ())` so any task initializer can be turned into a `NamedCheck`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💻 How to review this PR?
This PR was created with the idea of being reviewed commit by commit. Each commit contains an incremental change that makes it easier to review. Also some of the commits contain additional information in their description to help understand why the change was made.
I also recommend checking "Hide whitespace" when reviewing this PR!
🚀 What's included in this PR?
NamedCheckOpswas pinned toDef.Initialize[Task[Unit]], so bare task keys whose result type isn'tUnit(sbt'scompile: TaskKey[CompileAnalysis],doc: TaskKey[File], etc.) couldn't be wrapped intofixCheckExtra— the build failed to load withvalue named is not a member of sbt.TaskKey[...].This PR:
[A]type parameter onNamedCheckOpsso anyDef.Initialize[Task[A]]picks up.named/.acrossAggregated..namedviatask.map(_ => ()), preservingNamedCheck.task: Def.Initialize[Task[Unit]](the orchestrator only cares whether a check succeeded).versionPolicyIntentiontoCompatibility.Nonefor this release, since adding the type parameter is a binary-incompatible signature change.someTask.named("…")) is unchanged from the user's perspective; it just starts working for moresomeTasktypes.