Skip to content

[#123] Modernize Gradle build structure (prep for Gradle 9)#129

Open
ssawchenko wants to merge 11 commits into
ss/127_update_dependenciesfrom
ss/123_gradle_updates
Open

[#123] Modernize Gradle build structure (prep for Gradle 9)#129
ssawchenko wants to merge 11 commits into
ss/127_update_dependenciesfrom
ss/123_gradle_updates

Conversation

@ssawchenko

@ssawchenko ssawchenko commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

⚠️ This PR depends on ss/127_update_dependencies and is targeted at that branch. Retarget to main once that PR is merged.

  • Add gradle/libs.versions.toml version catalog; migrate all library dependency declarations to use catalog references
  • Centralize repository declarations in settings.gradle using pluginManagement and dependencyResolutionManagement
  • Migrate root build.gradle from legacy buildscript { classpath } pattern to modern plugins {} block
  • Update module build files to use current AGP DSL (compileSdk/minSdk/targetSdk)
  • Update Gradle wrapper 8.13 → 8.14.4 (minimum required by Kotlin 2.4.0)

Pre-existing issues also fixed:

  • Add missing testImplementation junit to both modules
  • Fix API 23 lint errors in Destinations.kt — Java forEach calls replaced with for loops
  • Remove deprecated android.defaults.buildfeatures.buildconfig from gradle.properties; add explicit buildConfig true per module
  • Remove ineffective minifyEnabled true from debug build type (AGP silently ignores it for debuggable builds)
  • Remove stale tools:replace from io.sentry.auto-init manifest entry

Copilot feedback addressed:

  • Use fully-qualified org.jetbrains.kotlin.android plugin ID in module build files
  • Compute log file expiry timestamp once outside the loop instead of per file
  • Log when log file deletion fails rather than silently ignoring the return value
  • Remove unused xmlns:tools namespace from AndroidManifest.xml

Note

  • We will be updating the major gradle version in an upcoming PR. This PR is meant as a baby step towards the migration to Gradle 9.

Test plan

  • ./gradlew build passes with no new warnings

Note, I am seeing a bunch of these warnings which I hope to address after moving to Gradle 9

WARNING: R8: An error occurred when parsing kotlin metadata. This normally happens when using a newer version of kotlin than the kotlin version released when this version of R8 was created. To find compatible kotlin versions, please see: https://developer.android.com/studio/build/kotlin-d8-r8-versions
  • Sample app installs and runs on a device/emulator
  • ./gradlew :steamclog:assembleRelease completes successfully

🤖 Generated with Claude Code

ssawchenko and others added 6 commits June 10, 2026 13:23
- Add gradle/libs.versions.toml with all library dependency versions
- Update app and steamclog modules to use catalog references (libs.xxx)
- Add missing testImplementation junit to both modules
- Upgrade Gradle wrapper 8.13 -> 8.14.4 (required by Kotlin 2.4.0)
- Replace deprecated android.defaults.buildfeatures.buildconfig property
  with explicit buildConfig true in app and steamclog modules
- Fix API 24 lint errors in Destinations.kt by replacing forEach with for loops

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add pluginManagement and dependencyResolutionManagement blocks to
settings.gradle so all repository declarations live in one place.
Remove the allprojects repositories block from build.gradle and the
redundant buildscript repositories block from app/build.gradle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the legacy buildscript { dependencies { classpath } } pattern
with a modern plugins {} block. All four plugins are declared with
apply false at the root so submodules inherit versions without
re-declaring them. Removes the kotlin entry from ext.versions as it
was only needed for the old classpath reference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace deprecated compileSdkVersion/minSdkVersion/targetSdkVersion
with the modern compileSdk/minSdk/targetSdk forms. Remove the unused
fileTree libs dependency from steamclog (the libs directory is empty).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AGP disables minification for debuggable builds regardless, so the
setting had no effect. Proguard is still tested via the release build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove stale tools:replace from io.sentry.auto-init meta-data; newer
Sentry versions no longer inject a conflicting declaration so there is
nothing to replace. Update CHANGELOG to reflect Gradle wrapper bump and
API 23 forEach fix landed in this branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ssawchenko ssawchenko changed the title Modernize Gradle build structure [#123] Modernize Gradle build structure Jun 10, 2026
@ssawchenko ssawchenko linked an issue Jun 10, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the project’s Gradle build configuration by introducing a version catalog, centralizing repository configuration in settings.gradle, and migrating build scripts toward the modern plugins {} + AGP DSL style. It also includes a small Kotlin source change to improve API 23 compatibility by avoiding Java forEach calls.

Changes:

  • Added gradle/libs.versions.toml and migrated module dependencies to libs.* catalog references.
  • Centralized plugin/dependency repositories in settings.gradle and updated the Gradle wrapper to 8.14.4.
  • Updated Android/AGP DSL usage (compileSdk, minSdk, targetSdk, buildFeatures.buildConfig) and adjusted some logging/file-iteration code in Destinations.kt.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
steamclog/src/main/java/com/steamclock/steamclog/Destinations.kt Replaces Java forEach usages with Kotlin for loops for API 23 compatibility and adjusts file iteration logic.
steamclog/build.gradle Migrates dependency declarations to version-catalog aliases and updates AGP DSL fields.
settings.gradle Centralizes repository declarations via pluginManagement and dependencyResolutionManagement.
gradle/wrapper/gradle-wrapper.properties Updates Gradle wrapper distribution to 8.14.4.
gradle/libs.versions.toml Introduces a version catalog for libraries and plugins.
gradle.properties Removes deprecated android.defaults.buildfeatures.buildconfig.
CHANGELOG.md Updates unreleased notes to reflect the build/dependency modernization.
build.gradle Switches root build to modern plugins {} version management and trims legacy buildscript usage.
app/src/main/AndroidManifest.xml Removes a stale tools:replace attribute from Sentry metadata.
app/build.gradle Migrates dependencies to the version catalog, updates AGP DSL fields, and removes ineffective debug minification config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/build.gradle
Comment thread steamclog/build.gradle
Comment thread steamclog/src/main/java/com/steamclock/steamclog/Destinations.kt
Comment thread steamclog/src/main/java/com/steamclock/steamclog/Destinations.kt Outdated
Comment thread app/src/main/AndroidManifest.xml
Comment thread CHANGELOG.md
ssawchenko and others added 4 commits June 10, 2026 16:25
Replace kotlin-android alias with org.jetbrains.kotlin.android so
submodule plugin declarations match the root plugins block exactly.
The alias was a holdover from the buildscript classpath approach and
is fragile in the modern plugins {} resolution system.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids allocating a Date object per file and keeps the expiry check
consistent across all files in a single removeOldLogFiles pass.
Use System.currentTimeMillis() directly instead of Date().time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
File.delete() returns false on failure; check the result and emit a
console log so failed cleanup is observable rather than silent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The tools:replace attribute was removed in a prior commit; the tools
namespace declaration is now unused.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ssawchenko ssawchenko force-pushed the ss/123_gradle_updates branch from dc81c5e to 28238bf Compare June 10, 2026 23:25
@ssawchenko ssawchenko requested a review from munl June 11, 2026 17:15
@ssawchenko ssawchenko force-pushed the ss/123_gradle_updates branch from 737f786 to 28238bf Compare June 11, 2026 17:26
@ssawchenko ssawchenko changed the title [#123] Modernize Gradle build structure [#123] Modernize Gradle build structure (prep for Gradle 9) Jun 11, 2026
Comment thread gradle/libs.versions.toml
agp = "8.13.2"
kotlin = "2.4.0"
sentry = "8.43.1"
sentry-plugin = "6.10.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ignore my comment in my previous PR review and just update to 6.14.0 here

@munl munl assigned ssawchenko and unassigned munl Jul 3, 2026
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.

Update gradle version

3 participants