summaryrefslogtreecommitdiff
path: root/app-text/jabref/files/jabref-2.10-test-jvm-props-args.patch
blob: d3e413e9b0fdb626be658d67261cbcba427f1a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From f24492bff17f728bcf2b5a50069669ae08b8b372 Mon Sep 17 00:00:00 2001
From: Yuan Liao <liaoyuan@gmail.com>
Date: Sat, 19 Feb 2022 10:21:04 -0800
Subject: [PATCH] Add JVM system properties and argument for tests

The changes to system properties ensure that all paths the application
may write to during the tests are not protected by the Portage sandbox.

The extra argument added is required on Java 17+, but it should also be
compatible with all Java versions that support the Java Platform Module
System (JPMS), namely Java 9+.  On older Java versions, it is optional.
On Java 8, however, including it in JVM arguments would cause an error.

Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
---
 build.xml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/build.xml b/build.xml
index d13a9f3..788a4d1 100644
--- a/build.xml
+++ b/build.xml
@@ -28,7 +28,7 @@
 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
-<project name="JabRef" default="jars" basedir=".">
+<project name="JabRef" default="jars" basedir="." xmlns:if="ant:if">
 
 	<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         PROPERTY SETUP
@@ -596,7 +596,14 @@ version=${jabref.version}</echo>
 	</target>
 
 	<target name="test" depends="buildtest" description="Runs all unit tests">
+		<condition property="shouldAddOpens">
+			<javaversion atleast="9" />
+		</condition>
 		<java fork="yes" classname="junit.textui.TestRunner" failonerror="true">
+			<sysproperty key="java.io.tmpdir" value="${java.io.tmpdir}" />
+			<sysproperty key="user.home" value="${user.home}" />
+			<jvmarg if:set="shouldAddOpens"
+				value="--add-opens=java.desktop/java.awt=ALL-UNNAMED" />
 			<arg value="tests.net.sf.jabref.AllTests" />
 			<classpath refid="classpathTest" />
 		</java>
-- 
2.34.1