Skip to content

Conversation

0marperez
Copy link
Contributor

@0marperez 0marperez commented Sep 16, 2025

Issue #

N/A

Description of changes

  • Configure minor-version-strategy rules (deprecatedUntilVersion)
  • GH workflow to run new rule

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0marperez 0marperez added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Sep 16, 2025
@0marperez 0marperez marked this pull request as ready for review September 16, 2025 21:52
@0marperez 0marperez requested a review from a team as a code owner September 16, 2025 21:52
Copy link
Member

@lauzadis lauzadis left a comment

Choose a reason for hiding this comment

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

I don't like that every project now needs to define a ktlint-rules module. Can we move the rule registration to aws-kotlin-repo-tools? We already have a reference to the Gradle Project there and should be able to get the sdkVersion and anything else you need

* Ruleset provider for AWS SDK Kotlin minor-version-bump-specific Ktlint rules.
*/
class MinorVersionStrategyRuleSetProvider : RuleSetProviderV3(RuleSetId("minor-version-strategy-rules")) {
private val sdkVersion = System.getProperty("sdkVersion").split(".")
Copy link
Member

Choose a reason for hiding this comment

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

correctness: this looks at JVM system properties, not Gradle properties right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, I don't think we can access gradle.properties at runtime unless we explicitly read the file. We're setting the Gradle property as a system property here.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I missed that, I'm not a fan of that approach but I'm not sure there's anything better

@0marperez
Copy link
Contributor Author

I don't like that every project now needs to define a ktlint-rules module. Can we move the rule registration to aws-kotlin-repo-tools? We already have a reference to the Gradle Project there and should be able to get the sdkVersion and anything else you need

We can't move it to repo tools because the rule would need to be published and then consumed downstream i.e. the minor and major version would be hardcoded. We can access the minor and major version using the Project, but rule registration can't be done in the build.gradle.kts file downstream.

build.gradle.kts Outdated
configureMinorVersionStrategyRules(lintPaths)

// Set SDK version from gradle.properties as a system property for 'configureMinorVersionStrategyRules' to use
tasks.withType<JavaExec> {
Copy link
Member

Choose a reason for hiding this comment

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

this can be refined to only a single task using tasks.named("...")

* Ruleset provider for AWS SDK Kotlin minor-version-bump-specific Ktlint rules.
*/
class MinorVersionStrategyRuleSetProvider : RuleSetProviderV3(RuleSetId("minor-version-strategy-rules")) {
private val sdkVersion = System.getProperty("sdkVersion").split(".")
Copy link
Member

Choose a reason for hiding this comment

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

Oh I missed that, I'm not a fan of that approach but I'm not sure there's anything better

Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

Copy link

A new generated diff is ready to view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants