Skip to content

chore(build): migrate Gradle build scripts from Groovy to Kotlin DSL#100

Open
balazs-szucs wants to merge 2 commits intogrimmory-tools:developfrom
balazs-szucs:kotlin-dsl
Open

chore(build): migrate Gradle build scripts from Groovy to Kotlin DSL#100
balazs-szucs wants to merge 2 commits intogrimmory-tools:developfrom
balazs-szucs:kotlin-dsl

Conversation

@balazs-szucs
Copy link
Member

@balazs-szucs balazs-szucs commented Mar 21, 2026

Description

Linked Issue: Fixes #

Changes

This pull request migrates the build configuration of the booklore-api project from Groovy-based Gradle files to Kotlin DSL (KTS). The main goal is to modernize the build setup, improve maintainability, and leverage Kotlin's type safety and tooling support. The changes include a direct translation of all build logic, dependencies, and tasks, as well as the removal of the old Groovy files.

Summary by CodeRabbit

  • Chores
    • Migrated backend build configuration to a new DSL and updated project metadata and build-task behavior.
    • Improved build-time handling for frontend distribution, testing/reporting, and optional remote debug.
    • Updated container build to use the new build configuration format.
    • No changes to application functionality or user-facing features.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a23d00fa-e7e3-4db1-90fc-742bf3aaf252

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6ea0f and f3fc90e.

📒 Files selected for processing (1)
  • Dockerfile

📝 Walkthrough

Walkthrough

Replaced Groovy-based Gradle build and settings files with Kotlin DSL equivalents: build.gradle and settings.gradle were removed and build.gradle.kts and settings.gradle.kts were added. Dockerfile copy step updated to reference the Kotlin DSL files.

Changes

Cohort / File(s) Summary
Gradle build scripts
booklore-api/build.gradle (removed), booklore-api/build.gradle.kts (added)
Full migration from Groovy DSL to Kotlin DSL: plugins, Java 25 toolchain, project coordinates, repositories, comprehensive dependencies, Hibernate enhancement, JaCoCo, test wiring, processResources frontend copy logic, and bootJar/bootRun settings recreated in Kotlin DSL.
Gradle settings
booklore-api/settings.gradle (removed), booklore-api/settings.gradle.kts (added)
Root project name assignment moved from Groovy settings to Kotlin settings file.
Docker context change
Dockerfile
Build stage now copies build.gradle.kts and settings.gradle.kts into the Gradle context instead of the Groovy DSL files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • imajes

Poem

🐰 From Groovy hops to Kotlin skips,
I nibble scripts and twitch my lips,
Types tidy, tasks all snuggled tight,
A carrot-built build—what a delight! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: migrating Gradle build scripts from Groovy to Kotlin DSL, which is directly supported by the changeset.
Description check ✅ Passed The description includes the required sections from the template (Description and Changes) and explains the migration purpose, goals, and scope without requiring additional critical information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
booklore-api/build.gradle.kts (1)

146-152: Consider more idiomatic Kotlin DSL property assignment.

The JaCoCo report configuration uses .set(true) which works, but Kotlin DSL supports direct property assignment for a cleaner syntax.

♻️ Optional: Use property assignment syntax
 tasks.named<JacocoReport>("jacocoTestReport") {
     dependsOn(tasks.named("test"))
     reports {
-        xml.required.set(true)
-        html.required.set(true)
+        xml.required = true
+        html.required = true
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@booklore-api/build.gradle.kts` around lines 146 - 152, Change the JaCoCo
report property assignments to use Kotlin DSL direct property assignment instead
of calling .set(true); locate the tasks.named<JacocoReport>("jacocoTestReport")
block and replace xml.required.set(true) and html.required.set(true) with the
idiomatic assignments xml.required = true and html.required = true so the
configuration uses Kotlin property syntax.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@booklore-api/build.gradle.kts`:
- Around line 154-167: The configuration currently calls
frontendResourcesDir.exists() during Gradle configuration in the
tasks.named<Copy>("processResources") block (using configuredFrontendDistDir /
defaultFrontendDistDir), so the from(...) is skipped if the dir is created
later; change this by deferring the existence check to execution time: either
move the conditional into a doFirst/doLast in the same
tasks.named<Copy>("processResources") block and call
frontendResourcesDir.get().exists() there, or register a separate Copy task
(e.g., "copyFrontend") that uses
from(configuredFrontendDistDir.orElse(providers.provider {
defaultFrontendDistDir })) with an onlyIf {
configuredFrontendDistDir.get().exists() } and make
tasks.named("processResources") dependOn("copyFrontend") so the copy runs only
at execution time when the directory may exist.

---

Nitpick comments:
In `@booklore-api/build.gradle.kts`:
- Around line 146-152: Change the JaCoCo report property assignments to use
Kotlin DSL direct property assignment instead of calling .set(true); locate the
tasks.named<JacocoReport>("jacocoTestReport") block and replace
xml.required.set(true) and html.required.set(true) with the idiomatic
assignments xml.required = true and html.required = true so the configuration
uses Kotlin property syntax.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3011105-5066-43d7-bd79-3b659d627144

📥 Commits

Reviewing files that changed from the base of the PR and between 722ef97 and 5d6ea0f.

📒 Files selected for processing (4)
  • booklore-api/build.gradle
  • booklore-api/build.gradle.kts
  • booklore-api/settings.gradle
  • booklore-api/settings.gradle.kts
💤 Files with no reviewable changes (2)
  • booklore-api/settings.gradle
  • booklore-api/build.gradle

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.

1 participant