-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
59 lines (52 loc) · 1.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
import buildsrc.utils.generatedKotlinDslAccessorDirs
plugins {
buildsrc.conventions.base
idea
}
group = "dev.adamko.kotlin.binary-compatibility-validator"
project.version = object {
private val gitVersion = project.gitVersion
override fun toString(): String = gitVersion.get()
}
idea {
module {
excludeDirs = excludeDirs +
layout.generatedKotlinDslAccessorDirs() +
layout.files(
".idea",
"gradle/wrapper",
)
}
}
val readmeCheck by tasks.registering {
group = LifecycleBasePlugin.VERIFICATION_GROUP
val readme = providers.fileContents(layout.projectDirectory.file("README.md")).asText
val supportedGradleVersion = libs.versions.supportedGradleVersion
val kotlinBcvVersion = libs.versions.kotlinx.bcv
doLast {
readme.get().let { readme ->
require("BCV version `${kotlinBcvVersion.get()}`" in readme) {
"Incorrect BCV version in README"
}
require("kotlinxBinaryCompatibilityValidatorVersion.set(\"${kotlinBcvVersion.get()}\")" in readme) {
"Incorrect BCV version in README"
}
require("The minimal supported Gradle version is ${supportedGradleVersion.get()}" in readme) {
"Incorrect Gradle version in README"
}
}
}
}
tasks.check {
dependsOn(readmeCheck)
}
val projectVersion by tasks.registering {
description = "prints the project version"
group = "help"
val version = providers.provider { project.version }
inputs.property("version", version)
outputs.cacheIf("logging task, it should always run") { false }
doLast {
logger.quiet("${version.orNull}")
}
}