diff options
author | Dominik Stadler <centic@apache.org> | 2021-12-06 15:00:06 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-12-06 15:00:06 +0000 |
commit | 21039bd2b1064db9469d6cfec83308c3418a0139 (patch) | |
tree | 471bebc9f169e6d460a85318e1e02e2c5a068436 /build.gradle | |
parent | 2d347b5a610023427980941fd458422b638158bd (diff) | |
download | poi-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
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 70 |
1 files changed, 46 insertions, 24 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') |