Skip to content
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

Remove legacy kotlin-compiler-embeddable dependency to prevent potential Kotlin version conflicts #223

Merged
merged 16 commits into from
Nov 24, 2023
Merged

Conversation

simonhauck
Copy link
Collaborator

🚀 Description

See this issue.

Increase the Kotlin version to 1.9.20
Add a test to verify the plugin is applied correctly to projects with different kotlin versions

📄 Motivation and Context

Keeping dependencies up to date is always a good idea.

🧪 How Has This Been Tested?

A new integration test is added, where the plugin is applied to projects with different kotlin versions.

Unfortunately, this required some creative workaround. Maybe you have a better idea.

Normally you use withPluginClasspath() on GradleRunner.create() to have access to the plugin. This overrides the specified kotlin version in the build.gradle.kts of the genereated project in the test. I suspect this happens, because Kotlin can only be applied once per project and the dependency is taken from the parent project.

I publish the project to mavenLocal and then apply it completly decoupled of the project. It works, but I am happy for any suggestion :)

📦 Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

✅ Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@simonhauck simonhauck marked this pull request as ready for review November 7, 2023 05:39
Copy link
Owner

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

This is amazing @simonhauck thanks for looking into it. I've left a couple of comments

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -99,6 +94,8 @@ signing {
useInMemoryPgpKeys(signingKey, signingPwd)
}

tasks.withType<Sign>().configureEach { onlyIf { project.properties["skip-signing"] != "true" } }
Copy link
Owner

Choose a reason for hiding this comment

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

Q: Is this really needed? I believe the .gradle files inside the resources/ folder are ignored no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When calling gradlew :plugin-build:plugin:publishToMavenLocal I get an error about an unconfigured signatory, because the signing task is an implicit dependency.

The publish task is executed from the parent project, so the build.gradle.kts file in the resources directory are unrelated to this.

I am not aware of another easy solution to disable the signing task conditionally for the test.

@simonhauck
Copy link
Collaborator Author

As a note, you should probably also merge this before the next release ;)

@cortinico
Copy link
Owner

Seems like bump to Kotlin 1.9.21 made it automatically: #229

Are those changes necessary then?

@simonhauck
Copy link
Collaborator Author

I would recommend to remove any unused dependency. Especially if it can cause conflicts like the kotlin-compiler-embeddable.

Its up to you if you want to have the integration test. It just gives additional reassurance that the plugin can be correctly applied to all sorts of Kotlin versions. In the end its a tradeoff.

@cortinico
Copy link
Owner

Makes sense 👍 Could you rebase your change and then we can merge it

simonhauck and others added 9 commits November 24, 2023 13:58
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…v1.9.21 (#228)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@simonhauck
Copy link
Collaborator Author

Done, I just noticed two small things left.

I have increased the version of the plugin in the test to 99.99.99-compatibility-check, because I was initially worried renovate would mess this up. But from the other build.gradle.kts it does not seem to be that way. I would still leave it as it is, because it does not really matter.

And I forgot to remove the dependency from the libs.version.toml. This is now also done

@cortinico cortinico changed the title Kotlin 1.9.20 update Remove legacy kotlin-compiler-embeddable dependency to prevent potential Kotlin version conflicts Nov 24, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
@cortinico cortinico enabled auto-merge (squash) November 24, 2023 14:15
@cortinico cortinico merged commit 09b573b into cortinico:main Nov 24, 2023
4 checks passed
@simonhauck simonhauck deleted the kotlin-1.9.20-update branch November 24, 2023 15:27
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.

2 participants