Skip to content

[2.x] feat: Pretty-print dependency lock file#8773

Merged
eed3si9n merged 2 commits intosbt:developfrom
spider-yamet:feat/Make-dependencyLock-file-pretty
Feb 21, 2026
Merged

[2.x] feat: Pretty-print dependency lock file#8773
eed3si9n merged 2 commits intosbt:developfrom
spider-yamet:feat/Make-dependencyLock-file-pretty

Conversation

@spider-yamet
Copy link
Copy Markdown
Contributor

Fixes #8770

Problem

The dependencyLock task writes deps.lock as a single line of JSON, which is difficult to review and diff (see #8770).

Solution

Use PrettyPrinter instead of CompactPrinter in LockFile.write so the lock file is written as pretty-printed, multi-line JSON. Schema and semantics are unchanged; only formatting changes. Both the manual dependencyLock task and the lock file written during resolution use this path.

Testing

  • Reproduced the issue: ran dependencyLock on sbt 2.0.0-RC9 and confirmed one-line output before the change.
  • Added unit test in LockFileSpec: "LockFile.write outputs pretty JSON" (asserts written content contains newlines).
  • Existing lock round-trip and dependencyLockCheck behavior unchanged; parser accepts both compact and pretty JSON.

Checklist

  • Reproduced the problem before changing code.
  • Change compiles and fixes the problem.
  • Unit test added.
  • Small, focused change (formatting only).

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spider-yamet Thanks!

@eed3si9n eed3si9n merged commit 2f14fd8 into sbt:develop Feb 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Make dependencyLock file pretty

2 participants