NOTICK: Fix some Gradle technical debt. (#6430)

This commit is contained in:
Chris Rankin 2020-07-07 09:08:58 +01:00 committed by GitHub
parent 8175d4f0fb
commit 16eb9dfc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 43 additions and 44 deletions

View File

@ -275,7 +275,7 @@ allprojects {
toolVersion = "0.8.3"
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xlint:-options" << "-parameters"
options.compilerArgs << '-XDenableSunApiLintControl'
if (warnings_as_errors) {
@ -287,7 +287,7 @@ allprojects {
options.encoding = 'UTF-8'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
@ -302,7 +302,7 @@ allprojects {
task.dependsOn tasks.withType(AbstractCompile)
}
tasks.withType(Jar) { task ->
tasks.withType(Jar).configureEach { task ->
// Includes War and Ear
manifest {
attributes('Corda-Release-Version': corda_release_version)
@ -314,7 +314,7 @@ allprojects {
}
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
forkEvery = 10
ignoreFailures = project.hasProperty('tests.ignoreFailures') ? project.property('tests.ignoreFailures').toBoolean() : false
failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false
@ -339,7 +339,7 @@ allprojects {
systemProperty 'java.security.egd', 'file:/dev/./urandom'
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
if (name.contains("integrationTest")) {
maxParallelForks = (System.env.CORDA_INT_TESTING_FORKS == null) ? 1 : "$System.env.CORDA_INT_TESTING_FORKS".toInteger()
}
@ -520,7 +520,7 @@ tasks.register('detektBaseline', JavaExec) {
args(params)
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
@ -626,7 +626,7 @@ dependxiesModule {
skipTasks = "test,integrationTest,smokeTest,slowIntegrationTest"
}
task generateApi(type: net.corda.plugins.GenerateApi) {
tasks.register('generateApi', net.corda.plugins.GenerateApi) {
baseName = "api-corda"
}

View File

@ -99,7 +99,7 @@ configurations {
testArtifacts.extendsFrom testRuntimeClasspath
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
// fork a new test process for every test class
forkEvery = 10
}

View File

@ -16,7 +16,7 @@ ext {
deterministic_rt_jar = jdk8uDeterministic.rt_jar
}
tasks.withType(AbstractCompile) {
tasks.withType(AbstractCompile).configureEach {
dependsOn jdkTask
// This is a bit ugly, but Gradle isn't recognising the KotlinCompile task
@ -29,7 +29,7 @@ tasks.withType(AbstractCompile) {
}
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-bootclasspath' << deterministic_rt_jar
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8

View File

@ -22,4 +22,7 @@ jar.enabled = false
shadowJar {
baseName = "avalanche"
}
assemble.dependsOn shadowJar
artifacts {
archives shadowJar
}

View File

@ -6,7 +6,7 @@ import static org.gradle.api.JavaVersion.VERSION_1_8
*/
apply plugin: 'kotlin'
tasks.withType(AbstractCompile) {
tasks.withType(AbstractCompile).configureEach {
// This is a bit ugly, but Gradle isn't recognising the KotlinCompile task
// as it does the built-in JavaCompile task.
if (it.class.name.startsWith('org.jetbrains.kotlin.gradle.tasks.KotlinCompile')) {
@ -16,7 +16,7 @@ tasks.withType(AbstractCompile) {
}
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}

View File

@ -243,12 +243,12 @@ dependencies {
testCompile project(':testing:cordapps:dbfailure:dbfworkflows')
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
// Resolves a Gradle warning about not scanning for pre-processors.
options.compilerArgs << '-proc:none'
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
if (JavaVersion.current() == JavaVersion.VERSION_11) {
jvmArgs '-Djdk.attach.allowAttachSelf=true'
}

View File

@ -119,9 +119,8 @@ task buildCordaJAR(type: FatCapsule, dependsOn: [
}
}
assemble.dependsOn buildCordaJAR
artifacts {
archives buildCordaJAR
runtimeArtifacts buildCordaJAR
publish buildCordaJAR {
classifier ''

View File

@ -153,7 +153,7 @@ task integrationTest(type: Test, dependsOn: []) {
// This fixes the "line too long" error when running this demo with windows CLI
// TODO: Automatically apply to all projects via a plugin
tasks.withType(CreateStartScripts).each { task ->
tasks.withType(CreateStartScripts).configureEach { task ->
task.doLast {
String text = task.windowsScript.text
// Replaces the per file classpath (which are all jars in "lib") with a wildcard on lib

View File

@ -56,7 +56,7 @@ jar {
}
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
useJUnitPlatform()
systemProperty 'deterministic-rt.path', configurations.jdkRt.asPath
systemProperty 'sandbox-libraries.path', configurations.sandboxTesting.asPath

View File

@ -64,9 +64,8 @@ task buildWebserverJar(type: FatCapsule, dependsOn: project(':node').tasks.jar)
}
}
assemble.dependsOn buildWebserverJar
artifacts {
archives buildWebserverJar
runtimeArtifacts buildWebserverJar
publish buildWebserverJar {
classifier ''

View File

@ -90,7 +90,7 @@ dependencies {
testCompile "junit:junit:$junit_version"
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
// Resolves a Gradle warning about not scanning for pre-processors.
options.compilerArgs << '-proc:none'
}

View File

@ -1,17 +1,13 @@
apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
mavenCentral()
}
dependencies {
implementation project(":common-logging")
implementation project(":tools:cliutils")
implementation "info.picocli:picocli:$picocli_version"
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
testCompile "junit:junit:4.12"
testImplementation "junit:junit:$junit_version"
}
jar {
@ -28,4 +24,6 @@ shadowJar {
}
}
assemble.dependsOn shadowJar
artifacts {
archives shadowJar
}

View File

@ -71,7 +71,7 @@ dependencies {
compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
// Resolves a Gradle warning about not scanning for pre-processors.
options.compilerArgs << '-proc:none'
}
@ -82,4 +82,4 @@ jar {
'Automatic-Module-Name': 'net.corda.tools.explorer'
)
}
}
}

View File

@ -41,9 +41,8 @@ task buildExplorerJAR(type: FatCapsule, dependsOn: project(':tools:explorer').ta
}
}
assemble.dependsOn buildExplorerJAR
artifacts {
archives buildExplorerJAR
runtimeArtifacts buildExplorerJAR
publish buildExplorerJAR {
classifier ""

View File

@ -62,7 +62,7 @@ dependencies {
compile "org.controlsfx:controlsfx:$controlsfx_version"
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
// Resolves a Gradle warning about not scanning for pre-processors.
options.compilerArgs << '-proc:none'
}
@ -78,13 +78,13 @@ shadowJar {
zip64 true
}
task buildNetworkBuilder(dependsOn: shadowJar)
assemble.dependsOn buildNetworkBuilder
tasks.register('buildNetworkBuilder') {
dependsOn shadowJar
}
artifacts {
publish shadowJar {
archiveClassifier = jdkClassifier
}
archives shadowJar
publish shadowJar
}
jar {

View File

@ -27,16 +27,17 @@ processResources {
}
shadowJar {
archiveClassifier = jdkClassifier
mergeServiceFiles()
}
task buildShellCli(dependsOn: shadowJar)
assemble.dependsOn buildShellCli
tasks.register('buildShellCli') {
dependsOn shadowJar
}
artifacts {
publish shadowJar {
archiveClassifier = jdkClassifier
}
archives shadowJar
publish shadowJar
}
jar {

View File

@ -71,7 +71,7 @@ dependencies {
integrationTestCompile project(':node-driver')
}
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
// Resolves a Gradle warning about not scanning for pre-processors.
options.compilerArgs << '-proc:none'
}