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

asking for feedback #3

Open
wants to merge 11 commits into
base: plugin-refactor
Choose a base branch
from
Open

asking for feedback #3

wants to merge 11 commits into from

Conversation

yigit
Copy link
Owner

@yigit yigit commented Dec 30, 2020

this is not a real PR, rather looking for feedback on how to implement KSP sub plugin to properly support android variants.

@yigit
Copy link
Owner Author

yigit commented Dec 30, 2020

@gavra0

// kotlin extension has the compilation target that we need to look for to create configurations
decorateKotlinExtension(project)
}
project.pluginManager.withPlugin("com.android.application") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can check for project.plugins.withType(com.android.build.gradle.api.AndroidBasePlugin) { ... in order to detect all plugin types AGP ships.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I couldn't use it here because my AGP dependency is compileOnly. That being said, i guess i can reflectively load the class as well.

}
}
}

override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true

override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You also need to register generated:

Kotlin sources do not need to registered asn they are anyhow picked up by kotlin compile task.

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