aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-12-06 15:00:06 +0000
committerDominik Stadler <centic@apache.org>2021-12-06 15:00:06 +0000
commit21039bd2b1064db9469d6cfec83308c3418a0139 (patch)
tree471bebc9f169e6d460a85318e1e02e2c5a068436
parent2d347b5a610023427980941fd458422b638158bd (diff)
downloadpoi-21039bd2b1064db9469d6cfec83308c3418a0139.tar.gz
poi-21039bd2b1064db9469d6cfec83308c3418a0139.zip
Some more changes for early support for JDK 18
Adjust one test which fails with JDK 18 because of remove SecurityManager Adjust excludes for JaCoCo as it does not run on JDK 18 otherwise Adjust some JPMS settings which are not available any more on JDK 18 Some other things do not work yet, e.g. spotbugs Also print out if CIBuild is selected Only run signing if actually publishing to avoid failures if signing key is defined locally git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895626 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--build.gradle70
-rw-r--r--poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java6
2 files changed, 51 insertions, 25 deletions
diff --git a/build.gradle b/build.gradle
index d8c75b5e4b..46ae456c49 100644
--- a/build.gradle
+++ b/build.gradle
@@ -286,29 +286,30 @@ subprojects {
isCIBuild |= Boolean.valueOf(System.getenv("CI_BUILD"));
if (isCIBuild) {
- jvmArgs += [
- // Strictly serial
- // '-Djunit.jupiter.execution.parallel.enabled=false',
-
- // OR parallel on 2 threads
- '-Djunit.jupiter.execution.parallel.config.strategy=fixed',
- '-Djunit.jupiter.execution.parallel.config.fixed.parallelism=2'
- ]
- maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
- } else {
- jvmArgs += [
- '-Djunit.jupiter.execution.parallel.enabled=true',
- '-Djunit.jupiter.execution.parallel.config.strategy=dynamic',
+ System.out.println("Run with reduced parallelism for CI build");
+
+ jvmArgs += [
+ // Strictly serial
+ // '-Djunit.jupiter.execution.parallel.enabled=false',
+
+ // OR parallel on 2 threads
+ '-Djunit.jupiter.execution.parallel.config.strategy=fixed',
+ '-Djunit.jupiter.execution.parallel.config.fixed.parallelism=2'
+ ]
+ maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
+ } else {
+ jvmArgs += [
+ '-Djunit.jupiter.execution.parallel.enabled=true',
+ '-Djunit.jupiter.execution.parallel.config.strategy=dynamic',
// this setting breaks the test builds, do not use it!
- //'-Djunit.jupiter.execution.parallel.mode.default=concurrent'
- ]
-
- // Explicitly defining the maxParallelForks was always slower than not setting it
- // So we leave this to Gradle itself, which seems to be very smart
- // maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
- // maxParallelForks = Math.max( Runtime.runtime.availableProcessors() - 1, 1 )
+ //'-Djunit.jupiter.execution.parallel.mode.default=concurrent'
+ ]
+ // Explicitly defining the maxParallelForks was always slower than not setting it
+ // So we leave this to Gradle itself, which seems to be very smart
+ // maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
+ // maxParallelForks = Math.max( Runtime.runtime.availableProcessors() - 1, 1 )
}
// show standard out and standard error of the test JVM(s) on the console
@@ -324,11 +325,16 @@ subprojects {
doFirst {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
- jvmArgs += [
- '-Dsun.reflect.debugModuleAccessChecks=true',
- '-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
- '--illegal-access=warn',
+ // some options were removed in JDK 18
+ if (JavaVersion.current().ordinal() < JavaVersion.VERSION_18.ordinal()) {
+ jvmArgs += [
+ '--illegal-access=warn',
+ ]
+ } else {
+ System.out.println("Configuring for JDK 18 or higher")
+ }
+ jvmArgs += [
// see https://github.com/java9-modularity/gradle-modules-plugin/issues/97
// opposed to the recommendation there, it doesn't work to add ... to the dependencies
// testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.1'
@@ -336,9 +342,20 @@ subprojects {
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=org.apache.poi.poi',
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED',
+
+ '-Dsun.reflect.debugModuleAccessChecks=true',
+ '-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
]
}
}
+
+ jacoco {
+ excludes = [
+ // this is necessary to make JaCoCo work with JDK 18 for now
+ 'sun/**',
+ 'javax/**',
+ ]
+ }
}
jacoco {
@@ -478,6 +495,11 @@ subprojects {
}
signing {
+ setRequired {
+ // signing is only required if this is a release version
+ // and the artifacts are to be published
+ gradle.taskGraph.allTasks.any { it instanceof PublishToMavenRepository }
+ }
sign publishing.publications.POI
}
signPOIPublication.dependsOn('generatePomFileForPOIPublication')
diff --git a/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java b/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
index 4482607e62..d4bf0d89d2 100644
--- a/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
+++ b/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
@@ -29,15 +29,16 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.security.Permission;
+import org.apache.commons.io.output.NullPrintStream;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.poifs.filesystem.NotOLE2FileException;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.poifs.property.PropertyTable;
-import org.apache.commons.io.output.NullPrintStream;
import org.apache.poi.util.TempFile;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -151,6 +152,9 @@ public class TestPOIFSDump {
@Test
void testMainNoArgs() {
+ Assumptions.assumeFalse(System.getProperty("java.version").startsWith("18"),
+ "SecurityManager does not work any more since JDK 18");
+
SecurityManager sm = System.getSecurityManager();
try {
System.setSecurityManager(new SecurityManager() {