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

Update 2.1.0 internal compiler APIs doc #4631

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

martinbonnin
Copy link
Contributor

@martinbonnin martinbonnin requested a review from a team as a code owner January 3, 2025 19:00
@@ -1249,16 +1249,21 @@ You can use the `KotlinAndroidExtension` in exactly the same way.

### Compiler symbols hidden from the Kotlin Gradle plugin API

Starting with Kotlin 2.1.0,
you will receive a warning if you access compiler module symbols bundled within the Kotlin Gradle plugin (KGP).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this was technically not exact, right? The warning is based on the presence of a class file that is not bundled in KGP but build logic could still use the symbols bundled with KGP without being detected?


To guard against those issues, KGP will now display a warning if `org.jetbrains.kotlin:kotlin-compiler-embeddable` is loaded in the build classpath alongside KGP.

As a long term fix, if you are a plugin author using `org.jetbrains.kotlin:kotlin-compiler-embeddable` classes, we recommend doing so in an isolated classloader.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed from a requirement to a recommendation. If KGP removes any dependency on compiler APIs and/or the compiler APIs become stable, it might become acceptable to do the work in the main build classpath?

Also Gradle Workers API is a possible solution but it comes with tradeoffs so it's leaving the door open to other solutions.

Copy link
Member

@ALikhachev ALikhachev Jan 15, 2025

Choose a reason for hiding this comment

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

It might become acceptable but is still subject to conflicts between different plugins that depend on kotlin-compiler-embeddable. The artifact does not provide generic compatibility guarantees as it's a fat jar containing both public and internal APIs.

@koshachy koshachy self-assigned this Jan 15, 2025
Copy link
Contributor

@koshachy koshachy left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!
I've slightly changed the text but kept the same meaning and structure.
Feel free to ask any questions.

@martinbonnin
Copy link
Contributor Author

Works for me! Thanks for the follow up!

@koshachy koshachy merged commit a766b4c into JetBrains:master Jan 21, 2025
4 checks passed
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