-
-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathconfig-kotlin.gradle.kts
More file actions
137 lines (120 loc) · 3.48 KB
/
config-kotlin.gradle.kts
File metadata and controls
137 lines (120 loc) · 3.48 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import com.diffplug.gradle.spotless.SpotlessExtension
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
idea
id("org.gradle.kotlin.kotlin-dsl")
}
java {
withSourcesJar()
}
tasks.withType(JavaCompile::class).configureEach {
options.release = 17
}
kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(21)
}
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=17")
}
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/") {
mavenContent {
includeGroup("io.codechicken")
includeGroup("net.fabricmc")
includeGroupAndSubgroups("io.papermc")
}
}
maven("https://maven.neoforged.net/releases") {
name = "NeoForged"
mavenContent {
releasesOnly()
includeGroupAndSubgroups("net.neoforged")
}
}
maven("https://maven.fabricmc.net") {
name = "FabricMC"
mavenContent {
releasesOnly()
includeGroupAndSubgroups("net.fabricmc")
}
}
mavenCentral {
mavenContent { releasesOnly() }
}
gradlePluginPortal()
}
dependencies {
compileOnly(gradleApi())
}
testing {
suites {
val test by getting(JvmTestSuite::class) {
useKotlinTest(embeddedKotlinVersion)
dependencies {
implementation("org.junit.jupiter:junit-jupiter-engine:6.0.3")
implementation("org.junit.jupiter:junit-jupiter-params:6.0.3")
implementation("org.junit.platform:junit-platform-launcher:6.0.3")
}
targets.configureEach {
testTask {
testLogging {
events(TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
}
}
}
}
}
}
configurations.all {
if (name == "compileOnly") {
return@all
}
dependencies.remove(project.dependencies.gradleApi())
}
tasks.jar {
manifest {
attributes(
"Implementation-Version" to project.version
)
}
}
// The following is to work around https://github.com/diffplug/spotless/issues/1599
// Ensure the ktlint step is before the license header step
plugins.apply("com.diffplug.spotless")
extensions.configure<SpotlessExtension> {
val overrides = mapOf(
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_filename" to "disabled",
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
)
val ktlintVer = "0.50.0"
kotlin {
ktlint(ktlintVer).editorConfigOverride(overrides)
}
kotlinGradle {
ktlint(ktlintVer).editorConfigOverride(overrides)
}
}
plugins.apply("net.kyori.indra.licenser.spotless")
extensions.configure<IndraSpotlessLicenserExtension> {
licenseHeaderFile(rootProject.file("license/copyright.txt"))
newLine(true)
}
tasks.register("format") {
group = "formatting"
description = "Formats source code according to project style"
dependsOn(tasks.named("spotlessApply"))
}
idea {
module {
isDownloadSources = true
}
}