aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/language-web/build.gradle.kts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-08 22:56:44 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-08 22:58:21 +0200
commit561fac70fd3dc3ebe1cfbc50146757495fb828d5 (patch)
tree20aa72bbe438aaa70c8de264ff0d366758e7772d /subprojects/language-web/build.gradle.kts
parentrefactor: remove TupleLike (diff)
downloadrefinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.gz
refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.zst
refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.zip
build: convert Gradle scripts to Kotlin
Improves IDE support build scripts in IntelliJ. There is no Eclipse IDE support, but Eclipse didn't have support for Groovy either, so there is no degradation of functionality.
Diffstat (limited to 'subprojects/language-web/build.gradle.kts')
-rw-r--r--subprojects/language-web/build.gradle.kts91
1 files changed, 91 insertions, 0 deletions
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts
new file mode 100644
index 00000000..c68daa9a
--- /dev/null
+++ b/subprojects/language-web/build.gradle.kts
@@ -0,0 +1,91 @@
1plugins {
2 id("refinery-java-application")
3 id("refinery-xtext-conventions")
4}
5
6val webapp: Configuration by configurations.creating {
7 isCanBeConsumed = false
8 isCanBeResolved = true
9}
10
11configurations.all {
12 // Use log4j-over-slf4j instead of log4j 1.x
13 exclude(group = "log4j", module = "log4j")
14}
15
16dependencies {
17 implementation(project(":refinery-language"))
18 implementation(project(":refinery-language-ide"))
19 implementation(libs.jetty.server)
20 implementation(libs.jetty.servlet)
21 implementation(libs.jetty.websocket.server)
22 implementation(libs.slf4j.api)
23 implementation(libs.slf4j.simple)
24 implementation(libs.slf4j.log4j)
25 implementation(libs.xtext.web)
26 webapp(project(path = ":refinery-frontend", configuration = "productionAssets"))
27 testImplementation(testFixtures(project(":refinery-language")))
28 testImplementation(libs.jetty.websocket.client)
29}
30
31val generateXtextLanguage = project(":refinery-language").tasks.named("generateXtextLanguage")
32
33for (taskName in listOf("compileJava", "processResources")) {
34 tasks.named(taskName) {
35 dependsOn(generateXtextLanguage)
36 }
37}
38
39application {
40 mainClass.set("tools.refinery.language.web.ServerLauncher")
41 // Enable JDK 19 preview features for virtual thread support.
42 applicationDefaultJvmArgs += "--enable-preview"
43}
44
45tasks.withType(JavaCompile::class) {
46 options.release.set(19)
47 // Enable JDK 19 preview features for virtual thread support.
48 options.compilerArgs.plusAssign("--enable-preview")
49}
50
51// Enable JDK 19 preview features for virtual thread support.
52fun enablePreview(task: JavaForkOptions) {
53 task.jvmArgs("--enable-preview")
54}
55
56tasks.withType(Test::class) {
57 enablePreview(this)
58}
59
60tasks.jar {
61 dependsOn(webapp)
62 from(webapp) {
63 into("webapp")
64 }
65}
66
67tasks.shadowJar {
68 dependsOn(webapp)
69 from(project.sourceSets.main.map { it.output })
70 exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA","schema/*",
71 ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*",
72 "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**")
73 append("plugin.properties")
74 from(webapp) {
75 into("webapp")
76 }
77}
78
79tasks.register("serveBackend", JavaExec::class) {
80 dependsOn(webapp)
81 val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath }
82 dependsOn(mainRuntimeClasspath)
83 classpath(mainRuntimeClasspath)
84 mainClass.set(application.mainClass)
85 enablePreview(this)
86 standardInput = System.`in`
87 val baseResource = webapp.incoming.artifacts.artifactFiles.first()
88 environment("BASE_RESOURCE", baseResource)
89 group = "run"
90 description = "Start a Jetty web server serving the Xtex API and assets."
91}