Skip to content

Commit

Permalink
Merge pull request #72 from JavierSegoviaCordoba/ktlint-precompiled-p…
Browse files Browse the repository at this point in the history
…lugin

Created ktlint precompiled plugin
  • Loading branch information
voghDev authored May 14, 2020
2 parents e747c08 + 1bd07c1 commit 16bd455
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 29 deletions.
39 changes: 11 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("kotlin-android-extensions")
id("ktlint")
}

repositories {
mavenCentral()
}

if (new File('app/src/topplayers/build.gradle').exists()
&& new File('app/src/coldrealityy/build.gradle').exists()) {
Expand Down Expand Up @@ -48,10 +55,6 @@ android {
}
}

configurations {
ktlint
}

task runUnitTests(dependsOn: [':app:testDebugUnitTest']) {
description 'Run all unit tests'
}
Expand Down Expand Up @@ -110,24 +113,4 @@ dependencies {
implementation "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:$dbflow_version"

kapt "com.github.Raizlabs.DBFlow:dbflow-processor:$dbflow_version"

ktlint "com.github.shyiko:ktlint:0.31.0"
}

repositories {
mavenCentral()
}

task ktlint(type: JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt", "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/reports/ktlint.xml"
}

check.dependsOn ktlint

task ktlintFormat(type: JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}
25 changes: 25 additions & 0 deletions buildSrc/src/main/kotlin/plugins/ktlint.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
val ktlint by configurations.creating

dependencies {
ktlint("com.github.shyiko:ktlint:0.31.0")
}

tasks.register<JavaExec>("ktlint") {
main = "com.github.shyiko.ktlint.Main"
classpath = ktlint
args(
"src/**/*.kt",
"--reporter=plain",
"--reporter=checkstyle,output=${buildDir}/reports/ktlint.xml"
)
}

tasks.named("check") {
dependsOn(ktlint)
}

tasks.register<JavaExec>("ktlintFormat") {
main = "com.github.shyiko.ktlint.Main"
classpath = ktlint
args("-F", "src/**/*.kt")
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip

0 comments on commit 16bd455

Please sign in to comment.