This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
113 lines (99 loc) · 3.54 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
plugins {
base
id("com.diffplug.eclipse.apt") version "3.33.1" apply false
id("com.diffplug.spotless") version "5.17.0" apply false
id("org.seasar.doma.compile") version "1.1.0" apply false
kotlin("jvm") version "1.5.31" apply false
kotlin("kapt") version "1.5.31" apply false
}
subprojects {
apply(plugin = "java")
apply(plugin = "com.diffplug.eclipse.apt")
apply(plugin = "com.diffplug.spotless")
apply(plugin ="org.seasar.doma.compile")
tasks {
fun Test.prepare(driver: String) {
val urlKey = "$driver.url"
val url = project.property(urlKey) ?: throw GradleException("The $urlKey property is not found.")
this.systemProperty("driver", driver)
this.systemProperty("url", url)
maxHeapSize = "1g"
useJUnitPlatform()
}
named<Test>("test") {
val driver: Any by project
prepare(driver.toString())
}
val h2 by registering(Test::class) {
prepare("h2")
}
val mysql by registering(Test::class) {
prepare("mysql")
}
val oracle by registering(Test::class) {
prepare("oracle")
}
val postgresql by registering(Test::class) {
prepare("postgresql")
}
val sqlserver by registering(Test::class) {
prepare("sqlserver")
}
register("testAll") {
dependsOn(h2, mysql, oracle, postgresql, sqlserver)
}
named("build") {
dependsOn("spotlessApply")
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
"testImplementation"(platform("org.testcontainers:testcontainers-bom:1.16.0"))
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.8.1")
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.8.1")
"testRuntimeOnly"("com.h2database:h2:1.4.200")
"testRuntimeOnly"("mysql:mysql-connector-java:8.0.27")
"testRuntimeOnly"("com.oracle.database.jdbc:ojdbc8-production:18.15.0.0")
"testRuntimeOnly"("org.postgresql:postgresql:42.3.0")
"testRuntimeOnly"("com.microsoft.sqlserver:mssql-jdbc:8.4.1.jre8")
"testRuntimeOnly"("org.testcontainers:mysql")
"testRuntimeOnly"("org.testcontainers:oracle-xe")
"testRuntimeOnly"("org.testcontainers:postgresql")
"testRuntimeOnly"("org.testcontainers:mssqlserver")
}
configure<org.gradle.plugins.ide.eclipse.model.EclipseModel> {
classpath {
file {
whenMerged {
val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
classpath.entries.removeAll {
when (it) {
is org.gradle.plugins.ide.eclipse.model.Output -> it.path == ".apt_generated"
else -> false
}
}
}
withXml {
val node = asNode()
node.appendNode("classpathentry", mapOf("kind" to "src", "output" to "bin/main", "path" to ".apt_generated"))
}
}
}
jdt {
javaRuntimeName = "JavaSE-1.8"
}
}
}
gradle.taskGraph.whenReady {
val enableAdditionalFeatures: String? by project
allTasks.forEach {
if (it.project.name == "jep") {
it.onlyIf {
enableAdditionalFeatures != null
}
}
}
}