Enhance compiler plugin binary backward compatibility #345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The Kotlin compiler plugin relies on
Kotlin-embeddablefor Intermediate Representation phase,when plugin is running in the host application during the compilation, the Kotlin version from Android Gradle Tool will override the one in plugin during the runtime.
For example, if the Android Gradle Tool version is "8.8.2", the kotlin "1.9.24" version from it will be actually used during the runtime of the plugin despite "2.0.20" is declared in the plugin project. And since it's a major version change, it leads some binary compatibility issue which makes build failed.
The main idea of this PR is to check the known broken API version, by checking function signature, visibility, etc.. to instantiate it by reflection if we find it's not compatible with the compilation version.
Here is a list of breaking APIs:
Review checklist (to be filled by reviewers)