Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build scripts to work on Gradle 6.1 #467

Open
wants to merge 2 commits into
base: kotlin-experiments
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'check jacocoTestReport sonarqube'
tasks: 'check sonarqube'

- script: |
./gradlew --stop
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
7 changes: 6 additions & 1 deletion gradle/code-quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
81 changes: 0 additions & 81 deletions gradle/testing.gradle
Original file line number Diff line number Diff line change
@@ -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<File>) 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
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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