-
Notifications
You must be signed in to change notification settings - Fork 156
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
Issue #8 - Add support for Android projects #12
Conversation
Android projects apply different kotlin plugin with another structure of source sets. Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
Plugin will scan subprojects for kotlin plugins and add corresponding tasks to subprojects. Also it will create meta check and format tasks in root project as well - they will trigger corresponding tasks in subprojects. Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
I'd still like to be able to run |
Thanks for the PR! I'll look over it a bit more in a bit when I have a free moment. |
You can still apply plugin only for subproject. Applying to root project is optional. |
README.md
Outdated
@@ -61,7 +61,8 @@ ktlint { | |||
|
|||
This plugin adds two tasks to every source set: `ktlint[source set name]Check` and `ktlint[source set name]Format`. | |||
Additionally, a simple `ktlintCheck` task has also been added that checks all of the source sets for that project. | |||
Similarly, a `ktlintFormat` task has been added that formats all of the source sets. | |||
Similarly, a `ktlintFormat` task has been added that formats all of the source sets. Also same meta tasks are added | |||
to the root project for convenience - they will call related tasks in subprojects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also same meta tasks are added to the root project for convenience - they will call related tasks in subprojects.
So this was not true before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True that user can see tasks from subprojects as well.
Previously when user applied plugin to the root project that contains subprojects - no ktlint tasks are added, but now user can do that - plugin will add tasks for subprojects and add them as a dependency in the root project meta task.
Will make description more understandable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is the first plugin I've published so it's very likely I did something goofy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 32db797
@@ -1,8 +1,11 @@ | |||
package org.jlleitschuh.gradle.ktlint | |||
|
|||
import com.android.build.gradle.BaseExtension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a compileOnly
dependency, what happens if com.android.tools.build:gradle:2.3.2
isn't on the classpath?
Won't you get some sort of class not found exception when this class is loaded by the classloader since com.android.build.gradle.BaseExtension
isn't on the classpath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked on pure Kotlin project (without any android dependencies) - works ok. When I remove this compileOnly
dependency - plugin isn't compiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for checking!
Also, would you be so kind as to update the change log with your change listed under the header.
I will update the header when I do a release. |
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
Updated CHANGELOG in 704ab7b |
Thank you very much for your contribution! |
Fix for issue #8: This pull request adds support for Android projects with applied
kotlin-android
plugin. Also adds applying plugin only to root project - it will scan subprojects and add tasks accordingly.