From 99ee2d55158cc5f6e0d8235d57eaf46426650dda Mon Sep 17 00:00:00 2001 From: Chakru <161002324+chakru-r@users.noreply.github.com> Date: Tue, 3 Dec 2024 06:57:43 +0530 Subject: [PATCH] build(coverage): enable code coverage for java and python (#11992) Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com> --- datahub-graphql-core/build.gradle | 1 + datahub-upgrade/build.gradle | 1 + entity-registry/build.gradle | 3 ++ .../template/UpstreamLineageTemplateTest.java | 4 +-- gradle/coverage/java-coverage.gradle | 31 +++++++++++++++++++ gradle/coverage/python-coverage.gradle | 18 +++++++++++ ingestion-scheduler/build.gradle | 2 ++ li-utils/build.gradle | 3 ++ metadata-auth/auth-api/build.gradle | 1 + metadata-dao-impl/kafka-producer/build.gradle | 2 ++ metadata-events/mxe-utils-avro/build.gradle | 2 ++ .../airflow-plugin/build.gradle | 4 ++- .../dagster-plugin/build.gradle | 4 ++- .../gx-plugin/build.gradle | 4 ++- .../prefect-plugin/build.gradle | 6 ++-- metadata-ingestion/build.gradle | 14 ++++----- .../java/acryl-spark-lineage/build.gradle | 6 +--- .../java/datahub-client/build.gradle | 6 +--- .../java/datahub-event/build.gradle | 7 +---- .../java/datahub-protobuf/build.gradle | 11 ++----- .../java/openlineage-converter/build.gradle | 10 ++---- .../java/spark-lineage-legacy/build.gradle | 11 ------- metadata-io/build.gradle | 2 ++ metadata-io/metadata-io-api/build.gradle | 2 ++ metadata-jobs/common/build.gradle | 2 ++ metadata-jobs/mae-consumer-job/build.gradle | 1 + metadata-jobs/mae-consumer/build.gradle | 2 +- metadata-jobs/mce-consumer-job/build.gradle | 1 + metadata-jobs/mce-consumer/build.gradle | 1 + metadata-jobs/pe-consumer/build.gradle | 2 ++ metadata-models-custom/build.gradle | 2 ++ metadata-models-validator/build.gradle | 2 ++ metadata-models/build.gradle | 1 + metadata-operation-context/build.gradle | 1 + metadata-service/auth-config/build.gradle | 2 ++ metadata-service/auth-filter/build.gradle | 2 ++ metadata-service/auth-impl/build.gradle | 1 + .../auth-servlet-impl/build.gradle | 2 ++ metadata-service/configuration/build.gradle | 2 ++ metadata-service/factories/build.gradle | 1 + .../graphql-servlet-impl/build.gradle | 2 ++ .../openapi-analytics-servlet/build.gradle | 2 ++ .../openapi-entity-servlet/build.gradle | 2 ++ metadata-service/openapi-servlet/build.gradle | 2 ++ metadata-service/plugin/build.gradle | 2 ++ metadata-service/restli-api/build.gradle | 2 ++ .../restli-client-api/build.gradle | 2 ++ metadata-service/restli-client/build.gradle | 2 ++ .../restli-servlet-impl/build.gradle | 2 ++ .../schema-registry-api/build.gradle | 1 + .../schema-registry-servlet/build.gradle | 2 ++ metadata-service/services/build.gradle | 2 ++ metadata-service/servlet/build.gradle | 2 ++ metadata-service/war/build.gradle | 1 + metadata-utils/build.gradle | 2 ++ mock-entity-registry/build.gradle | 2 ++ 56 files changed, 151 insertions(+), 59 deletions(-) create mode 100644 gradle/coverage/java-coverage.gradle create mode 100644 gradle/coverage/python-coverage.gradle diff --git a/datahub-graphql-core/build.gradle b/datahub-graphql-core/build.gradle index 49a7fa7fbfbc2f..47ada8e9929dd3 100644 --- a/datahub-graphql-core/build.gradle +++ b/datahub-graphql-core/build.gradle @@ -3,6 +3,7 @@ plugins { id "io.github.kobylynskyi.graphql.codegen" version "4.1.1" } +apply from: '../gradle/coverage/java-coverage.gradle' dependencies { implementation project(':metadata-service:restli-client-api') diff --git a/datahub-upgrade/build.gradle b/datahub-upgrade/build.gradle index b783efa09713d1..372b0eb0570b98 100644 --- a/datahub-upgrade/build.gradle +++ b/datahub-upgrade/build.gradle @@ -5,6 +5,7 @@ plugins { } apply from: "../gradle/versioning/versioning.gradle" +apply from: "../gradle/coverage/java-coverage.gradle" ext { docker_registry = rootProject.ext.docker_registry == 'linkedin' ? 'acryldata' : docker_registry diff --git a/entity-registry/build.gradle b/entity-registry/build.gradle index 22e5b601d39db2..e5baa95967f304 100644 --- a/entity-registry/build.gradle +++ b/entity-registry/build.gradle @@ -4,6 +4,8 @@ plugins { id 'java-test-fixtures' } +apply from: "../gradle/coverage/java-coverage.gradle" + dependencies { implementation spec.product.pegasus.data implementation spec.product.pegasus.generator @@ -53,3 +55,4 @@ dependencies { testFixturesAnnotationProcessor externalDependency.lombok } compileTestJava.dependsOn tasks.getByPath(':entity-registry:custom-test-model:modelDeploy') + diff --git a/entity-registry/src/test/java/com/linkedin/metadata/aspect/patch/template/UpstreamLineageTemplateTest.java b/entity-registry/src/test/java/com/linkedin/metadata/aspect/patch/template/UpstreamLineageTemplateTest.java index f9af15a3d4cc6c..f934dd8961ca37 100644 --- a/entity-registry/src/test/java/com/linkedin/metadata/aspect/patch/template/UpstreamLineageTemplateTest.java +++ b/entity-registry/src/test/java/com/linkedin/metadata/aspect/patch/template/UpstreamLineageTemplateTest.java @@ -272,8 +272,8 @@ public void testLargePatchStandard() throws Exception { UpstreamLineage result = upstreamLineageTemplate.applyPatch(upstreamLineage, jsonPatch); long end = System.currentTimeMillis(); assertTrue( - end - start < 10000, - String.format("Expected less then 10 seconds patch actual %s ms", end - start)); + end - start < 20000, + String.format("Expected less then 20 seconds patch actual %s ms", end - start)); assertEquals(result.getUpstreams().size(), 187, "Expected 1 less upstream"); assertEquals(result.getFineGrainedLineages().size(), 607); diff --git a/gradle/coverage/java-coverage.gradle b/gradle/coverage/java-coverage.gradle new file mode 100644 index 00000000000000..17260c1a309788 --- /dev/null +++ b/gradle/coverage/java-coverage.gradle @@ -0,0 +1,31 @@ +apply plugin: "jacoco" + +jacoco { + toolVersion = "0.8.12" +} + +/* +These need to run after evaluation since jacoco plugin alters the test task based on the included test +lib dependencies defined in each subproject (junit or testNG) +*/ +afterEvaluate { + test { + finalizedBy jacocoTestReport + } + + jacocoTestReport { + dependsOn test + reports { + xml { + required = true + /* + Tools that aggregate and analyse coverage tools search for the coverage result files. Keeping them under one + folder will minimize the time spent searching through the full source tree. + */ + outputLocation = rootProject.layout.buildDirectory.file("coverage-reports/jacoco-${project.name}.xml") + } + csv.required = false + html.required = false + } + } +} \ No newline at end of file diff --git a/gradle/coverage/python-coverage.gradle b/gradle/coverage/python-coverage.gradle new file mode 100644 index 00000000000000..0ab921dfb21ffd --- /dev/null +++ b/gradle/coverage/python-coverage.gradle @@ -0,0 +1,18 @@ +//coverage related args to be passed to pytest +ext.get_coverage_args = { test_name = "" -> + + def coverage_file_name = "pycov-${project.name}${test_name}.xml" + + /* + Tools that aggregate and analyse coverage tools search for the coverage result files. Keeping them under one folder + will minimize the time spent searching through the full source tree. + */ + def base_path = "${rootProject.buildDir}/coverage-reports" + + /* + --cov=src was added via setup.cfg in many of the python projects but for some reason, was not getting picked up + consistently, so adding it explicitly. Centralizing these params would make it easier to adjust them for all python + projects (with overrides being in the sub-project build script.) + */ + return "--cov-report xml:${base_path}/${coverage_file_name} --cov=src" +} \ No newline at end of file diff --git a/ingestion-scheduler/build.gradle b/ingestion-scheduler/build.gradle index 9505ec57aa858c..fb1cfd4e27a4b5 100644 --- a/ingestion-scheduler/build.gradle +++ b/ingestion-scheduler/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: "../gradle/coverage/java-coverage.gradle" + dependencies { implementation project(path: ':metadata-models') implementation project(path: ':metadata-io') diff --git a/li-utils/build.gradle b/li-utils/build.gradle index 975cd2bccccf31..e00fcc28546123 100644 --- a/li-utils/build.gradle +++ b/li-utils/build.gradle @@ -1,8 +1,11 @@ + plugins { id 'java-library' id 'pegasus' } +apply from: "../gradle/coverage/java-coverage.gradle" + dependencies { api spec.product.pegasus.data diff --git a/metadata-auth/auth-api/build.gradle b/metadata-auth/auth-api/build.gradle index acc1af7e2e3ad6..3aafaf45bc2cb8 100644 --- a/metadata-auth/auth-api/build.gradle +++ b/metadata-auth/auth-api/build.gradle @@ -8,6 +8,7 @@ apply plugin: 'signing' apply plugin: 'maven-publish' apply plugin: 'io.codearte.nexus-staging' apply from: '../../metadata-integration/java/versioning.gradle' +apply from: '../../gradle/coverage/java-coverage.gradle' jar { archiveClassifier = "lib" diff --git a/metadata-dao-impl/kafka-producer/build.gradle b/metadata-dao-impl/kafka-producer/build.gradle index 2df15309810dba..d3ba031817afe8 100644 --- a/metadata-dao-impl/kafka-producer/build.gradle +++ b/metadata-dao-impl/kafka-producer/build.gradle @@ -1,5 +1,7 @@ apply plugin: 'java' +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-events:mxe-avro') implementation project(':metadata-events:mxe-registration') diff --git a/metadata-events/mxe-utils-avro/build.gradle b/metadata-events/mxe-utils-avro/build.gradle index 860ced6af25813..f893fadb8e2dff 100644 --- a/metadata-events/mxe-utils-avro/build.gradle +++ b/metadata-events/mxe-utils-avro/build.gradle @@ -3,6 +3,8 @@ plugins { id 'pegasus' } +apply from: "../../gradle/coverage/java-coverage.gradle" + dependencies { api project(':metadata-events:mxe-avro') api project(':metadata-models') diff --git a/metadata-ingestion-modules/airflow-plugin/build.gradle b/metadata-ingestion-modules/airflow-plugin/build.gradle index 9506609a10044a..f30858ba6a14ef 100644 --- a/metadata-ingestion-modules/airflow-plugin/build.gradle +++ b/metadata-ingestion-modules/airflow-plugin/build.gradle @@ -2,6 +2,8 @@ plugins { id 'base' } +apply from: "../../gradle/coverage/python-coverage.gradle" + ext { python_executable = 'python3' venv_name = 'venv' @@ -97,7 +99,7 @@ task testQuick(type: Exec, dependsOn: installTest) { inputs.files(project.fileTree(dir: "tests/")) commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + - "pytest --cov-config=setup.cfg --cov-report xml:coverage_quick.xml -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" + "pytest --cov-config=setup.cfg ${get_coverage_args('quick')} -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" } diff --git a/metadata-ingestion-modules/dagster-plugin/build.gradle b/metadata-ingestion-modules/dagster-plugin/build.gradle index 0f11af9ca83d73..0d57bb5bfdff70 100644 --- a/metadata-ingestion-modules/dagster-plugin/build.gradle +++ b/metadata-ingestion-modules/dagster-plugin/build.gradle @@ -2,6 +2,8 @@ plugins { id 'base' } +apply from: "../../gradle/coverage/python-coverage.gradle" + ext { python_executable = 'python3' venv_name = 'venv' @@ -84,7 +86,7 @@ task testQuick(type: Exec, dependsOn: installDevTest) { outputs.dir("${venv_name}") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + - "pytest -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" + "pytest -vv ${get_coverage_args('quick')} --continue-on-collection-errors --junit-xml=junit.quick.xml" } task buildWheel(type: Exec, dependsOn: [environmentSetup]) { diff --git a/metadata-ingestion-modules/gx-plugin/build.gradle b/metadata-ingestion-modules/gx-plugin/build.gradle index 2288ae6bd83961..70bc3e0360a3a4 100644 --- a/metadata-ingestion-modules/gx-plugin/build.gradle +++ b/metadata-ingestion-modules/gx-plugin/build.gradle @@ -2,6 +2,8 @@ plugins { id 'base' } +apply from: "../../gradle/coverage/python-coverage.gradle" + ext { python_executable = 'python3' venv_name = 'venv' @@ -84,7 +86,7 @@ task testQuick(type: Exec, dependsOn: installDevTest) { outputs.dir("${venv_name}") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + - "pytest -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" + "pytest -vv ${get_coverage_args('quick')} --continue-on-collection-errors --junit-xml=junit.quick.xml" } task buildWheel(type: Exec, dependsOn: [environmentSetup]) { diff --git a/metadata-ingestion-modules/prefect-plugin/build.gradle b/metadata-ingestion-modules/prefect-plugin/build.gradle index bc091c64933645..a2b240cc8bf708 100644 --- a/metadata-ingestion-modules/prefect-plugin/build.gradle +++ b/metadata-ingestion-modules/prefect-plugin/build.gradle @@ -2,6 +2,8 @@ plugins { id 'base' } +apply from: "../../gradle/coverage/python-coverage.gradle" + ext { python_executable = 'python3' venv_name = 'venv' @@ -82,14 +84,14 @@ task testQuick(type: Exec, dependsOn: installDevTest) { outputs.dir("${venv_name}") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + - "pytest --cov-config=setup.cfg --cov-report xml:coverage_quick.xml -vv --continue-on-collection-errors --junit-xml=junit.quick.xml -s" + "pytest --cov-config=setup.cfg ${get_coverage_args('quick')} -vv --continue-on-collection-errors --junit-xml=junit.quick.xml -s" } task testFull(type: Exec, dependsOn: [testQuick, installDevTest]) { commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + - "pytest -m 'not slow_integration' -vv --continue-on-collection-errors --junit-xml=junit.full.xml" + "pytest -m 'not slow_integration' -vv ${get_coverage_args('full')} --continue-on-collection-errors --junit-xml=junit.full.xml" } diff --git a/metadata-ingestion/build.gradle b/metadata-ingestion/build.gradle index 4e03dd6e2faaf2..2c5d8e6c9646a8 100644 --- a/metadata-ingestion/build.gradle +++ b/metadata-ingestion/build.gradle @@ -2,6 +2,8 @@ plugins { id 'base' } +apply from: "../gradle/coverage/python-coverage.gradle" + ext { python_executable = 'python3' venv_name = 'venv' @@ -11,10 +13,6 @@ if (!project.hasProperty("extra_pip_requirements")) { ext.extra_pip_requirements = "" } -def get_coverage_arg(test_name) { - return "--cov-report xml:coverage_${test_name}.xml " -} - task checkPythonVersion(type: Exec) { commandLine python_executable, '-c', 'import sys; sys.version_info >= (3, 8), f"Python version {sys.version_info[:2]} not allowed"' @@ -134,7 +132,7 @@ task testQuick(type: Exec, dependsOn: [installDev, ':metadata-models:generateJso inputs.files(project.fileTree(dir: "src/", include: "**/*.py")) inputs.files(project.fileTree(dir: "tests/")) outputs.dir("${venv_name}") - def cvg_arg = get_coverage_arg("quick") + def cvg_arg = get_coverage_args("quick") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + "pytest ${cvg_arg} tests/unit --random-order --durations=20 -m 'not integration' -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" @@ -166,19 +164,19 @@ task testSingle(dependsOn: [installDevTest]) { } task testIntegrationBatch0(type: Exec, dependsOn: [installDevTest]) { - def cvg_arg = get_coverage_arg("intBatch0") + def cvg_arg = get_coverage_args("intBatch0") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + "pytest ${cvg_arg} --durations=50 -m 'integration_batch_0' -vv --continue-on-collection-errors --junit-xml=junit.integrationbatch0.xml" } task testIntegrationBatch1(type: Exec, dependsOn: [installDevTest]) { - def cvg_arg = get_coverage_arg("intBatch1") + def cvg_arg = get_coverage_args("intBatch1") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + "pytest ${cvg_arg} --durations=50 -m 'integration_batch_1' -vv --continue-on-collection-errors --junit-xml=junit.integrationbatch1.xml" } task testIntegrationBatch2(type: Exec, dependsOn: [installDevTest]) { - def cvg_arg = get_coverage_arg("intBatch2") + def cvg_arg = get_coverage_args("intBatch2") commandLine 'bash', '-c', "source ${venv_name}/bin/activate && set -x && " + "pytest ${cvg_arg} --durations=20 -m 'integration_batch_2' -vv --continue-on-collection-errors --junit-xml=junit.integrationbatch2.xml" diff --git a/metadata-integration/java/acryl-spark-lineage/build.gradle b/metadata-integration/java/acryl-spark-lineage/build.gradle index 3f83e5657bbf4d..940ebb98485367 100644 --- a/metadata-integration/java/acryl-spark-lineage/build.gradle +++ b/metadata-integration/java/acryl-spark-lineage/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'signing' apply plugin: 'io.codearte.nexus-staging' apply plugin: 'maven-publish' -apply plugin: 'jacoco' +apply from: '../../../gradle/coverage/java-coverage.gradle' apply from: '../versioning.gradle' jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation @@ -163,14 +163,10 @@ checkShadowJar { dependsOn shadowJar } -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} test { forkEvery = 1 useJUnit() - finalizedBy jacocoTestReport } assemble { diff --git a/metadata-integration/java/datahub-client/build.gradle b/metadata-integration/java/datahub-client/build.gradle index 56a486ad043305..87a9623bbf062f 100644 --- a/metadata-integration/java/datahub-client/build.gradle +++ b/metadata-integration/java/datahub-client/build.gradle @@ -2,12 +2,12 @@ plugins { id("com.palantir.git-version") apply false id 'java-library' id 'com.github.johnrengelman.shadow' - id 'jacoco' id 'signing' id 'io.codearte.nexus-staging' id 'maven-publish' } +apply from: "../../../gradle/coverage/java-coverage.gradle" apply from: "../versioning.gradle" import org.apache.tools.ant.filters.ReplaceTokens @@ -59,15 +59,11 @@ task copyAvroSchemas { compileJava.dependsOn copyAvroSchemas -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} test { // to avoid simultaneous executions of tests when complete build is run mustRunAfter(":metadata-io:test") useJUnit() - finalizedBy jacocoTestReport } task checkShadowJar(type: Exec) { diff --git a/metadata-integration/java/datahub-event/build.gradle b/metadata-integration/java/datahub-event/build.gradle index 395065404d1db8..24e119c6229369 100644 --- a/metadata-integration/java/datahub-event/build.gradle +++ b/metadata-integration/java/datahub-event/build.gradle @@ -2,12 +2,12 @@ plugins { id("com.palantir.git-version") apply false id 'java' id 'com.github.johnrengelman.shadow' - id 'jacoco' id 'signing' id 'io.codearte.nexus-staging' id 'maven-publish' } +apply from: "../../../gradle/coverage/java-coverage.gradle" apply from: "../versioning.gradle" dependencies { @@ -29,10 +29,6 @@ dependencies { testRuntimeOnly externalDependency.logbackClassicJava8 } -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} - task copyAvroSchemas { dependsOn(':metadata-events:mxe-schemas:renameNamespace') copy { @@ -47,7 +43,6 @@ test { // to avoid simultaneous executions of tests when complete build is run mustRunAfter(":metadata-io:test") useJUnit() - finalizedBy jacocoTestReport } // task sourcesJar(type: Jar) { diff --git a/metadata-integration/java/datahub-protobuf/build.gradle b/metadata-integration/java/datahub-protobuf/build.gradle index 8bc71c5da8f4a3..97595fd1345dc7 100644 --- a/metadata-integration/java/datahub-protobuf/build.gradle +++ b/metadata-integration/java/datahub-protobuf/build.gradle @@ -3,12 +3,12 @@ plugins { id "application" } apply plugin: 'java' -apply plugin: 'jacoco' apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'signing' apply plugin: 'io.codearte.nexus-staging' apply plugin: 'maven-publish' apply from: '../versioning.gradle' +apply from: '../../../gradle/coverage/java-coverage.gradle' jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation @@ -57,13 +57,6 @@ task compileProtobuf { } } -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} - -test.finalizedBy jacocoTestReport - - task checkShadowJar(type: Exec) { commandLine 'sh', '-c', 'scripts/check_jar.sh' } @@ -202,4 +195,4 @@ nexusStaging { password = System.getenv("NEXUS_PASSWORD") } -startScripts.dependsOn shadowJar \ No newline at end of file +startScripts.dependsOn shadowJar diff --git a/metadata-integration/java/openlineage-converter/build.gradle b/metadata-integration/java/openlineage-converter/build.gradle index d149104f089b36..1bf4a3c0fadb6a 100644 --- a/metadata-integration/java/openlineage-converter/build.gradle +++ b/metadata-integration/java/openlineage-converter/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'java-library' apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'signing' apply plugin: 'maven-publish' -apply plugin: 'jacoco' +apply from: '../../../gradle/coverage/java-coverage.gradle' apply from: '../versioning.gradle' repositories { @@ -27,20 +27,16 @@ dependencies { testImplementation externalDependency.testng } -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} - test { forkEvery = 1 useJUnit() - finalizedBy jacocoTestReport } test { useJUnit() - finalizedBy jacocoTestReport + useTestNG() } + shadowJar { zip64 = true archiveClassifier = '' diff --git a/metadata-integration/java/spark-lineage-legacy/build.gradle b/metadata-integration/java/spark-lineage-legacy/build.gradle index 8db8a09f8cc813..d33290c16b3a56 100644 --- a/metadata-integration/java/spark-lineage-legacy/build.gradle +++ b/metadata-integration/java/spark-lineage-legacy/build.gradle @@ -6,7 +6,6 @@ apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'signing' apply plugin: 'io.codearte.nexus-staging' apply plugin: 'maven-publish' -apply plugin: 'jacoco' apply from: '../versioning.gradle' jar.enabled = false // Since we only want to build shadow jars, disabling the regular jar creation @@ -123,15 +122,6 @@ shadowJar { finalizedBy checkShadowJar } -checkShadowJar { - dependsOn shadowJar -} - - -jacocoTestReport { - dependsOn test // tests are required to run before generating the report -} - test { forkEvery = 1 useJUnit() @@ -154,7 +144,6 @@ test { ] jvmArgs = sparkJava17CompatibleJvmArgs - finalizedBy jacocoTestReport } assemble { diff --git a/metadata-io/build.gradle b/metadata-io/build.gradle index 41294fab7b24a9..516a77d59d50bd 100644 --- a/metadata-io/build.gradle +++ b/metadata-io/build.gradle @@ -4,6 +4,8 @@ plugins { id 'io.ebean' version "${ebeanVersion}" // Use the latest version from global build.gradle } +apply from: '../gradle/coverage/java-coverage.gradle' + configurations { enhance } diff --git a/metadata-io/metadata-io-api/build.gradle b/metadata-io/metadata-io-api/build.gradle index 5273177b752819..a49da206a69a8d 100644 --- a/metadata-io/metadata-io-api/build.gradle +++ b/metadata-io/metadata-io-api/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':entity-registry') implementation project(':metadata-service:services') diff --git a/metadata-jobs/common/build.gradle b/metadata-jobs/common/build.gradle index b0a3a6827b7297..120806431b1df5 100644 --- a/metadata-jobs/common/build.gradle +++ b/metadata-jobs/common/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation(project(':metadata-service:factories')) { exclude group: 'org.neo4j.test' diff --git a/metadata-jobs/mae-consumer-job/build.gradle b/metadata-jobs/mae-consumer-job/build.gradle index 4980f81d61bb4d..1fb46582c03817 100644 --- a/metadata-jobs/mae-consumer-job/build.gradle +++ b/metadata-jobs/mae-consumer-job/build.gradle @@ -4,6 +4,7 @@ plugins { id 'com.palantir.docker' } +apply from: '../../gradle/coverage/java-coverage.gradle' apply from: "../../gradle/versioning/versioning.gradle" ext { diff --git a/metadata-jobs/mae-consumer/build.gradle b/metadata-jobs/mae-consumer/build.gradle index 6afc12c30e5f1f..b4990e289b10df 100644 --- a/metadata-jobs/mae-consumer/build.gradle +++ b/metadata-jobs/mae-consumer/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' } - +apply from: '../../gradle/coverage/java-coverage.gradle' apply plugin: 'pegasus' configurations { diff --git a/metadata-jobs/mce-consumer-job/build.gradle b/metadata-jobs/mce-consumer-job/build.gradle index 49c69626c211ca..d9b8965d7c8ac0 100644 --- a/metadata-jobs/mce-consumer-job/build.gradle +++ b/metadata-jobs/mce-consumer-job/build.gradle @@ -4,6 +4,7 @@ plugins { id 'com.palantir.docker' } +apply from: '../../gradle/coverage/java-coverage.gradle' apply from: "../../gradle/versioning/versioning.gradle" ext { diff --git a/metadata-jobs/mce-consumer/build.gradle b/metadata-jobs/mce-consumer/build.gradle index 5ea24059a3ee33..2da3957c4bb218 100644 --- a/metadata-jobs/mce-consumer/build.gradle +++ b/metadata-jobs/mce-consumer/build.gradle @@ -3,6 +3,7 @@ plugins { id 'pegasus' } +apply from: '../../gradle/coverage/java-coverage.gradle' configurations { avro diff --git a/metadata-jobs/pe-consumer/build.gradle b/metadata-jobs/pe-consumer/build.gradle index 35fdf0231c4064..ad17a443770857 100644 --- a/metadata-jobs/pe-consumer/build.gradle +++ b/metadata-jobs/pe-consumer/build.gradle @@ -3,6 +3,8 @@ plugins { id 'pegasus' } +apply from: '../../gradle/coverage/java-coverage.gradle' + configurations { avro } diff --git a/metadata-models-custom/build.gradle b/metadata-models-custom/build.gradle index 412c19194c7330..9babf9467e5d63 100644 --- a/metadata-models-custom/build.gradle +++ b/metadata-models-custom/build.gradle @@ -19,6 +19,8 @@ plugins { id 'pegasus' } +apply from: '../gradle/coverage/java-coverage.gradle' + if (project.hasProperty('projVersion')) { project.version = project.projVersion } else { diff --git a/metadata-models-validator/build.gradle b/metadata-models-validator/build.gradle index 1dae53e817ae14..c828ab041c27b3 100644 --- a/metadata-models-validator/build.gradle +++ b/metadata-models-validator/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(":entity-registry") implementation spec.product.pegasus.data diff --git a/metadata-models/build.gradle b/metadata-models/build.gradle index 179e1eac177ac8..e9379163ecaecc 100644 --- a/metadata-models/build.gradle +++ b/metadata-models/build.gradle @@ -6,6 +6,7 @@ plugins { id 'org.hidetake.swagger.generator' } +apply from: '../gradle/coverage/java-coverage.gradle' dependencies { api spec.product.pegasus.data diff --git a/metadata-operation-context/build.gradle b/metadata-operation-context/build.gradle index 650082ef0d25e6..71b61528d187bd 100644 --- a/metadata-operation-context/build.gradle +++ b/metadata-operation-context/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java-library' } +apply from: '../gradle/coverage/java-coverage.gradle' dependencies { api project(':metadata-utils') diff --git a/metadata-service/auth-config/build.gradle b/metadata-service/auth-config/build.gradle index 8302e3b0c2fe67..de787e9f350dce 100644 --- a/metadata-service/auth-config/build.gradle +++ b/metadata-service/auth-config/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(path: ':metadata-models') implementation project(path: ':metadata-auth:auth-api') diff --git a/metadata-service/auth-filter/build.gradle b/metadata-service/auth-filter/build.gradle index 9d763ca11421b5..5e73246317677a 100644 --- a/metadata-service/auth-filter/build.gradle +++ b/metadata-service/auth-filter/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-auth:auth-api') implementation project(':metadata-service:auth-impl') diff --git a/metadata-service/auth-impl/build.gradle b/metadata-service/auth-impl/build.gradle index 4f4b0658caf249..b5c20ccabe6d2d 100644 --- a/metadata-service/auth-impl/build.gradle +++ b/metadata-service/auth-impl/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' compileJava { options.debug = true diff --git a/metadata-service/auth-servlet-impl/build.gradle b/metadata-service/auth-servlet-impl/build.gradle index 29e452472358b8..21fe63778cbeb7 100644 --- a/metadata-service/auth-servlet-impl/build.gradle +++ b/metadata-service/auth-servlet-impl/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-auth:auth-api') implementation project(':metadata-service:auth-impl') diff --git a/metadata-service/configuration/build.gradle b/metadata-service/configuration/build.gradle index f912e2ac01f0b6..3c7e38b004fae7 100644 --- a/metadata-service/configuration/build.gradle +++ b/metadata-service/configuration/build.gradle @@ -1,6 +1,8 @@ plugins { id 'java-library' } + +apply from: '../../gradle/coverage/java-coverage.gradle' apply from: "../../gradle/versioning/versioning.gradle" dependencies { diff --git a/metadata-service/factories/build.gradle b/metadata-service/factories/build.gradle index 5e52efd245b7fa..501c46d64d6f9c 100644 --- a/metadata-service/factories/build.gradle +++ b/metadata-service/factories/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' dependencies { api project(':metadata-io') diff --git a/metadata-service/graphql-servlet-impl/build.gradle b/metadata-service/graphql-servlet-impl/build.gradle index 57676982421186..6848696db6788a 100644 --- a/metadata-service/graphql-servlet-impl/build.gradle +++ b/metadata-service/graphql-servlet-impl/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':datahub-graphql-core') implementation project(':metadata-auth:auth-api') diff --git a/metadata-service/openapi-analytics-servlet/build.gradle b/metadata-service/openapi-analytics-servlet/build.gradle index 5d1372a293775b..45e0ee1758ebc1 100644 --- a/metadata-service/openapi-analytics-servlet/build.gradle +++ b/metadata-service/openapi-analytics-servlet/build.gradle @@ -3,6 +3,8 @@ plugins { id 'org.hidetake.swagger.generator' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-auth:auth-api') diff --git a/metadata-service/openapi-entity-servlet/build.gradle b/metadata-service/openapi-entity-servlet/build.gradle index 4c2d587a81fd78..a47e487f871c6f 100644 --- a/metadata-service/openapi-entity-servlet/build.gradle +++ b/metadata-service/openapi-entity-servlet/build.gradle @@ -3,6 +3,8 @@ plugins { id 'org.hidetake.swagger.generator' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-auth:auth-api') diff --git a/metadata-service/openapi-servlet/build.gradle b/metadata-service/openapi-servlet/build.gradle index e26b1ceea1a3c6..77679790f25dea 100644 --- a/metadata-service/openapi-servlet/build.gradle +++ b/metadata-service/openapi-servlet/build.gradle @@ -3,6 +3,8 @@ plugins { id 'org.hidetake.swagger.generator' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-auth:auth-api') diff --git a/metadata-service/plugin/build.gradle b/metadata-service/plugin/build.gradle index 501589c24d60a2..526744ceb85c59 100644 --- a/metadata-service/plugin/build.gradle +++ b/metadata-service/plugin/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation 'org.apache.commons:commons-lang3:3.12.0' diff --git a/metadata-service/restli-api/build.gradle b/metadata-service/restli-api/build.gradle index 505320e8267eed..38a3e9298ff963 100644 --- a/metadata-service/restli-api/build.gradle +++ b/metadata-service/restli-api/build.gradle @@ -2,6 +2,8 @@ plugins { id 'pegasus' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { dataModel project(':metadata-models') dataModel spec.product.pegasus.restliCommon diff --git a/metadata-service/restli-client-api/build.gradle b/metadata-service/restli-client-api/build.gradle index c2dfd4d2a1344c..4e488a98023cb4 100644 --- a/metadata-service/restli-client-api/build.gradle +++ b/metadata-service/restli-client-api/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { api project(path: ':metadata-service:restli-api', configuration: 'restClient') api project(':metadata-operation-context') diff --git a/metadata-service/restli-client/build.gradle b/metadata-service/restli-client/build.gradle index 587ff5b2ef0531..92b34330166335 100644 --- a/metadata-service/restli-client/build.gradle +++ b/metadata-service/restli-client/build.gradle @@ -3,6 +3,8 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { api project(':metadata-service:restli-api') api project(':metadata-auth:auth-api') diff --git a/metadata-service/restli-servlet-impl/build.gradle b/metadata-service/restli-servlet-impl/build.gradle index 6b68abfe7fb15c..dc426bf5639b17 100644 --- a/metadata-service/restli-servlet-impl/build.gradle +++ b/metadata-service/restli-servlet-impl/build.gradle @@ -3,6 +3,8 @@ plugins { id 'pegasus' } +apply from: '../../gradle/coverage/java-coverage.gradle' + sourceSets { integTest { compileClasspath += sourceSets.main.output diff --git a/metadata-service/schema-registry-api/build.gradle b/metadata-service/schema-registry-api/build.gradle index 201e98beb490e0..525eceda685be6 100644 --- a/metadata-service/schema-registry-api/build.gradle +++ b/metadata-service/schema-registry-api/build.gradle @@ -3,6 +3,7 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' dependencies { // Dependencies for open api diff --git a/metadata-service/schema-registry-servlet/build.gradle b/metadata-service/schema-registry-servlet/build.gradle index f19237c32cee78..94ca8fe03822e3 100644 --- a/metadata-service/schema-registry-servlet/build.gradle +++ b/metadata-service/schema-registry-servlet/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-service:factories') implementation project(':metadata-service:schema-registry-api') diff --git a/metadata-service/services/build.gradle b/metadata-service/services/build.gradle index ea1ff32cb3838b..0e84580cc04da5 100644 --- a/metadata-service/services/build.gradle +++ b/metadata-service/services/build.gradle @@ -3,6 +3,8 @@ plugins { id 'java-library' } +apply from: '../../gradle/coverage/java-coverage.gradle' + configurations { enhance } diff --git a/metadata-service/servlet/build.gradle b/metadata-service/servlet/build.gradle index f961bf6a9de7eb..725352e69d52b2 100644 --- a/metadata-service/servlet/build.gradle +++ b/metadata-service/servlet/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':metadata-io') implementation project(':datahub-graphql-core') diff --git a/metadata-service/war/build.gradle b/metadata-service/war/build.gradle index ab9019e470dbca..5e00207c1726ee 100644 --- a/metadata-service/war/build.gradle +++ b/metadata-service/war/build.gradle @@ -3,6 +3,7 @@ plugins { id 'com.palantir.docker' } +apply from: '../../gradle/coverage/java-coverage.gradle' apply from: "../../gradle/versioning/versioning.gradle" ext { diff --git a/metadata-utils/build.gradle b/metadata-utils/build.gradle index 919d93c5f9fe19..07ce50993655d2 100644 --- a/metadata-utils/build.gradle +++ b/metadata-utils/build.gradle @@ -3,6 +3,8 @@ plugins { id 'pegasus' } +apply from: '../gradle/coverage/java-coverage.gradle' + dependencies { api externalDependency.avro implementation externalDependency.commonsLang diff --git a/mock-entity-registry/build.gradle b/mock-entity-registry/build.gradle index 8242d6451dd606..3a6ce0eedcba6e 100644 --- a/mock-entity-registry/build.gradle +++ b/mock-entity-registry/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' } +apply from: '../gradle/coverage/java-coverage.gradle' + dependencies { implementation project(':entity-registry') } \ No newline at end of file