Created
December 13, 2020 03:13
-
-
Save soulduse/54e3c95f256e0ba95ca099290e910417 to your computer and use it in GitHub Desktop.
Root Gradle 설정
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val projectGroup: String by project | |
val projectVersion: String by project | |
val kotlinVersion: String by project | |
val ktlintVersion: String by project | |
plugins { | |
val kotlinVersion = "1.4.10" | |
kotlin("jvm") version kotlinVersion | |
kotlin("kapt") version kotlinVersion | |
} | |
allprojects { | |
group = projectGroup | |
version = projectVersion | |
repositories { | |
jcenter() | |
mavenCentral() | |
} | |
} | |
subprojects { | |
apply { | |
plugin("kotlin") | |
} | |
val ktlint by configurations.creating | |
dependencies { | |
implementation("org.jetbrains.kotlin:kotlin-stdlib") | |
ktlint("com.pinterest:ktlint:$ktlintVersion") | |
} | |
java { | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
} | |
tasks { | |
val outputDir = "${project.buildDir}/reports/ktlint" | |
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) | |
val ktlintCheck by creating(JavaExec::class) { | |
inputs.files(inputFiles) | |
outputs.dir(outputDir) | |
description = "Check Kotlin code style." | |
classpath = ktlint | |
main = "com.pinterest.ktlint.Main" | |
args = listOf("src/**/*.kt") | |
} | |
val ktlintFormat by creating(JavaExec::class) { | |
inputs.files(inputFiles) | |
outputs.dir(outputDir) | |
description = "Fix Kotlin code style deviations." | |
classpath = ktlint | |
main = "com.pinterest.ktlint.Main" | |
args = listOf("-F", "src/**/*.kt") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ktlint를 사용하는 이유는 좀더 깔끔한 코드 관리를 위해 사용하게 되었습니다.
불필요한 쓰레기 코드가 남는것을 방지하고, 코드 스타일(린트)를 통일 하기 위해 사용합니다.
https://github.com/pinterest/ktlint