Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,22 @@ private static void configureEntitlements(Project project) {
.matching(test -> TEST_TASKS_WITH_ENTITLEMENTS.contains(test.getName()))
.configureEach(test -> {
// See also SystemJvmOptions.maybeAttachEntitlementAgent.
SystemPropertyCommandLineArgumentProvider nonInputSystemProperties = test.getExtensions()
.getByType(SystemPropertyCommandLineArgumentProvider.class);

// Agent
if (agentFiles.isEmpty() == false) {
test.getInputs().files(agentFiles);
test.systemProperty("es.entitlement.agentJar", agentFiles.getAsPath());
test.systemProperty("jdk.attach.allowAttachSelf", true);
}
test.getInputs().files(agentFiles).optional(true);
nonInputSystemProperties.systemProperty("es.entitlement.agentJar", agentFiles::getAsPath);
nonInputSystemProperties.systemProperty("jdk.attach.allowAttachSelf", () -> agentFiles.isEmpty() ? "false" : "true");

// Bridge
if (bridgeFiles.isEmpty() == false) {
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
test.getInputs().files(bridgeFiles);
// Tests may not be modular, but the JDK still is
test.jvmArgs(
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
+ modulesContainingEntitlementInstrumentation
);
}
String modulesContainingEntitlementInstrumentation = "java.logging,java.net.http,java.naming,jdk.net";
test.getInputs().files(bridgeFiles).optional(true);
// Tests may not be modular, but the JDK still is
test.jvmArgs(
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=ALL-UNNAMED,"
+ modulesContainingEntitlementInstrumentation
);
});
}

Expand Down