From eaa6ff6f2f540b1b5e149fc65b8b6c38690c62ef Mon Sep 17 00:00:00 2001 From: Gary Tierney Date: Wed, 22 Aug 2018 22:59:25 +0100 Subject: [PATCH] Add ktlint Gradle plugin --- build.gradle | 1 + gradle/kotlin.gradle | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 89929478..d349e536 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id 'org.jetbrains.kotlin.jvm' version "1.2.60" apply(false) + id 'org.jmailen.kotlinter' version '1.16.0' apply(false) } allprojects { diff --git a/gradle/kotlin.gradle b/gradle/kotlin.gradle index 0851617e..88332919 100644 --- a/gradle/kotlin.gradle +++ b/gradle/kotlin.gradle @@ -1,5 +1,20 @@ allprojects { - plugins.withId('kotlin') { + if (it.pluginManager.hasPlugin('kotlin') || it.pluginManager.hasPlugin('apollo-plugin')) { + + } +} + +gradle.projectsEvaluated { + configure(subprojects.findAll { it.pluginManager.hasPlugin('kotlin') }) { + apply plugin: 'org.jmailen.kotlinter' + + kotlinter { + ignoreFailures = true + indentSize = 4 + continuationIndentSize = 4 + reporters = ['checkstyle', 'plain'] + } + kotlin { experimental { coroutines 'enable' } } } -} \ No newline at end of file +}