forked from mrmans0n/compose-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
64 lines (55 loc) · 1.75 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2024 Nacho Lopez
// SPDX-License-Identifier: Apache-2.0
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.mavenPublish) apply false
alias(libs.plugins.spotless) apply false
}
allprojects {
val libs = rootProject.libs
pluginManager.apply(libs.plugins.spotless.get().pluginId)
configure<SpotlessExtension> {
kotlin {
target("**/*.kt")
// ktlint("1.1.1")
ktlint(libs.versions.ktlint.get())
licenseHeaderFile(rootProject.file("spotless/copyright.txt"))
}
}
plugins.withType<JavaPlugin> {
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true
freeCompilerArgs.addAll(
// Enable default methods in interfaces
"-Xjvm-default=all",
// Enable context receivers
"-Xcontext-receivers",
// Enable K2 compiler
"-language-version=2.0",
"-Xsuppress-version-warnings",
)
}
}
version = project.property("VERSION_NAME") ?: "0.0.0"
if (project != rootProject) {
pluginManager.apply(libs.plugins.mavenPublish.get().pluginId)
}
}
tasks.register("printVersion") {
doLast {
println(project.property("VERSION_NAME"))
}
}