-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
159 lines (138 loc) · 4.64 KB
/
build.gradle.kts
File metadata and controls
159 lines (138 loc) · 4.64 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import com.gradle.publish.PublishTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
import org.gradle.kotlin.dsl.withType
import java.net.URI
plugins {
groovy
`jvm-test-suite`
`kotlin-dsl`
id("com.gradle.plugin-publish").version("2.0.0")
if (System.getenv().containsKey("TRAVIS") || !System.getenv().containsKey("CI")) {
id("pl.droidsonroids.jacoco.testkit").version("1.0.12")
}
}
group = "com.revolut.jooq"
version = "0.3.14"
repositories {
mavenCentral()
}
java {
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
}
val isSnapshot = project.version.toString().endsWith("-SNAPSHOT")
publishing {
repositories {
val snapshotRepository by extra { project.findProperty("snapshotRepository")?.toString() ?: "" }
maven { url = URI(if (isSnapshot) snapshotRepository else "") }
}
}
tasks {
withType<JacocoReport> {
reports {
xml.required = true
html.required = false
}
setDependsOn(withType<Test>())
}
withType<PublishToMavenRepository>().configureEach {
onlyIf("publishing SNAPSHOT release to the internal repository") { isSnapshot }
setFinalizedBy(withType<PublishTask>())
}
withType<PublishTask>().configureEach {
onlyIf("publishing release to the Gradle Plugin Portal") { !isSnapshot }
}
wrapper {
gradleVersion = "9.3.1"
distributionType = ALL
}
}
afterEvaluate {
tasks.withType<JacocoReport> {
classDirectories.setFrom(classDirectories.files.map {
fileTree(it) {
exclude("com/revolut/shaded/org/testcontainers/**/*")
}
})
}
}
dependencies {
implementation("org.jooq:jooq-codegen:3.14.15")
implementation("com.github.docker-java:docker-java-transport-okhttp:3.6.0")
implementation("org.flywaydb:flyway-core:6.4.3")
implementation("org.zeroturnaround:zt-exec:1.12")
compileOnly("javax.annotation:javax.annotation-api:1.3.2")
testImplementation("org.spockframework:spock-core:2.3-groovy-4.0")
testCompileOnly(gradleTestKit())
}
testing {
suites {
@Suppress("UnstableApiUsage")
withType<JvmTestSuite>().configureEach {
useJUnitJupiter()
dependencies {
implementation(project())
implementation(platform("io.kotest:kotest-bom:5.9.1"))
implementation("io.kotest:kotest-assertions-core-jvm")
}
targets.configureEach {
testTask {
testLogging {
events(PASSED, FAILED)
showExceptions = true
showStackTraces = true
showCauses = true
exceptionFormat = FULL
}
}
}
}
@Suppress("UnstableApiUsage")
val test by existing(JvmTestSuite::class)
@Suppress("UnstableApiUsage")
val testFunctional by registering(JvmTestSuite::class) {
dependencies {
implementation(gradleTestKit())
}
targets.configureEach {
testTask.configure {
shouldRunAfter(test)
}
}
targets.register("${name}OnJava25") {
testTask.configure {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(25))
vendor.set(java.toolchain.vendor)
},
)
}
}
}
tasks.check {
dependsOn(testFunctional.map { it.targets.named(it.name) })
}
}
}
gradlePlugin {
website.set("https://github.com/revolut-engineering/jooq-plugin")
vcsUrl.set("https://github.com/revolut-engineering/jooq-plugin")
plugins {
register("jooqDockerPlugin") {
id = "com.revolut.jooq-docker"
implementationClass = "com.revolut.jooq.JooqDockerPlugin"
description = "Generates jOOQ classes using dockerized database"
displayName = "jOOQ Docker Plugin"
tags = setOf("jooq", "docker", "db")
version = project.version
}
testSourceSets(sourceSets["test"], sourceSets["testFunctional"])
}
}