From 483d668d4e57731888f352df7620554266f25dae Mon Sep 17 00:00:00 2001 From: Gary Tierney Date: Thu, 6 Feb 2020 00:04:13 +0000 Subject: [PATCH 1/2] Update build scripts to work on Gradle 6.1 Removes the custom JaCoCo report aggregation code, which is now handled automatically by Gradle. --- build.gradle | 3 +- gradle/code-quality.gradle | 7 +- gradle/testing.gradle | 81 ------------------------ gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 8 insertions(+), 85 deletions(-) diff --git a/build.gradle b/build.gradle index c1756fcf0..41c11233b 100644 --- a/build.gradle +++ b/build.gradle @@ -19,15 +19,14 @@ allprojects { apply from: 'gradle/properties.gradle' apply from: 'gradle/code-quality.gradle' -apply from: 'gradle/testing.gradle' apply from: 'gradle/wrapper.gradle' +apply plugin: "jacoco" gradle.projectsEvaluated { task check { def deps = [] deps += getTasksByName("check", true).findAll { it.project != rootProject } deps += "detekt" - deps += jacocoReport dependsOn(deps) } diff --git a/gradle/code-quality.gradle b/gradle/code-quality.gradle index 98b7506f2..78d3880d8 100644 --- a/gradle/code-quality.gradle +++ b/gradle/code-quality.gradle @@ -12,8 +12,13 @@ detekt { parallel = true } + sonarqube { properties { + property "sonar.organization", "apollo-rsps" + property "sonar.projectKey", "apollo:org.apollo" + property "sonar.projectName", "Apollo RSPS" + property "sonar.kotlin.file.suffixes", ".kt,.kts" property "sonar.kotlin.detekt.reportPaths", detektAggregateReport } -} \ No newline at end of file +} diff --git a/gradle/testing.gradle b/gradle/testing.gradle index 5b3a7cd17..e69de29bb 100644 --- a/gradle/testing.gradle +++ b/gradle/testing.gradle @@ -1,81 +0,0 @@ -apply plugin: "jacoco" - -def jacocoCoverageAggregate = "$buildDir/jacoco/jacocoTestAll.exec" - -def testedProjects() { - subprojects.findAll { subproject -> subproject.plugins.hasPlugin('java') || subproject.plugins.hasPlugin('kotlin') } -} -gradle.projectsEvaluated { - configure(testedProjects()) { - apply plugin: "jacoco" - - jacoco { - toolVersion = '0.8.4' - } - - test { - reports { - junitXml.enabled = true - html.enabled = false - } - - jacoco { - append = false - destinationFile = file("$buildDir/jacoco/jacocoTest.exec") - classDumpDir = file("$buildDir/jacoco/classpathdumps") - } - } - } - - task jacocoMerge(type: JacocoMerge) { - destinationFile = file(jacocoCoverageAggregate) - executionData = project.fileTree(dir: '.', include: '**/build/jacoco/jacocoTest.exec') - - dependsOn(getTasksByName('test', true)) - } - - - task jacocoReport(type: JacocoReport) { - sourceDirectories = files() - classDirectories = files() - executionData = files() - - reports { - html.enabled = true - xml.enabled = true - csv.enabled = false - } - - // Work-around to allow us to build list of executionData files in doFirst - onlyIf = { - true - } - - /* - * Builds list of source dirs, class dirs, and executionData files - * when task is run, not at script evaluation time - */ - doFirst { - subprojects.findAll { subproject -> - subproject.pluginManager.hasPlugin('java') || subproject.pluginManager.hasPlugin('kotlin') - }.each { subproject -> - additionalSourceDirs files((Set) subproject.sourceSets.main.allSource.srcDirs) - additionalClassDirs((FileCollection) subproject.sourceSets.main.output) - } - - executionData = files(jacocoCoverageAggregate) - } - - dependsOn(jacocoMerge) - } - - sonarqube { - properties { - property "sonar.organization", "apollo-rsps" - property "sonar.projectKey", "apollo:org.apollo" - property "sonar.projectName", "Apollo RSPS" - property "sonar.kotlin.file.suffixes", ".kt,.kts" - property "sonar.jacoco.reportPaths", jacocoCoverageAggregate - } - } -} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ce16fd39a..36dc8c844 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip From 718134392989ee70322722fb9b9dd17adf218aba Mon Sep 17 00:00:00 2001 From: Gary Tierney Date: Thu, 6 Feb 2020 00:14:56 +0000 Subject: [PATCH 2/2] Remove custom JaCoCo task from CI runner --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2167045f3..dd9174341 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ steps: jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/TEST-*.xml' - tasks: 'check jacocoTestReport sonarqube' + tasks: 'check sonarqube' - script: | ./gradlew --stop