-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
80 lines (68 loc) · 1.73 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import com.xenoterracide.gradle.semver.GitMetadataExtension
import java.nio.charset.StandardCharsets
plugins {
`java-library`
alias(libs.plugins.dotenv)
alias(libs.plugins.versionCheck)
alias(libs.plugins.semver)
alias(libs.plugins.spotless)
}
val git: GitMetadataExtension = semver.git
extra[BRANCH_KEY] = git.branch
extra[GIT_HASH_KEY] = git.commit
extra[LATEST_TAG_KEY] = git.latestTag
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven { setUrl("https://jitpack.io") }
gradlePluginPortal()
google()
}
}
subprojects {
apply<JavaLibraryPlugin>()
val jdkVersion: String =
rootProject.libs.versions.jdk
.get()
tasks.compileJava {
options.encoding = StandardCharsets.UTF_8.name()
options.isFork = true
options.isDebug = true
options.isIncremental = true
}
tasks.jar { duplicatesStrategy = DuplicatesStrategy.INCLUDE }
tasks.test {
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
forkEvery = 100
reports.html.required.set(false)
reports.junitXml.required.set(false)
}
java {
modularity.inferModulePath.set(true)
sourceCompatibility = JavaVersion.toVersion(jdkVersion)
targetCompatibility = JavaVersion.toVersion(jdkVersion)
}
}
spotless {
java {
target("*.java")
importOrder()
removeUnusedImports()
indentWithSpaces(2)
formatAnnotations()
.addTypeAnnotation("Empty")
.addTypeAnnotation("NonEmpty")
.removeTypeAnnotation("Localized")
}
kotlinGradle {
target("**/*.gradle.kts")
ktfmt()
ktlint()
.setEditorConfigPath(
"${rootProject.layout.projectDirectory}/.editorconfig",
)
indentWithSpaces(IDENT_WIDTH)
}
}