diff options
Diffstat (limited to 'subprojects/language-web')
-rw-r--r-- | subprojects/language-web/build.gradle.kts | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index b59763a8..d2a39d56 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -1,6 +1,6 @@ | |||
1 | plugins { | 1 | plugins { |
2 | id("refinery-java-application") | 2 | id("tools.refinery.gradle.java-application") |
3 | id("refinery-xtext-conventions") | 3 | id("tools.refinery.gradle.xtext-generated") |
4 | } | 4 | } |
5 | 5 | ||
6 | val webapp: Configuration by configurations.creating { | 6 | val webapp: Configuration by configurations.creating { |
@@ -21,64 +21,66 @@ dependencies { | |||
21 | testImplementation(libs.jetty.websocket.client) | 21 | testImplementation(libs.jetty.websocket.client) |
22 | } | 22 | } |
23 | 23 | ||
24 | val generateXtextLanguage by project(":refinery-language").tasks.existing | ||
25 | |||
26 | for (taskName in listOf("compileJava", "processResources")) { | ||
27 | tasks.named(taskName) { | ||
28 | dependsOn(generateXtextLanguage) | ||
29 | } | ||
30 | } | ||
31 | |||
32 | application { | 24 | application { |
33 | mainClass.set("tools.refinery.language.web.ServerLauncher") | 25 | mainClass.set("tools.refinery.language.web.ServerLauncher") |
34 | // Enable JDK 19 preview features for virtual thread support. | 26 | // Enable JDK 19 preview features for virtual thread support. |
35 | applicationDefaultJvmArgs += "--enable-preview" | 27 | applicationDefaultJvmArgs += "--enable-preview" |
36 | } | 28 | } |
37 | 29 | ||
38 | tasks.withType(JavaCompile::class) { | ||
39 | options.release.set(19) | ||
40 | // Enable JDK 19 preview features for virtual thread support. | ||
41 | options.compilerArgs.plusAssign("--enable-preview") | ||
42 | } | ||
43 | |||
44 | // Enable JDK 19 preview features for virtual thread support. | 30 | // Enable JDK 19 preview features for virtual thread support. |
45 | fun enablePreview(task: JavaForkOptions) { | 31 | fun enablePreview(task: JavaForkOptions) { |
46 | task.jvmArgs("--enable-preview") | 32 | task.jvmArgs("--enable-preview") |
47 | } | 33 | } |
48 | 34 | ||
49 | tasks.withType(Test::class) { | 35 | tasks { |
50 | enablePreview(this) | 36 | val generateXtextLanguage by project(":refinery-language").tasks.existing |
51 | } | ||
52 | 37 | ||
53 | tasks.jar { | 38 | for (taskName in listOf("compileJava", "processResources")) { |
54 | dependsOn(webapp) | 39 | named(taskName) { |
55 | from(webapp) { | 40 | dependsOn(generateXtextLanguage) |
56 | into("webapp") | 41 | } |
57 | } | 42 | } |
58 | } | ||
59 | 43 | ||
60 | tasks.shadowJar { | 44 | withType(JavaCompile::class) { |
61 | dependsOn(webapp) | 45 | options.release.set(19) |
62 | from(project.sourceSets.main.map { it.output }) | 46 | // Enable JDK 19 preview features for virtual thread support. |
63 | exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA","schema/*", | 47 | options.compilerArgs.plusAssign("--enable-preview") |
64 | ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*", | 48 | } |
65 | "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**") | 49 | |
66 | append("plugin.properties") | 50 | withType(Test::class) { |
67 | from(webapp) { | 51 | enablePreview(this) |
68 | into("webapp") | 52 | } |
53 | |||
54 | jar { | ||
55 | dependsOn(webapp) | ||
56 | from(webapp) { | ||
57 | into("webapp") | ||
58 | } | ||
59 | } | ||
60 | |||
61 | shadowJar { | ||
62 | dependsOn(webapp) | ||
63 | from(project.sourceSets.main.map { it.output }) | ||
64 | exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "schema/*", | ||
65 | ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*", | ||
66 | "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**") | ||
67 | append("plugin.properties") | ||
68 | from(webapp) { | ||
69 | into("webapp") | ||
70 | } | ||
69 | } | 71 | } |
70 | } | ||
71 | 72 | ||
72 | tasks.register<JavaExec>("serveBackend") { | 73 | register<JavaExec>("serveBackend") { |
73 | dependsOn(webapp) | 74 | dependsOn(webapp) |
74 | val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath } | 75 | val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath } |
75 | dependsOn(mainRuntimeClasspath) | 76 | dependsOn(mainRuntimeClasspath) |
76 | classpath(mainRuntimeClasspath) | 77 | classpath(mainRuntimeClasspath) |
77 | mainClass.set(application.mainClass) | 78 | mainClass.set(application.mainClass) |
78 | enablePreview(this) | 79 | enablePreview(this) |
79 | standardInput = System.`in` | 80 | standardInput = System.`in` |
80 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() | 81 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() |
81 | environment("BASE_RESOURCE", baseResource) | 82 | environment("BASE_RESOURCE", baseResource) |
82 | group = "run" | 83 | group = "run" |
83 | description = "Start a Jetty web server serving the Xtex API and assets." | 84 | description = "Start a Jetty web server serving the Xtex API and assets." |
85 | } | ||
84 | } | 86 | } |