Add support for Deder build tool#8343
Conversation
Agent-Logs-Url: https://github.com/sake92/metals/sessions/cdb9ae9e-c694-4e9b-82ab-dc1433764272 Co-authored-by: sake92 <12010694+sake92@users.noreply.github.com>
…-tool Add Deder build tool support
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds Deder build-tool support: detection, a new ChangesDeder build tool integration
Sequence DiagramsequenceDiagram
participant Workspace
participant BuildTools
participant DederBuildTool
participant DederDigest
participant BSP
Workspace->>BuildTools: scan workspace
BuildTools->>Workspace: check for `deder.pkl`
alt `deder.pkl` found
BuildTools->>DederBuildTool: instantiate(projectRoot, userConfig)
DederBuildTool->>DederDigest: current(projectRoot)
DederDigest->>Workspace: read `deder.pkl`
Workspace-->>DederDigest: file contents
DederDigest-->>DederBuildTool: digest result
DederBuildTool->>BSP: run ["deder","bsp","install"]
BSP-->>DederBuildTool: BSP ready
DederBuildTool-->>BuildTools: registered/loaded
else not found
BuildTools-->>Workspace: no Deder project
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@metals/src/main/scala/scala/meta/internal/builds/BuildTools.scala`:
- Around line 215-216: Add the Deder BSP name string "deder-bsp" to the
knownBsps collection in scala.meta.internal.builds.BuildTools so that the
DederBuildTool (DederBuildTool(userConfig, workspace)) is recognized as a known
built-in BSP instead of being treated as a separate custom tool; update the
knownBsps definition to include the "deder-bsp" entry next to other BSP names to
prevent duplicate/unknown BSP detection and the second switch prompt.
In `@metals/src/main/scala/scala/meta/internal/builds/DederBuildTool.scala`:
- Around line 23-30: The BSP identity currently exposes "deder" via
DederBuildTool.name, causing a mismatch with the detected "deder-bsp"; update
the object DederBuildTool so the public identity matches the BSP by changing the
val name (used by executableName and consumers) to "deder-bsp" so executableName
and any tool-detection logic report the same identifier.
In `@metals/src/main/scala/scala/meta/internal/builds/DederDigest.scala`:
- Around line 12-15: DederDigest currently treats a missing deder.pkl as success
because the else branch returns true; update the logic in DederDigest (use the
dederFile and Digest.digestFile calls) so that when dederFile.isFile is false it
returns false (or otherwise signals failure) instead of true, ensuring
Digestable.current() will not produce a digest when deder.pkl is absent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7bbae11c-d79a-49ff-a66b-6ed33b05290f
📒 Files selected for processing (3)
metals/src/main/scala/scala/meta/internal/builds/BuildTools.scalametals/src/main/scala/scala/meta/internal/builds/DederBuildTool.scalametals/src/main/scala/scala/meta/internal/builds/DederDigest.scala
tgodzik
left a comment
There was a problem hiding this comment.
Thanks for raising the PR. I would be ok with including it, the comments from coderabbit make sense and should help out with the issues you are seeing
There was a problem hiding this comment.
🧹 Nitpick comments (1)
metals/src/main/scala/scala/meta/internal/builds/BuildTools.scala (1)
146-149: 💤 Low valueAdd Deder detection tests to
DetectionSuite.Other build tools have detection coverage in
DetectionSuite(sbt/mill/gradle/maven). Add a smallcheckDederhelper and test cases forisDeder/dederProjectdetection with a workspace containingdeder.pklto prevent future regressions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@metals/src/main/scala/scala/meta/internal/builds/BuildTools.scala` around lines 146 - 149, Add unit tests to DetectionSuite to cover Deder detection: implement a small helper named checkDeder (similar to existing checkSbt/checkMill) that sets up a temporary workspace containing the DederBuildTool.buildFile (deder.pkl) and asserts that BuildTools.isDeder returns true and BuildTools.dederProject is defined (and conversely false/None for workspaces without deder.pkl). Locate references to DetectionSuite, checkDeder, isDeder, dederProject and DederBuildTool.buildFile when adding the tests so they mirror the structure of existing sbt/mill/gradle/maven detection tests to prevent future regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@metals/src/main/scala/scala/meta/internal/builds/BuildTools.scala`:
- Around line 146-149: Add unit tests to DetectionSuite to cover Deder
detection: implement a small helper named checkDeder (similar to existing
checkSbt/checkMill) that sets up a temporary workspace containing the
DederBuildTool.buildFile (deder.pkl) and asserts that BuildTools.isDeder returns
true and BuildTools.dederProject is defined (and conversely false/None for
workspaces without deder.pkl). Locate references to DetectionSuite, checkDeder,
isDeder, dederProject and DederBuildTool.buildFile when adding the tests so they
mirror the structure of existing sbt/mill/gradle/maven detection tests to
prevent future regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2263f273-e933-47c6-8ceb-266ec98ebdf9
📒 Files selected for processing (3)
metals/src/main/scala/scala/meta/internal/builds/BuildTools.scalametals/src/main/scala/scala/meta/internal/builds/DederBuildTool.scalametals/src/main/scala/scala/meta/internal/builds/DederDigest.scala
🚧 Files skipped from review as they are similar to previous changes (1)
- metals/src/main/scala/scala/meta/internal/builds/DederDigest.scala
|
Looks like there is a valid test failure in UserConfigurationSuite, but otherwise there some flakiness related to sonatype's recent changes. |
Thanks! I will have a look tomorrow. |
This adds support for Deder build tool automatic import.
I've tested this locally, works fine.
Tho I am not sure why I get 2 of these messages, shouldn't there be just one? (or even none if it's obvious which build tool it should use)
1:

2 (switch? after I accepted to use Deder?):

Summary by CodeRabbit