From 82a4f45f807a69f78d7513bded33fe76f5f4347c Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Thu, 16 Dec 2021 17:57:22 -0500 Subject: [PATCH] Better JDK-18 EA (and beyond) support of SecurityManager (#1750) Signed-off-by: Andriy Redko --- build.gradle | 9 +++++++++ gradle.properties | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 75b4566a7bc..7accde34463 100644 --- a/build.gradle +++ b/build.gradle @@ -346,6 +346,15 @@ gradle.projectsEvaluated { if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) { integTest.mustRunAfter test } + + project.tasks.withType(Test) { task -> + if (task != null) { + if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17) { + task.jvmArgs += ["-Djava.security.manager=allow"] + } + } + } + configurations.matching { it.canBeResolved }.all { Configuration configuration -> dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep -> Project upstreamProject = dep.dependencyProject diff --git a/gradle.properties b/gradle.properties index 6c48fc7c5f9..0974eb6d6b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ systemProp.org.gradle.warning.mode=fail systemProp.jdk.tls.client.protocols=TLSv1.2 # jvm args for faster test execution by default -systemProp.tests.jvm.argline=-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m -Djava.security.manager=allow +systemProp.tests.jvm.argline=-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m