-
Notifications
You must be signed in to change notification settings - Fork 0
Add Spotless configuration & introduce test plugin #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
RootConventionPluginto configure project-wide settings viaStreamProjectExtension - Integrated Spotless formatting with support for Kotlin, Java, Gradle Kotlin DSL, and XML files
- Created a
GenerateLicenseFileTaskthat 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.
plugin/src/main/kotlin/io/getstream/android/StreamConventionExtensions.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/io/getstream/android/GenerateLicenseFileTask.kt
Outdated
Show resolved
Hide resolved
7b603cf to
fdcd0f7
Compare
b2a161d to
44d5e58
Compare
75355ab to
0fe64ba
Compare
| } | ||
| } | ||
|
|
||
| class AndroidTestConventionPlugin : Plugin<Project> { |
There was a problem hiding this comment.
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
4031e33 to
e9bd395
Compare
4b70e61 to
46096e8
Compare
| } 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
2865ca2 to
461b02a
Compare
3dfd47f to
fee4288
Compare
No description provided.