Skip to content

Commit

Permalink
+ ktlint-gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gciatto committed Sep 11, 2020
1 parent 99d608c commit cd6a158
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ plugins {
id("org.danilopianini.git-sensitive-semantic-versioning") version Versions.org_danilopianini_git_sensitive_semantic_versioning_gradle_plugin
id("de.fayard.buildSrcVersions") version Versions.de_fayard_buildsrcversions_gradle_plugin
id("com.github.breadmoirai.github-release") version Versions.com_github_breadmoirai_github_release_gradle_plugin
id("org.jlleitschuh.gradle.ktlint") version "9.4.0"
}

repositories {
Expand Down Expand Up @@ -175,6 +176,7 @@ ktSubprojects.forEachProject {
}
}

configureKtLint()
configureDokka("jvm", "js")
configureMavenPublications("packDokka")
configureUploadToMavenCentral()
Expand All @@ -192,6 +194,7 @@ jvmSubprojects.forEachProject {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "com.jfrog.bintray")

configureKtLint()
configureDokka()
createMavenPublications("jvm", "java", docArtifact = "packDokka")
configureUploadToMavenCentral()
Expand All @@ -207,14 +210,15 @@ jsSubprojects.forEachProject {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "com.jfrog.bintray")

configureKtLint()
configureDokka()
createMavenPublications("js", "kotlin", docArtifact = "packDokka")
configureUploadToMavenCentral()
configureUploadToBintray()
configureSigning()
}

configure<GithubReleaseExtension> {
githubRelease {
if (githubToken != null) {
token(githubToken)
owner(githubOwner)
Expand All @@ -237,6 +241,20 @@ configure<GithubReleaseExtension> {
}
}

fun Project.configureKtLint() {
apply(plugin = "org.jlleitschuh.gradle.ktlint")

ktlint {
debug.set(false)
ignoreFailures.set(false)
enableExperimentalRules.set(true)
filter {
exclude("**/generated/**")
include("**/kotlin/**")
}
}
}

fun Project.configureUploadToGithub(
jarTaskPositiveFilter: (String) -> Boolean = { "jar" in it },
jarTaskNegativeFilter: (String) -> Boolean = { "dokka" in it || "source" in it }
Expand Down

0 comments on commit cd6a158

Please sign in to comment.