-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
79 lines (70 loc) · 2.76 KB
/
build.gradle
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
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapperKt
plugins {
alias(libs.plugins.starter.config)
alias(libs.plugins.starter.versioning)
alias(libs.plugins.kotlin.jvm) apply(false)
alias(libs.plugins.starter.library.kotlin) apply(false)
alias(libs.plugins.kotlinx.binarycompatibility) apply(false)
}
commonConfig {
javaFilesAllowed false
javaVersion JavaVersion.VERSION_11
}
allprojects {
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { plugin ->
def kotlinVersion = KotlinPluginWrapperKt.getKotlinPluginVersion(project)
configurations.matching { it.name != "detekt" }.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == 'org.jetbrains.kotlin' && requested.name.startsWith("kotlin")) {
useVersion kotlinVersion
}
}
}
kotlin {
jvmToolchain(libs.versions.java.compilation.get().toInteger())
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask).configureEach {
compilerOptions {
freeCompilerArgs.add("-Xlambdas=class")
}
}
}
pluginManager.withPlugin("java-gradle-plugin") {
configurations {
register("testRuntimeDependencies") {
attributes {
// KGP publishes multiple variants https://kotlinlang.org/docs/whatsnew17.html#support-for-gradle-plugin-variants
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.class, Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.class, Category.LIBRARY))
}
}
}
// Required to put the Kotlin plugin on the classpath for the functional test suite
tasks.withType(PluginUnderTestMetadata).configureEach {
pluginClasspath.from(configurations.testRuntimeDependencies)
}
}
tasks.withType(Test).configureEach {
doLast {
Thread.sleep(2000) // https://github.com/gradle/gradle/issues/16603
}
}
pluginManager.withPlugin("java") {
if (project.hasProperty("skipJarVersion")) {
def projectName = project.name
tasks.named("jar") {
archiveFile.set(layout.buildDirectory.map {it.file("libs/${projectName}.jar")})
}
}
}
pluginManager.withPlugin("io.github.usefulness.ktlint-gradle-plugin") {
ktlint {
ktlintVersion = libs.versions.maven.ktlint.get()
}
}
pluginManager.withPlugin(libs.plugins.kotlin.samwithreceiver.get().pluginId) {
samWithReceiver {
annotation("org.gradle.api.HasImplicitReceiver")
}
}
}