BUILD: Resolve warnings with Gradle and system property API usage. (#4904)

This commit is contained in:
Chris Rankin 2019-03-20 13:39:51 +00:00 committed by Rick Parker
parent 3333464c39
commit 4b41bd0189
2 changed files with 11 additions and 14 deletions

View File

@ -162,9 +162,9 @@ allprojects {
suppressionFile = '.ci/dependency-checker/suppressedLibraries.xml'
cveValidForHours = 1
format = 'ALL'
failOnError = project.getProperty('owasp.failOnError')
failOnError = project.property('owasp.failOnError')
// by default CVSS is '11' which passes everything. Set between 0-10 to catch vulnerable deps
failBuildOnCVSS = project.getProperty('owasp.failBuildOnCVSS').toFloat()
failBuildOnCVSS = project.property('owasp.failBuildOnCVSS').toFloat()
analyzers {
assemblyEnabled = false
@ -180,7 +180,7 @@ allprojects {
options.encoding = 'UTF-8'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
@ -208,8 +208,12 @@ allprojects {
// Prevent the project from creating temporary files outside of the build directory.
systemProperty 'java.io.tmpdir', buildDir.absolutePath
if (project.hasProperty('test.parallel') && project.property('test.parallel').toBoolean()) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) as int ?: 1
}
if (System.getProperty("test.maxParallelForks") != null) {
maxParallelForks = Integer.valueOf(System.getProperty("test.maxParallelForks"))
maxParallelForks = Integer.getInteger('test.maxParallelForks')
logger.debug("System property test.maxParallelForks found - setting max parallel forks to $maxParallelForks for $project")
}
@ -273,14 +277,6 @@ allprojects {
}
}
subprojects {
tasks.withType(Test) {
if (project.getProperty('test.parallel').toBoolean()) {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
}
}
// Check that we are running on a Java 8 JDK. The source/targetCompatibility values above aren't sufficient to
// guarantee this because those are properties checked by the Java plugin, but we're using Kotlin.
//

View File

@ -1,6 +1,7 @@
kotlin.incremental=true
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8
org.gradle.caching=true
org.gradle.caching=false
owasp.failOnError=false
owasp.failBuildOnCVSS=11.0
test.parallel=false
compilation.allWarningsAsErrors=false
test.parallel=false