-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
137 lines (120 loc) · 5.2 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import io.art.gradle.common.constants.BUILD_JAR_EXECUTABLE_TASK
import io.art.gradle.common.constants.WRITE_CONFIGURATION_TASK
plugins {
`java-library`
id("art-internal-jvm")
kotlin("jvm")
}
tasks.withType(type = Wrapper::class) {
gradleVersion = "8.5"
}
allprojects {
group = "io.art.generator"
repositories { mavenCentral() }
}
dependencies {
val lombokVersion: String by project
val junitVersion: String by project
val javaPoetVersion: String by project
val kotlinPoetVersion: String by project
val artKotlinVersion: String by project
val kotlinCompilerVersion: String by project
val kotlinCompilingTestingVersion: String by project
embedded(kotlin("stdlib-jdk8", kotlinCompilerVersion))
embedded(kotlin("compiler-embeddable", kotlinCompilerVersion))
embedded(kotlin("reflect", kotlinCompilerVersion))
embedded("io.art.kotlin:core:$artKotlinVersion")
embedded("io.art.kotlin:launcher:$artKotlinVersion")
embedded("io.art.kotlin:configurator:$artKotlinVersion")
embedded("io.art.kotlin:logging:$artKotlinVersion")
embedded("io.art.kotlin:meta:$artKotlinVersion")
embedded("org.projectlombok", "lombok", lombokVersion)
embedded("com.squareup", "javapoet", javaPoetVersion)
embedded("com.squareup", "kotlinpoet", kotlinPoetVersion)
testImplementation(kotlin("stdlib-jdk8", kotlinCompilerVersion))
testImplementation(kotlin("compiler-embeddable", kotlinCompilerVersion))
testImplementation(kotlin("reflect", kotlinCompilerVersion))
testImplementation("io.art.kotlin:core:$artKotlinVersion")
testImplementation("io.art.kotlin:launcher:$artKotlinVersion")
testImplementation("io.art.kotlin:configurator:$artKotlinVersion")
testImplementation("io.art.kotlin:scheduler:$artKotlinVersion")
testImplementation("io.art.kotlin:logging:$artKotlinVersion")
testImplementation("io.art.kotlin:meta:$artKotlinVersion")
testImplementation("dev.zacsweers.kctfork:core:$kotlinCompilingTestingVersion")
testImplementation("org.projectlombok", "lombok", lombokVersion)
annotationProcessor("org.projectlombok", "lombok", lombokVersion)
testAnnotationProcessor("org.projectlombok", "lombok", lombokVersion)
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
}
sourceSets {
test {
java {
srcDir("src/test/kotlin-sources")
srcDir("src/test/java-sources")
srcDir("src/test/mixed-sources")
}
}
}
generator {
source("Example") {
modulePackage("")
jvm()
sourcesPattern { exclude("**/main/*", "**/kotlin/*") }
}
main {
consoleLogging()
disableRunning()
}
}
executable {
jar {
configureRun {
val configurationPath = generator.mainConfiguration.workingDirectory
.resolve("module.yml")
.toFile()
.absolutePath
dependsOn(WRITE_CONFIGURATION_TASK)
jvmArgs("-Xms2g", "-Xmx2g")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED")
jvmArgs("-Dconfiguration=$configurationPath")
}
}
main("io.art.generator.Generator")
}
tasks.build {
dependsOn(BUILD_JAR_EXECUTABLE_TASK)
}
afterEvaluate {
tasks.forEach { task -> if (task.name.contains("publish")) task.dependsOn("build-jar-executable") }
}
tasks.test {
testLogging {
showStandardStreams = true
}
val configurationPath = generator.mainConfiguration.workingDirectory
.resolve("module.yml")
.toFile()
.absolutePath
dependsOn(BUILD_JAR_EXECUTABLE_TASK)
dependsOn(WRITE_CONFIGURATION_TASK)
useJUnitPlatform()
jvmArgs("-Xms2g", "-Xmx2g")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED")
jvmArgs("--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED")
jvmArgs("-Dconfiguration=$configurationPath")
jvmArgs("-Djar=${layout.buildDirectory.file("executable").get().asFile.resolve("art-generator.jar").absolutePath}")
}