Skip to content

Commit

Permalink
Centralized Gradle behavior for sub-projects (#807)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Helma <[email protected]>
  • Loading branch information
chelma authored Jul 10, 2024
1 parent c6326ea commit 1287f93
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 96 deletions.
18 changes: 0 additions & 18 deletions CreateSnapshot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'java'
id 'jacoco'
id 'io.freefair.lombok' version '8.6'
}

Expand All @@ -27,23 +26,6 @@ application {
mainClassName = 'com.rfs.CreateSnapshot'
}

// 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")
}
}

test {
useJUnitPlatform()
}
17 changes: 1 addition & 16 deletions DocumentsFromSnapshotMigration/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'java'
id 'jacoco'
id 'io.freefair.lombok' version '8.6'
id "com.avast.gradle.docker-compose" version "0.17.4"
id 'com.bmuschko.docker-remote-api'
Expand Down Expand Up @@ -70,14 +69,6 @@ clean.doFirst {
delete project.file("./docker/build")
}

// 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"
}

task copyDockerRuntimeJars (type: Sync) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
description = 'Copy runtime JARs and app jar to docker build directory'
Expand Down Expand Up @@ -167,12 +158,6 @@ task slowTest(type: Test) {
}
}

jacocoTestReport {
tasks.named('jacocoTestReport').configure {
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")
}
}
18 changes: 0 additions & 18 deletions MetadataMigration/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'java'
id 'jacoco'
id 'io.freefair.lombok' version '8.6'
}

Expand All @@ -27,23 +26,6 @@ application {
mainClassName = 'com.rfs.MetadataMigration'
}

// 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")
}
}

test {
useJUnitPlatform()
}
18 changes: 0 additions & 18 deletions RFS/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'java'
id 'jacoco'
id 'io.freefair.lombok' version '8.6'
id 'java-test-fixtures'
}
Expand Down Expand Up @@ -94,23 +93,6 @@ task migrateDocuments (type: JavaExec) {
mainClass = 'com.rfs.RfsMigrateDocuments'
}

// 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")
}
}

test {
useJUnitPlatform {
excludeTags 'longTest'
Expand Down
8 changes: 0 additions & 8 deletions TrafficCapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ allprojects {
enabled = true
}
}

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

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

jacocoTestReport {
Expand Down
18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ task buildDockerImages() {
}

subprojects {
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven-publish'

Expand Down Expand Up @@ -88,6 +89,23 @@ subprojects {
}
}
}

// 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")
}
}
}

task listPublishedArtifacts {
Expand Down
18 changes: 0 additions & 18 deletions coreUtilities/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ plugins {
id 'org.opensearch.migrations.java-library-conventions'
id 'io.freefair.lombok'
id 'java'
id 'jacoco'
id 'java-test-fixtures'
}

Expand Down Expand Up @@ -66,23 +65,6 @@ 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 1287f93

Please sign in to comment.