Skip to content

Commit

Permalink
Syncing Gradle build/test behavior for SonarQube (#806)
Browse files Browse the repository at this point in the history
* Syncing Gradle build/test behavior for SonarQube

Signed-off-by: Chris Helma <[email protected]>

* Added jacoco to coreUtils gradle plugins

Signed-off-by: Chris Helma <[email protected]>

---------

Signed-off-by: Chris Helma <[email protected]>
  • Loading branch information
chelma authored Jul 10, 2024
1 parent c6b1cc9 commit c6326ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DocumentsFromSnapshotMigration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ task slowTest(type: Test) {
jacocoTestReport {
dependsOn slowTest
reports {
xml.required = true
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
html.required = true
html.destination file("${buildDir}/reports/jacoco/test/html")
}
Expand Down
18 changes: 18 additions & 0 deletions coreUtilities/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins {
id 'org.opensearch.migrations.java-library-conventions'
id 'io.freefair.lombok'
id 'java'
id 'jacoco'
id 'java-test-fixtures'
}

Expand Down Expand Up @@ -65,6 +66,23 @@ dependencies {
testFixturesImplementation group: 'org.slf4j', name: 'slf4j-api'
}

// Utility task to allow copying required libraries into a 'dependencies' folder for security scanning
tasks.register('copyDependencies', Sync) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

from configurations.runtimeClasspath
into "${buildDir}/dependencies"
}

jacocoTestReport {
reports {
xml.required = true
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
html.required = true
html.destination file("${buildDir}/reports/jacoco/test/html")
}
}

tasks.named('test') {
useJUnitPlatform()
}

0 comments on commit c6326ea

Please sign in to comment.