mirror of https://github.com/apache/poi.git
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
This commit is contained in:
parent
2d347b5a61
commit
21039bd2b1
68
build.gradle
68
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',
|
||||
System.out.println("Run with reduced parallelism for CI build");
|
||||
|
||||
// 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',
|
||||
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')
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue