Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ The build is driven by Gradle through the included wrapper; no separate Gradle i
```
On Windows use `gradlew.bat` instead of `./gradlew`. The assembled distribution lands in `server/setup`, the same location the previous Ant build used. For release artifacts, run a clean build: `./gradlew clean build dist`. Windows with SDKMan may generate an error about the file path being too long in the javadoc step, skip this by adding `-x :server:userApiJavadoc` to your Gradle command.

By default the build compiles and runs the tests with any Java 17 JDK Gradle finds installed, including those installed by SDKMAN. To use Java 21 instead, add `-PjavaToolchain=21`, or put `javaToolchain=21` in `~/.gradle/gradle.properties`. The compiled output still targets Java 17. Gradle does not download JDKs, so the version you name must already be installed.

Dependencies are pinned and checksum-verified. To change a dependency version: edit `gradle/libs.versions.toml`, then refresh the checksum metadata **with a cold dependency cache and CI's flags**:
```bash
GRADLE_USER_HOME=$(mktemp -d) ./gradlew --write-verification-metadata sha256 build dist -PdisableSigning=true -Pcoverage=true
Expand Down
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* ./gradlew test [-Pcoverage=true] tests only (JaCoCo optional)
* ./gradlew dist distribution extension zips
* ./gradlew clean clean all modules
* ./gradlew build -PjavaToolchain=21 compile/test with another JDK
* (output still targets Java 17)
*
* For release artifacts run a clean build (./gradlew clean build dist):
* the staging into server/setup removes stale files where it owns the
Expand Down Expand Up @@ -71,6 +73,9 @@ ext {
disableTests = flag('disableTests')
disableSigning = flag('disableSigning')
coverageEnabled = flag('coverage')
// the shipped bytecode and API level; the JDK used to build may be newer
javaRelease = 17
javaToolchain = (providers.gradleProperty('javaToolchain').getOrNull() ?: javaRelease) as int
}

allprojects {
Expand Down Expand Up @@ -158,7 +163,7 @@ subprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(rootProject.javaToolchain)
}
}

Expand All @@ -177,6 +182,7 @@ subprojects {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = rootProject.javaRelease
options.debug = true
}
// Match Ant's javac invocation: -sourcepath defaults to srcdir, and
Expand Down Expand Up @@ -275,7 +281,7 @@ subprojects {

if (rootProject.coverageEnabled) {
apply plugin: 'jacoco'
jacoco { toolVersion = '0.8.8' }
jacoco { toolVersion = '0.8.15' }
tasks.withType(Test).configureEach { finalizedBy tasks.named('jacocoTestReport') }
tasks.named('jacocoTestReport') {
reports.xml.required = true
Expand Down
89 changes: 43 additions & 46 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2533,41 +2533,41 @@
<sha256 value="120860c56a4d77bcc1223cbae740eeb26f2f9355d49a17d5f165800ee0afaa7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.8">
<artifact name="org.jacoco.agent-0.8.8.jar">
<sha256 value="072ecbd496896623899a696fff12c01c1615f737616d2792e6d0e10cdf8a610d" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.15">
<artifact name="org.jacoco.agent-0.8.15.jar">
<sha256 value="81607adaa5b03a687a04049dee6b07e9665708c3e6f7b0626892ca9659be587c" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.agent-0.8.8.pom">
<sha256 value="7dd13c80aff315032983357c650a887d6fdb4c8a8870b207bb4802c49809e7b4" origin="Generated by Gradle"/>
<artifact name="org.jacoco.agent-0.8.15.pom">
<sha256 value="47eb24b1577e473cbba634399bc56fe7b366b18401bf911d0d8771f56f228966" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.8">
<artifact name="org.jacoco.ant-0.8.8.jar">
<sha256 value="02e33bd2c48dc0be67c2fea84d43beececfd400da6797c58153253d4c30aca15" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.15">
<artifact name="org.jacoco.ant-0.8.15.jar">
<sha256 value="54fb6af97c95352d7deeb49113d7ad63f190eaa8cc9ae8e068fdb2f2a6de009e" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.ant-0.8.8.pom">
<sha256 value="fafff75819609030f4626509313c0861428c2c26c8d36e9a8938334a04478909" origin="Generated by Gradle"/>
<artifact name="org.jacoco.ant-0.8.15.pom">
<sha256 value="96d1688a3e8723539de36eaeb3f0789ec05914585d69eae0f453c2924b559a0a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.8">
<artifact name="org.jacoco.build-0.8.8.pom">
<sha256 value="f4ce0b1285fd24fc6c772f42857298315904dde8fd5677267a0fad5ff9ce2aef" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.15">
<artifact name="org.jacoco.build-0.8.15.pom">
<sha256 value="3a2c89f80c2ab9caf1b403a62da4bcbd909ee52ea53747391267a5cdc968c123" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.8">
<artifact name="org.jacoco.core-0.8.8.jar">
<sha256 value="474c782f809d88924713dfdbf0acb79d330f904be576484803463d0465611643" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.15">
<artifact name="org.jacoco.core-0.8.15.jar">
<sha256 value="ade1e0fdb4cd80d8537b57c6edb70a1360c47fdc518c20c65314517479bc4d0d" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.core-0.8.8.pom">
<sha256 value="f5fab5a48df823b83c0ea35026032368cc9b81800efb257cc7a5928298fee225" origin="Generated by Gradle"/>
<artifact name="org.jacoco.core-0.8.15.pom">
<sha256 value="7b283b35bb2bda3b827b4da89ce968d257d1d98dd8594d7c8cb5b2f6d8cd9b15" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.8">
<artifact name="org.jacoco.report-0.8.8.jar">
<sha256 value="2c129110f3e3fcaa1f8179578ea3894586199cb0826be5c7790278084c9622a9" origin="Generated by Gradle"/>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.15">
<artifact name="org.jacoco.report-0.8.15.jar">
<sha256 value="66a79e36edc77a1ebf6689e76a976e12ab4f1af515cbd09555840fba775714f4" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.report-0.8.8.pom">
<sha256 value="5213af2916bb2690be871917d82a0f9c2ba1e88b796a59343fc03df8ae138716" origin="Generated by Gradle"/>
<artifact name="org.jacoco.report-0.8.15.pom">
<sha256 value="a1ea901ca04547f1dc24e75dde104b3a7171ff9d0c2b8f43b3153be09ac3c08a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.javassist" name="javassist" version="3.26.0-GA">
Expand Down Expand Up @@ -2858,12 +2858,12 @@
<sha256 value="321ddbb7ee6fe4f53dea6b4cd6db74154d6bfa42391c1f763b361b9f485acf05" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm" version="9.2">
<artifact name="asm-9.2.jar">
<sha256 value="b9d4fe4d71938df38839f0eca42aaaa64cf8b313d678da036f0cb3ca199b47f5" origin="Generated by Gradle"/>
<component group="org.ow2.asm" name="asm" version="9.10.1">
<artifact name="asm-9.10.1.jar">
<sha256 value="ed825d10ab1399c8c0cb669e688cf0c8c82629b4c8399b58352b68e92ca10fcb" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-9.2.pom">
<sha256 value="dfb12a1b224bf01be1fd604020466f894241bcb645dcce395edd8cd6f8a50df4" origin="Generated by Gradle"/>
<artifact name="asm-9.10.1.pom">
<sha256 value="e1b1c3832ca3ac0a9e563c405f4c760118b5556a4920daee14058886197e094d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm" version="9.6">
Expand All @@ -2874,14 +2874,6 @@
<sha256 value="92eee24bc3c843e4881d46c1dd6505471ee3142facfb466b428cfea5a56c6b60" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-analysis" version="9.2">
<artifact name="asm-analysis-9.2.jar">
<sha256 value="878fbe521731c072d14d2d65b983b1beae6ad06fda0007b6a8bae81f73f433c4" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-analysis-9.2.pom">
<sha256 value="773cc1a2bfc14c6c4a979c51a075c0234a0bf694fc3abe4facf454f37a145f1b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-analysis" version="9.6">
<artifact name="asm-analysis-9.6.jar">
<sha256 value="d92832d7c37edc07c60e2559ac6118b31d642e337a6671edcb7ba9fae68edbbb" origin="Generated by Gradle"/>
Expand All @@ -2890,12 +2882,17 @@
<sha256 value="fa3f995021cff4f4139306e6cffeeea07539106440d29b19cc06a7a636a13850" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.2">
<artifact name="asm-commons-9.2.jar">
<sha256 value="be4ce53138a238bb522cd781cf91f3ba5ce2f6ca93ec62d46a162a127225e0a6" origin="Generated by Gradle"/>
<component group="org.ow2.asm" name="asm-bom" version="9.10.1">
<artifact name="asm-bom-9.10.1.pom">
<sha256 value="709472d69cf785d4b679eee0e6e0575d4b104476ddf35265ef1117e73c129cd4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.10.1">
<artifact name="asm-commons-9.10.1.jar">
<sha256 value="6d0abefb7cbf972ea16edb37ec14835372505063a45f976ab7ea889ed9497895" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-commons-9.2.pom">
<sha256 value="02824e839f2a2f0e72959fdd30b4897240f05afc43de42d7ba0b18437601c070" origin="Generated by Gradle"/>
<artifact name="asm-commons-9.10.1.pom">
<sha256 value="ceb2c43f3a273db88af8652d89ed6312f3e91a1a1e0ffc6f7823169278cf795c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.6">
Expand All @@ -2906,12 +2903,12 @@
<sha256 value="a98ae4895334baf8ff86bd66516210dbd9a03f1a6e15e47dda82afcf6b53d77c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.2">
<artifact name="asm-tree-9.2.jar">
<sha256 value="aabf9bd23091a4ebfc109c1f3ee7cf3e4b89f6ba2d3f51c5243f16b3cffae011" origin="Generated by Gradle"/>
<component group="org.ow2.asm" name="asm-tree" version="9.10.1">
<artifact name="asm-tree-9.10.1.jar">
<sha256 value="3dfb0d5b6a106cd40b5b250e39935fbf2f927f4477546a5369a3ac609cf0506b" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-tree-9.2.pom">
<sha256 value="f61f3ebea5520ddf19f452b03c426c7231bdd8a81d7ac28765cb5271225ac378" origin="Generated by Gradle"/>
<artifact name="asm-tree-9.10.1.pom">
<sha256 value="963eebdea6e2e1ff25c9068b64a238e1585c99f8acd455595ac159a7f52b6c41" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.6">
Expand Down
15 changes: 4 additions & 11 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ def syncDonkeyLibs = tasks.register('syncDonkeyLibs', Sync) {

compileJava.dependsOn syncDonkeyLibs

compileTestJava {
options.compilerArgs += [
'--add-modules=java.sql.rowset',
'--add-exports=java.sql.rowset/com.sun.rowset=ALL-UNNAMED',
'--add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED',
'--add-exports=java.base/sun.security.provider=ALL-UNNAMED',
]
}


def generateVersionProperties = tasks.register('generateVersionProperties') {
description = 'Generates version.properties (embedded in mirth-client-core.jar).'
def outFile = file('version.properties')
Expand Down Expand Up @@ -502,9 +492,12 @@ def userApiJavadoc = tasks.register('userApiJavadoc') {
})
outputs.dir outDir
dependsOn syncDonkeyLibs
def javadocTool = javaToolchains.javadocToolFor(java.toolchain)
// the output depends on the javadoc version, which is not otherwise an input
inputs.property('javadocVersion', javadocTool.map { it.metadata.languageVersion.asInt() })
doLast {
outDir.mkdirs()
def cmd = [new File(System.getProperty('java.home'), 'bin/javadoc').absolutePath,
def cmd = [javadocTool.get().executablePath.asFile.absolutePath,
'-d', outDir.absolutePath,
'-notimestamp',
'-classpath', (configurations.compileClasspath + fileTree(dir: 'lib', include: '**/*.jar')).asPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
import com.mirth.commons.encryption.Output;
import com.mirth.commons.encryption.util.EncryptionUtil;
import com.mirth.connect.model.EncryptionSettings;
import com.sun.crypto.provider.SunJCE;

public class KeyEncryptorTest {

// a name, not a class literal: java.base does not export this package
private static final String SUN_JCE_PROVIDER = "com.sun.crypto.provider.SunJCE";

@Test
public void testAESCBC128BC() throws Exception {
EncryptionSettings encryptionSettings = new EncryptionSettings();
Expand All @@ -65,7 +67,7 @@ public void testAESCBC128SunJCE() throws Exception {
EncryptionSettings encryptionSettings = new EncryptionSettings();
encryptionSettings.setEncryptionAlgorithm("AES/CBC/PKCS5Padding");
encryptionSettings.setEncryptionKeyLength(128);
encryptionSettings.setSecurityProvider(SunJCE.class.getName());
encryptionSettings.setSecurityProvider(SUN_JCE_PROVIDER);
encryptionSettings.setEncryptionCharset(StandardCharsets.UTF_8.name());
testEncryptAndDecrypt(encryptionSettings);
}
Expand All @@ -76,7 +78,7 @@ public void testAESCBC128SunJCE() throws Exception {
// EncryptionSettings encryptionSettings = new EncryptionSettings();
// encryptionSettings.setEncryptionAlgorithm("AES/CBC/PKCS5Padding");
// encryptionSettings.setEncryptionKeyLength(256);
// encryptionSettings.setSecurityProvider(SunJCE.class.getName());
// encryptionSettings.setSecurityProvider(SUN_JCE_PROVIDER);
// encryptionSettings.setEncryptionCharset(StandardCharsets.UTF_8.name());
// testEncryptAndDecrypt(encryptionSettings);
// }
Expand Down Expand Up @@ -161,7 +163,7 @@ public void testAESCBC128SunJCE_AESGCM128BC() throws Exception {
EncryptionSettings oldEncryptionSettings = new EncryptionSettings();
oldEncryptionSettings.setEncryptionAlgorithm("AES/CBC/PKCS5Padding");
oldEncryptionSettings.setEncryptionKeyLength(128);
oldEncryptionSettings.setSecurityProvider(SunJCE.class.getName());
oldEncryptionSettings.setSecurityProvider(SUN_JCE_PROVIDER);
oldEncryptionSettings.setEncryptionCharset(StandardCharsets.UTF_8.name());

EncryptionSettings encryptionSettings = new EncryptionSettings();
Expand Down Expand Up @@ -225,7 +227,7 @@ public void testDESCBC56SunJCE() throws Exception {
EncryptionSettings encryptionSettings = new EncryptionSettings();
encryptionSettings.setEncryptionAlgorithm("DES/CBC/PKCS5Padding");
encryptionSettings.setEncryptionKeyLength(56);
encryptionSettings.setSecurityProvider(SunJCE.class.getName());
encryptionSettings.setSecurityProvider(SUN_JCE_PROVIDER);
encryptionSettings.setEncryptionCharset(StandardCharsets.UTF_8.name());
testEncryptAndDecrypt(encryptionSettings);
}
Expand Down
Loading