-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
144 lines (117 loc) · 3.58 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
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
138
139
140
141
142
143
144
@file:Suppress("DSL_SCOPE_VIOLATION")
import io.gitlab.arturbosch.detekt.DetektPlugin
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
import org.plank.build.LocalProperties
buildscript {
repositories {
maven("https://jitpack.io")
mavenCentral()
}
dependencies {
classpath(libs.antlr.kotlin.gradle)
}
}
plugins {
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.detekt) apply false
}
group = "org.plank"
version = "1.0-SNAPSHOT"
LocalProperties.init(rootProject)
repositories {
mavenCentral()
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.multiplatform")
apply<DetektPlugin>()
apply<KtlintPlugin>()
repositories {
mavenCentral()
mavenLocal()
maven("https://repo.binom.pw")
maven("https://repo.binom.pw/releases")
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
group = rootProject.group
version = rootProject.version
configure<KtlintExtension> {
android.set(false)
additionalEditorconfigFile.set(rootProject.file(".editorconfig"))
}
configure<DetektExtension> {
buildUponDefaultConfig = true
allRules = false
config = files("${rootProject.projectDir}/config/detekt.yml")
baseline = file("${rootProject.projectDir}/config/baseline.xml")
}
configure<KotlinMultiplatformExtension> {
linuxX64("linuxX64")
mingwX64("mingwX64")
jvm {
compilations.all {
kotlinOptions.jvmTarget = "16"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
testLogging.showStandardStreams = true
testLogging.exceptionFormat = TestExceptionFormat.FULL
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
afterEvaluate {
implementation(libs.kt.test.common)
implementation(libs.kt.test.annotations.common)
}
}
}
val linuxX64Main by getting
val linuxX64Test by getting
val mingwX64Main by getting
val mingwX64Test by getting
val nativeMain by creating {
dependsOn(commonMain)
linuxX64Main.dependsOn(this)
mingwX64Main.dependsOn(this)
}
val nativeTest by creating {
dependsOn(commonTest)
linuxX64Test.dependsOn(this)
mingwX64Test.dependsOn(this)
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xskip-metadata-version-check"
}
afterEvaluate {
val kotlin: KotlinMultiplatformExtension by extensions
val compilation = kotlin.targets["metadata"].compilations["nativeMain"]
compilation.compileKotlinTask.doFirst {
compilation.compileDependencyFiles = compilation.compileDependencyFiles
.filterNot { it.absolutePath.endsWith("klib/common/stdlib") }
.let { files(it) }
}
kotlin.targets.findByName("jvm")?.apply {
this as KotlinJvmTarget
compilations.all {
kotlinOptions.jvmTarget = "11"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
}
}
}