diff --git a/buildSrc/src/main/groovy/io.deephaven.java-toolchain-conventions.gradle b/buildSrc/src/main/groovy/io.deephaven.java-toolchain-conventions.gradle index edbb56de2e4..bab270a6213 100644 --- a/buildSrc/src/main/groovy/io.deephaven.java-toolchain-conventions.gradle +++ b/buildSrc/src/main/groovy/io.deephaven.java-toolchain-conventions.gradle @@ -12,8 +12,6 @@ def runtimeVersion = Integer.parseInt((String)project.findProperty('runtimeVersi def testLanguageLevel = Integer.parseInt((String)project.findProperty('testLanguageLevel') ?: '11') def testRuntimeVersion = Integer.parseInt((String)project.findProperty('testRuntimeVersion') ?: '11') -def excludeReleaseFlag = project.hasProperty('excludeReleaseFlag') - if (languageLevel > compilerVersion) { throw new IllegalArgumentException("languageLevel must be less than or equal to compileVersion") } @@ -63,15 +61,14 @@ tasks.withType(JavaCompile).configureEach { options.incremental = true options.compilerArgs << '-parameters' - if (!excludeReleaseFlag) { - def checkLevel = (name == 'compileTestJava') ? testLanguageLevel : languageLevel - if (compilerVersion != checkLevel) { - options.release.set checkLevel + if (name == 'compileTestJava') { + if (compilerVersion != testLanguageLevel) { + options.release.set testLanguageLevel } } else { - // This is a special case; without this we still get a failure about - // --add-opens together with --release for the hotspot-impl module. - sourceCompatibility = languageLevel + if (compilerVersion != languageLevel) { + options.release.set languageLevel + } } } diff --git a/docker/server-slim/build.gradle b/docker/server-slim/build.gradle index 8aad18778d2..d748ac65b6b 100644 --- a/docker/server-slim/build.gradle +++ b/docker/server-slim/build.gradle @@ -12,7 +12,7 @@ configurations { } dependencies { - serverApplicationDist project(path: ':server-netty', configuration: 'applicationDist') + serverApplicationDist project(path: ':server-netty-app', configuration: 'applicationDist') } def dockerContext = project.layout.buildDirectory.dir('context') diff --git a/docker/server/build.gradle b/docker/server/build.gradle index 91ccfc271c5..dc749db6c17 100644 --- a/docker/server/build.gradle +++ b/docker/server/build.gradle @@ -35,7 +35,7 @@ configurations { } dependencies { - serverApplicationDist project(path: ':server-netty', configuration: 'applicationDist') + serverApplicationDist project(path: ':server-netty-app', configuration: 'applicationDist') } def dockerLicenses = License.createFrom(project).syncDockerLicense().get() diff --git a/hotspot-impl/build.gradle b/hotspot-impl/build.gradle index 715d520f734..385d8acc032 100644 --- a/hotspot-impl/build.gradle +++ b/hotspot-impl/build.gradle @@ -11,4 +11,6 @@ dependencies { tasks.withType(JavaCompile).configureEach { options.compilerArgs += ['--add-exports', 'java.management/sun.management=ALL-UNNAMED'] + // Explicitly set the source compatibility so gradle will invoke javac with `-source 11` instead of `--release` + sourceCompatibility = 11 } diff --git a/hotspot-impl/gradle.properties b/hotspot-impl/gradle.properties index 96e4bd271ab..eeac3e65888 100644 --- a/hotspot-impl/gradle.properties +++ b/hotspot-impl/gradle.properties @@ -1,2 +1 @@ io.deephaven.project.ProjectType=JAVA_LOCAL -excludeReleaseFlag= diff --git a/hotspot/build.gradle b/hotspot/build.gradle index 7c23812b7c5..a9bb1568cd2 100644 --- a/hotspot/build.gradle +++ b/hotspot/build.gradle @@ -1,18 +1,3 @@ plugins { id 'io.deephaven.project.register' } - -configurations { - compile.extendsFrom configurations.dhUtil -} - -dependencies { - compile project(':log-factory') - - testRuntime project(path: ':configs'), project(path: ':test-configs') - - testRuntimeOnly project(':log-to-slf4j') - Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') - - Classpaths.inheritJUnitPlatform(project) -} diff --git a/server/jetty/README.md b/server/jetty-app/README.md similarity index 78% rename from server/jetty/README.md rename to server/jetty-app/README.md index 31b9c8db10a..4f39effc334 100644 --- a/server/jetty/README.md +++ b/server/jetty-app/README.md @@ -42,13 +42,13 @@ be sure to first set `PYTHON_CONFIGURE_OPTS="--enabled-shared"`. ### Build ```shell -./gradlew server-jetty:build +./gradlew server-jetty-app:build ``` produces -* `server/netty/build/distributions/server-jetty-.tar` -* `server/netty/build/distributions/server-jetty-.zip` +* `server/jetty-app/build/distributions/server-jetty-.tar` +* `server/jetty-app/build/distributions/server-jetty-.zip` ### Run @@ -61,17 +61,23 @@ The above artifacts can be uncompressed and their `bin/start` script can be exec Alternatively, the uncompressed installation can be built directly by gradle: ```shell -./gradlew server-jetty:installDist +./gradlew server-jetty-app:installDist ``` And then run via: ```shell -JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/jetty/build/install/server-jetty/bin/start +JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/jetty-app/build/install/server-jetty/bin/start ``` Finally, Gradle can be used to update the build and run the application in a single step: ```shell -./gradlew :server-jetty:run -Pgroovy +./gradlew server-jetty-app:run -Pgroovy ``` + +### Internals + +`server-jetty-app` is configured by default to include code that depends on JVM internals via +`--add-opens java.management/sun.management=ALL-UNNAMED`. To disable this, set the gradle property `includeHotspotImpl` +to `false`. diff --git a/server/jetty-app/build.gradle b/server/jetty-app/build.gradle new file mode 100644 index 00000000000..6bde308a950 --- /dev/null +++ b/server/jetty-app/build.gradle @@ -0,0 +1,60 @@ +plugins { + id 'application' + id 'io.deephaven.project.register' +} + +configurations { + applicationDist +} + +dependencies { + implementation project(':server-jetty') + + runtimeOnly project(':log-to-slf4j') + runtimeOnly project(':logback-print-stream-globals') + runtimeOnly project(':logback-logbuffer') + Classpaths.inheritLogbackClassic(project) +} + +distributions { + main { + distributionBaseName = 'server-jetty' + } +} + +def extraJvmArgs = [ + '-server', + '-XX:+UseG1GC', + '-XX:MaxGCPauseMillis=100', + '-XX:+UseStringDeduplication', + '-XshowSettings:vm', +] + +if (hasProperty('groovy')) { + extraJvmArgs += ['-Ddeephaven.console.type=groovy'] +} + +if (property('includeHotspotImpl') == 'true') { + dependencies { + runtimeOnly project(':hotspot-impl') + } + extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED'] +} + +tasks.withType(JavaExec).configureEach { + // This appends to the existing jvm args, so that java-open-nio still takes effect + jvmArgs extraJvmArgs +} + +tasks.withType(CreateStartScripts).configureEach { + defaultJvmOpts += extraJvmArgs +} + +applicationName = 'start' +mainClassName = 'io.deephaven.server.jetty.JettyAppMain' + +artifacts { + applicationDist project.tasks.findByName('distTar') +} + +apply plugin: 'io.deephaven.java-open-nio' diff --git a/server/jetty-app/gradle.properties b/server/jetty-app/gradle.properties new file mode 100644 index 00000000000..fa9132970a5 --- /dev/null +++ b/server/jetty-app/gradle.properties @@ -0,0 +1,2 @@ +io.deephaven.project.ProjectType=JAVA_LOCAL +includeHotspotImpl=true diff --git a/server/jetty-app/src/main/java/io/deephaven/server/jetty/JettyAppMain.java b/server/jetty-app/src/main/java/io/deephaven/server/jetty/JettyAppMain.java new file mode 100644 index 00000000000..f023012e0b3 --- /dev/null +++ b/server/jetty-app/src/main/java/io/deephaven/server/jetty/JettyAppMain.java @@ -0,0 +1,11 @@ +package io.deephaven.server.jetty; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +public class JettyAppMain { + public static void main(String[] args) + throws IOException, InterruptedException, ClassNotFoundException, TimeoutException { + JettyMain.main(args); + } +} diff --git a/server/jetty/build.gradle b/server/jetty/build.gradle index 68e8e743d99..a0dfa4fbb4a 100644 --- a/server/jetty/build.gradle +++ b/server/jetty/build.gradle @@ -1,16 +1,16 @@ plugins { - id 'application' + id 'java-library' id 'io.deephaven.project.register' } dependencies { - implementation project(':server') + api project(':server') + runtimeOnly(project(':web')) Classpaths.inheritDagger(project) Classpaths.inheritDagger(project, /* test */ true) Classpaths.inheritGrpcPlatform(project) - runtimeOnly project(':hotspot-impl') implementation('org.eclipse.jetty:jetty-servlet:11.0.8') implementation 'org.eclipse.jetty:jetty-webapp:11.0.8' @@ -21,49 +21,12 @@ dependencies { implementation project(':grpc-java:grpc-servlet-websocket-jakarta') implementation 'org.eclipse.jetty.websocket:websocket-jakarta-server:11.0.8' - runtimeOnly project(':log-to-slf4j') - runtimeOnly project(':logback-print-stream-globals') - runtimeOnly project(':logback-logbuffer') - Classpaths.inheritLogbackClassic(project) - testImplementation project(':server-test') - runtimeOnly(project(':web')) + testRuntimeOnly project(':log-to-slf4j') + Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') } test.systemProperty "UpdateGraphProcessor.allowUnitTestMode", false -distributions { - main { - distributionBaseName = 'server-jetty' - } -} - -def extraJvmArgs = [ - '-server', - '-XX:+UseG1GC', - '-XX:MaxGCPauseMillis=100', - '-XX:+UseStringDeduplication', - '-XshowSettings:vm', -] -if (hasProperty('groovy')) { - extraJvmArgs += ['-Ddeephaven.console.type=groovy'] -} -if (hasProperty('hotspot')) { - dependencies { - runtimeOnly project(':engine-hotspot') - } - extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED'] -} -tasks.withType(JavaExec) { - // This appends to the existing jvm args, so that java-open-nio still takes effect - jvmArgs extraJvmArgs -} -tasks.withType(CreateStartScripts) { - defaultJvmOpts += extraJvmArgs -} - -applicationName = 'start' -mainClassName = 'io.deephaven.server.jetty.JettyMain' - apply plugin: 'io.deephaven.java-open-nio' diff --git a/server/netty-app/README.md b/server/netty-app/README.md new file mode 100644 index 00000000000..5f46f07617a --- /dev/null +++ b/server/netty-app/README.md @@ -0,0 +1,44 @@ +# Native packaging for Deephaven Netty server + +### Build + +```shell +./gradlew server-netty-app:build +``` + +produces + +* `server/netty-app/build/distributions/server-.tar` +* `server/netty-app/build/distributions/server-.zip` + +### Run + +The above artifacts can be uncompressed and their `bin/start` script can be executed: + +```shell + JAVA_OPTS="-Ddeephaven.console.type=groovy" bin/start +``` + +Alternatively, the uncompressed installation can be built directly by gradle: + +```shell +./gradlew server-netty-app:installDist +``` + +And then run via: + +```shell +JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/netty-app/build/install/server/bin/start +``` + +Finally, Gradle can be used to update the build and run the application in a single step: + +```shell +./gradlew server-netty-app:run -Pgroovy +``` + +### Internals + +`server-netty-app` is configured by default to include code that depends on JVM internals via +`--add-opens java.management/sun.management=ALL-UNNAMED`. To disable this, set the gradle property `includeHotspotImpl` +to `false`. diff --git a/server/netty-app/build.gradle b/server/netty-app/build.gradle new file mode 100644 index 00000000000..7a8348680d5 --- /dev/null +++ b/server/netty-app/build.gradle @@ -0,0 +1,60 @@ +plugins { + id 'application' + id 'io.deephaven.project.register' +} + +configurations { + applicationDist +} + +dependencies { + implementation project(':server-netty') + + runtimeOnly project(':log-to-slf4j') + runtimeOnly project(':logback-print-stream-globals') + runtimeOnly project(':logback-logbuffer') + Classpaths.inheritLogbackClassic(project) +} + +distributions { + main { + distributionBaseName = 'server' + } +} + +def extraJvmArgs = [ + '-server', + '-XX:+UseG1GC', + '-XX:MaxGCPauseMillis=100', + '-XX:+UseStringDeduplication', + '-XshowSettings:vm', +] + +if (hasProperty('groovy')) { + extraJvmArgs += ['-Ddeephaven.console.type=groovy'] +} + +if (property('includeHotspotImpl') == 'true') { + dependencies { + runtimeOnly project(':hotspot-impl') + } + extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED'] +} + +tasks.withType(JavaExec).configureEach { + // This appends to the existing jvm args, so that java-open-nio still takes effect + jvmArgs extraJvmArgs +} + +tasks.withType(CreateStartScripts).configureEach { + defaultJvmOpts += extraJvmArgs +} + +applicationName = 'start' +mainClassName = 'io.deephaven.server.netty.NettyAppMain' + +artifacts { + applicationDist project.tasks.findByName('distTar') +} + +apply plugin: 'io.deephaven.java-open-nio' diff --git a/server/netty-app/gradle.properties b/server/netty-app/gradle.properties new file mode 100644 index 00000000000..fa9132970a5 --- /dev/null +++ b/server/netty-app/gradle.properties @@ -0,0 +1,2 @@ +io.deephaven.project.ProjectType=JAVA_LOCAL +includeHotspotImpl=true diff --git a/server/netty-app/src/main/java/io/deephaven/server/netty/NettyAppMain.java b/server/netty-app/src/main/java/io/deephaven/server/netty/NettyAppMain.java new file mode 100644 index 00000000000..b0fe40e2914 --- /dev/null +++ b/server/netty-app/src/main/java/io/deephaven/server/netty/NettyAppMain.java @@ -0,0 +1,11 @@ +package io.deephaven.server.netty; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +public class NettyAppMain { + public static void main(String[] args) + throws IOException, InterruptedException, ClassNotFoundException, TimeoutException { + NettyMain.main(args); + } +} diff --git a/server/netty/README.md b/server/netty/README.md deleted file mode 100644 index 69e19279b01..00000000000 --- a/server/netty/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Native packaging for Deephaven Netty server - -### Build - -```shell -./gradlew server-netty:build -``` - -produces - -* `server/netty/build/distributions/server-.tar` -* `server/netty/build/distributions/server-.zip` - -### Run - -The above artifacts can be uncompressed and their `bin/start` script can be executed: - -```shell - JAVA_OPTS="-Ddeephaven.console.type=groovy" bin/start -``` - -Alternatively, the uncompressed installation can be built directly by gradle: - -```shell -./gradlew server-netty:installDist -``` - -And then run via: - -```shell -JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/netty/build/install/server/bin/start -``` - -Finally, Gradle can be used to update the build and run the application in a single step: - -```shell -./gradlew :server-netty:run -Pgroovy -``` diff --git a/server/netty/build.gradle b/server/netty/build.gradle index 348368671ad..24d35a75571 100644 --- a/server/netty/build.gradle +++ b/server/netty/build.gradle @@ -1,15 +1,10 @@ plugins { id 'java-library' - id 'application' id 'io.deephaven.project.register' } -configurations { - applicationDist -} - dependencies { - implementation project(':server') + api project(':server') Classpaths.inheritDagger(project) Classpaths.inheritDagger(project, /* test */ true) @@ -17,52 +12,12 @@ dependencies { Classpaths.inheritGrpcPlatform(project) implementation 'io.grpc:grpc-netty' - runtimeOnly project(':hotspot-impl') - runtimeOnly project(':log-to-slf4j') - runtimeOnly project(':logback-print-stream-globals') - runtimeOnly project(':logback-logbuffer') - Classpaths.inheritLogbackClassic(project) - testImplementation project(':server-test') -} - -test.systemProperty "UpdateGraphProcessor.allowUnitTestMode", false - -distributions { - main { - distributionBaseName = 'server' - } -} -def extraJvmArgs = [ - '-server', - '-XX:+UseG1GC', - '-XX:MaxGCPauseMillis=100', - '-XX:+UseStringDeduplication', - '-XshowSettings:vm', -] -if (hasProperty('groovy')) { - extraJvmArgs += ['-Ddeephaven.console.type=groovy'] -} -if (hasProperty('hotspot')) { - dependencies { - runtimeOnly project(':engine-hotspot') - } - extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED'] -} -tasks.withType(JavaExec) { - // This appends to the existing jvm args, so that java-open-nio still takes effect - jvmArgs extraJvmArgs -} -tasks.withType(CreateStartScripts) { - defaultJvmOpts += extraJvmArgs + testRuntimeOnly project(':log-to-slf4j') + Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') } -applicationName = 'start' -mainClassName = 'io.deephaven.server.netty.NettyMain' - -artifacts { - applicationDist project.tasks.findByName('distTar') -} +test.systemProperty "UpdateGraphProcessor.allowUnitTestMode", false apply plugin: 'io.deephaven.java-open-nio' diff --git a/settings.gradle b/settings.gradle index 03ff9107462..1c38dd97ef7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -120,9 +120,15 @@ project(':server-test').projectDir = file('server/test') include(':server-netty') project(':server-netty').projectDir = file('server/netty') +include(':server-netty-app') +project(':server-netty-app').projectDir = file('server/netty-app') + include(':server-jetty') project(':server-jetty').projectDir = file('server/jetty') +include(':server-jetty-app') +project(':server-jetty-app').projectDir = file('server/jetty-app') + include(':Base') include(':SevenZip')