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

Fix error when KSP plugin applied before AGP #2183

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

scott-pollom
Copy link
Contributor

Previously, when the KSP plugin was applied before AGP and AGP's built-in Kotlin support for test fixtures or screenshot tests was enabled, there would be an error when building.

The underlying cause for this error is
gradle/gradle#31092, which caused the KSP plugin to try to access the android extension before AGP's apply method had completed.

This change fixes the problem by using the "com.android.base" plugin as the indicator that a module is an Android module. The "com.android.base" plugin is applied after the android extension has been added, so it works around the Gradle bug.

Bug: #2174
Test: GradleCompilationTest

Copy link
Collaborator

@ting-yuan ting-yuan left a comment

Choose a reason for hiding this comment

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

Thank you so much for the patch! Would you mind to fix the lint error?

Previously, when the KSP plugin was applied before AGP and AGP's
built-in Kotlin support for test fixtures or screenshot tests was
enabled, there would be an error when building.

The underlying cause for this error is
gradle/gradle#31092, which caused the KSP
plugin to try to access the android extension before AGP's apply method
had completed.

This change fixes the problem by using the "com.android.base" plugin as
the indicator that a module is an Android module. The "com.android.base"
plugin is applied after the android extension has been added, so it
works around the Gradle bug.

Bug: google#2174
Test: GradleCompilationTest
@ting-yuan ting-yuan linked an issue Nov 1, 2024 that may be closed by this pull request
@ting-yuan ting-yuan merged commit 5b1cd4a into google:main Nov 1, 2024
3 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.

Fail to apply ksp before android
2 participants