-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
102 lines (89 loc) · 2.87 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
plugins {
base
id("com.diffplug.eclipse.apt") version "3.22.0" apply false
}
val encoding: String by project
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
subprojects {
apply(plugin = "java-library")
apply(plugin = "com.diffplug.eclipse.apt")
val path = "src/main/java/example"
val entitySize = 200
val propertySize = 500
val delete by tasks.registering(Delete::class) {
delete(path)
}
val generate by tasks.registering {
mustRunAfter(delete)
doLast {
val dir = project.file(path)
if (!dir.exists()) {
dir.mkdirs()
}
for (i in 1..entitySize) {
val lines = mutableListOf<String>()
lines.add("package example;")
lines.add("")
lines.add("import org.seasar.doma.Entity;")
lines.add("")
lines.add("@Entity")
lines.add("public class Entity${i} {")
for (j in 1..propertySize) {
lines.add(" public String p${j};")
}
lines.add("}")
val file = dir.resolve("Entity${i}.java")
file.writeText(lines.joinToString("\n"))
}
}
}
val clean by tasks.existing {
dependsOn(delete, generate)
}
val compileJava by tasks.existing(JavaCompile::class) {
options.encoding = encoding
}
val compileTestJava by tasks.existing(JavaCompile::class) {
options.encoding = encoding
options.compilerArgs = listOf("-proc:none")
}
val test by tasks.existing(Test::class) {
maxHeapSize = "1g"
useJUnitPlatform()
}
dependencies {
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.6.2")
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.6.2")
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
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"
}
}
}