Skip to content

Commit

Permalink
Fix #7 by finding source from all android extension which subclass Ba…
Browse files Browse the repository at this point in the history
…seExtension (#8)

* Fix #7 by finding source from all android extension which subclass BaseExtension

This should get not only Android App but also Android Library, InstantApp, etc.

* update readme
  • Loading branch information
jeremymailen authored Jun 8, 2017
1 parent 3da7400 commit 709daeb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Available on the Gradle Plugins Portal: https://plugins.gradle.org/plugin/org.jm

```groovy
plugins {
id 'org.jmailen.kotlinter' version '0.9.2'
id 'org.jmailen.kotlinter' version '0.9.3'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
}


version = '0.9.2'
version = '0.9.3'
group = 'org.jmailen.gradle'
def pluginId = 'org.jmailen.kotlinter'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jmailen.gradle.kotlinter

import com.android.build.gradle.AppExtension
import com.android.build.gradle.BaseExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
Expand Down Expand Up @@ -45,7 +46,7 @@ class KotlinterPlugin : Plugin<Project> {

private fun androidSourceSets(project: Project): List<SourceSetInfo> {
val android = project.extensions.findByName("android")
val sourceSetInfos = (android as? AppExtension)?.let {
val sourceSetInfos = (android as? BaseExtension)?.let {
it.sourceSets.map { androidSourceSet ->

val kotlinSourceTree = androidSourceSet.java.srcDirs.map { dir ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ open class LintTask : SourceTask() {
getSource().forEach { file ->
val relativePath = file.toRelativeString(project.projectDir)

logger.log(LogLevel.DEBUG, "linting: $relativePath")
logger.log(LogLevel.DEBUG, "$name linting: $relativePath")

val lintFunc = when (file.extension) {
"kt" -> this::lintKt
"kts" -> this::lintKts
else -> {
logger.log(LogLevel.DEBUG, "ignoring non Kotlin file: $relativePath")
logger.log(LogLevel.DEBUG, "$name ignoring non Kotlin file: $relativePath")
null
}
}
Expand Down

0 comments on commit 709daeb

Please sign in to comment.