Skip to content

Conversation

@gpunto
Copy link
Collaborator

@gpunto gpunto commented Oct 29, 2025

No description provided.

@gpunto gpunto requested a review from Copilot October 29, 2025 16:12
Copy link

Copilot AI left a comment

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 adds Spotless code formatting integration to the Stream build conventions plugin. It introduces a root-level convention plugin, extensions for configuring project-wide and module-specific settings, and automatic license header management.

Key changes:

  • Added a new RootConventionPlugin to configure project-wide settings via StreamProjectExtension
  • Integrated Spotless formatting with support for Kotlin, Java, Gradle Kotlin DSL, and XML files
  • Created a GenerateLicenseFileTask that dynamically generates license headers from templates

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugin/src/main/resources/license-header.xml Template for XML file license headers with placeholders for year and project name
plugin/src/main/resources/license-header.txt Template for Kotlin/Java file license headers with placeholders for year and project name
plugin/src/main/kotlin/io/getstream/android/StreamConventionPlugins.kt Added root convention plugin, Java library support, refactored Kotlin configuration, and added Spotless integration calls
plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt New extensions for project-wide and module-specific configuration (repository name, ktfmt option, Spotless disable)
plugin/src/main/kotlin/io/getstream/android/SpotlessConfiguration.kt Configures Spotless with license headers, formatting rules for multiple file types, and task dependencies
plugin/src/main/kotlin/io/getstream/android/GenerateLicenseFileTask.kt Cacheable task that generates license files from bundled templates with project-specific substitutions
plugin/build.gradle.kts Added Spotless dependency and registered new plugins (root, Java library)
gradle/libs.versions.toml Updated Spotless version to 8.0.0 and added spotless-gradle-plugin dependency

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

@gpunto gpunto force-pushed the spotless branch 4 times, most recently from 7b603cf to fdcd0f7 Compare October 29, 2025 16:35
@gpunto gpunto marked this pull request as draft October 29, 2025 16:43
@gpunto gpunto force-pushed the spotless branch 3 times, most recently from b2a161d to 44d5e58 Compare October 30, 2025 12:15
@gpunto gpunto marked this pull request as ready for review October 30, 2025 12:56
@gpunto gpunto force-pushed the spotless branch 3 times, most recently from 75355ab to 0fe64ba Compare October 30, 2025 13:23
@gpunto gpunto requested a review from a team October 30, 2025 13:50
@gpunto gpunto changed the title Add Spotless configuration to plugins Add Spotless configuration & introduce test plugin Oct 30, 2025
}
}

class AndroidTestConventionPlugin : Plugin<Project> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Introducing this too as we use com.android.test in chat & video

@gpunto gpunto force-pushed the spotless branch 2 times, most recently from 4031e33 to e9bd395 Compare October 30, 2025 14:48
@gpunto gpunto marked this pull request as draft October 30, 2025 15:05
@gpunto gpunto force-pushed the spotless branch 2 times, most recently from 4b70e61 to 46096e8 Compare October 30, 2025 16:46
} else {
// For now, we are fixing the ktlint version to the one currently used by Chat &
// Video to dodge this issue: https://github.com/diffplug/spotless/issues/1913
ktlint(KTLINT_VERSION)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Personally, I'd suggest migrating chat & video to ktfmt which, while far from perfect, at least produces deterministic output (note that bumping ktlint will also introduce changes, since they added many rules since v0.50). But we can leave that choice for the future, to avoid introducing too many changes at once.

Choose a reason for hiding this comment

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

Arent we using ktfmt in core and feeds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's chat and video that are using ktlint

@gpunto gpunto marked this pull request as ready for review October 31, 2025 10:57
@gpunto gpunto force-pushed the spotless branch 2 times, most recently from 2865ca2 to 461b02a Compare November 4, 2025 16:04
@gpunto gpunto force-pushed the spotless branch 2 times, most recently from 3dfd47f to fee4288 Compare November 4, 2025 17:04
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.

3 participants