Add ktlint check.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-07-29 22:31:20 +02:00
parent 343d6fc4d7
commit 2d3316964a
5 changed files with 19 additions and 2 deletions

View File

@ -1,15 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'dependencies.gradle'
buildscript {
apply from: 'dependencies.gradle'
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath gradlePlugins.androidTools
classpath gradlePlugins.kotlin
classpath gradlePlugins.ktlintGradle
}
}

View File

@ -5,6 +5,8 @@ ext.versions = [
buildTools : "25.0.3",
androidTools : "2.3.3",
ktlint : "0.9.0",
ktlintGradle : "2.1.0",
androidSupport : "22.2.1",
@ -23,6 +25,7 @@ ext.versions = [
ext.gradlePlugins = [
androidTools : "com.android.tools.build:gradle:$versions.androidTools",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin",
ktlintGradle : "gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:$versions.ktlintGradle",
]
ext.androidSupport = [

View File

@ -0,0 +1,10 @@
// Applies code quality plugins when -Pqc is passed to the gradle
def isCodeQualityEnabled = project.hasProperty('qc')
if (isCodeQualityEnabled) {
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
version = versions.ktlint
}
}

View File

@ -1,4 +1,5 @@
apply plugin: 'kotlin'
apply from: '../gradle_scripts/code_quality.gradle'
sourceSets {
main.java.srcDirs += 'src/main/kotlin'

View File

@ -1,5 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "../gradle_scripts/code_quality.gradle"
android {
compileSdkVersion versions.compileSdk