Skip to content

Commit

Permalink
Create ktlint precompiled plugin and add it to app/build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierSegoviaCordoba committed May 13, 2020
1 parent f67ea68 commit 346798c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 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: 0 additions & 2 deletions pubg-api-sample.properties

This file was deleted.

0 comments on commit 346798c

Please sign in to comment.