plugins { id 'refinery-java-application' id 'refinery-xtext-conventions' } configurations { webapp { canBeConsumed = false canBeResolved = true } all { // Use log4j-over-slf4j instead of log4j 1.x exclude group: 'log4j', module: 'log4j' } } dependencies { implementation project(':refinery-language') implementation project(':refinery-language-ide') implementation libs.jetty.server implementation libs.jetty.servlet implementation libs.jetty.websocket.server implementation libs.slf4j.api implementation libs.slf4j.simple implementation libs.slf4j.log4j implementation libs.xtext.web webapp project(path: ':refinery-frontend', configuration: 'productionAssets') testImplementation testFixtures(project(':refinery-language')) testImplementation libs.jetty.websocket.client } def generateXtextLanguage = project(':refinery-language').tasks.named('generateXtextLanguage') for (taskName in ['compileJava', 'processResources']) { tasks.named(taskName) { dependsOn generateXtextLanguage } } mainClassName = 'tools.refinery.language.web.ServerLauncher' // Enable JDK 19 preview features for virtual thread support. application { applicationDefaultJvmArgs += '--enable-preview' } tasks.withType(JavaCompile) { options.release = 19 options.compilerArgs += '--enable-preview' } tasks.withType(Test) { jvmArgs += '--enable-preview' } tasks.named('jar') { dependsOn project.configurations.webapp from(project.configurations.webapp) { into 'webapp' } } tasks.named('shadowJar') { dependsOn project.configurations.webapp from(project.sourceSets.main.output) configurations = [project.configurations.runtimeClasspath] exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*', '.options', '.api_description', '*.profile', 'about.*', 'about_*.html', 'about_files/*', 'plugin.xml', 'systembundle.properties', 'profile.list', 'META-INF/resources/xtext/**') append('plugin.properties') from(project.configurations.webapp) { into 'webapp' } } tasks.register('serveBackend', JavaExec) { dependsOn project.configurations.webapp dependsOn sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath mainClass = mainClassName // Enable JDK 19 preview features for virtual thread support. jvmArgs += '--enable-preview' standardInput = System.in def baseResource = project.configurations.webapp.incoming.artifacts.artifactFiles.first() environment BASE_RESOURCE: baseResource group = 'run' description = 'Start a Jetty web server serving the Xtex API and assets.' }