-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
92 lines (80 loc) · 2.86 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
92 lines (80 loc) · 2.86 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
`java-gradle-plugin`
`kotlin-dsl`
`maven-publish`
alias(libs.plugins.spotless)
}
group = "org.checkerframework"
version = "0.9.0-SNAPSHOT"
repositories { mavenCentral() }
publishing { repositories { mavenLocal() } }
dependencies { implementation(kotlin("stdlib-jdk8")) }
gradlePlugin {
// TODO: Update the URLs.
website.set("https://github.com/kelloggm/checkerframework-gradle-plugin/blob/master/README.md")
vcsUrl.set("https://github.com/kelloggm/checkerframework-gradle-plugin")
plugins {
register("checkerframework") {
id = "org.checkerframework"
displayName = "Checker Framework Gradle Plugin"
description =
"Gradle build logic for pluggable type-checking of Java via the Checker Framework"
implementationClass = "org.checkerframework.plugin.gradle.CheckerFrameworkPlugin"
tags.addAll(
"checkerframework",
"checker",
"typechecker",
"pluggable types",
"formal verification",
)
}
}
}
testing {
suites {
withType<JvmTestSuite>().configureEach {
useJUnitJupiter(libs.versions.junitJupiter)
dependencies { implementation(libs.truth) }
targets.configureEach {
testTask {
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
}
}
}
}
val test by getting(JvmTestSuite::class) { dependencies { implementation(project()) } }
register<JvmTestSuite>("functionalTest") {
dependencies { implementation(gradleTestKit()) }
// associate with main Kotlin compilation to access internal constants
kotlin.target.compilations.named(name) { associateWith(kotlin.target.compilations["main"]) }
// make plugin-under-test-metadata.properties accessible to TestKit
gradlePlugin.testSourceSet(sources)
targets.configureEach {
testTask {
shouldRunAfter(test)
val testJavaToolchain = project.findProperty("test.java-toolchain")
testJavaToolchain?.also {
val launcher =
project.javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(testJavaToolchain.toString()))
}
val metadata = launcher.get().metadata
systemProperty("test.java-version", metadata.languageVersion.asInt())
systemProperty("test.java-home", metadata.installationPath.asFile.canonicalPath)
val testGradleVersion = project.findProperty("test.gradle-version")
testGradleVersion?.also { systemProperty("test.gradle-version", testGradleVersion) }
}
}
}
}
}
}
tasks { check { dependsOn(testing.suites) } }
spotless {
kotlinGradle { ktfmt().googleStyle() }
kotlin { ktfmt().googleStyle() }
}