|
| 1 | +/* |
| 2 | + * Copyright OpenSearch Contributors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +plugins { |
| 7 | + id 'java-library' |
| 8 | + id "io.freefair.lombok" |
| 9 | + id 'jacoco' |
| 10 | +} |
| 11 | + |
| 12 | +repositories { |
| 13 | + mavenCentral() |
| 14 | +} |
| 15 | + |
| 16 | +dependencies { |
| 17 | + implementation project(':core') |
| 18 | + implementation project(':protocol') |
| 19 | + implementation group: 'org.opensearch', name: 'opensearch', version: "${opensearch_version}" |
| 20 | + implementation group: 'org.opensearch', name: 'opensearch-x-content', version: "${opensearch_version}" |
| 21 | + implementation group: 'org.opensearch', name: 'common-utils', version: "${opensearch_build}" |
| 22 | + implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' |
| 23 | + implementation 'com.amazonaws:aws-encryption-sdk-java:2.4.0' |
| 24 | + |
| 25 | + testImplementation group: 'junit', name: 'junit', version: '4.13.2' |
| 26 | + testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') |
| 27 | + testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.12.13' |
| 28 | + testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' |
| 29 | + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.2.0' |
| 30 | + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.2.0' |
| 31 | + testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2' |
| 32 | +} |
| 33 | + |
| 34 | +test { |
| 35 | + useJUnitPlatform() |
| 36 | + testLogging { |
| 37 | + events "passed", "skipped", "failed" |
| 38 | + exceptionFormat "full" |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +jacocoTestReport { |
| 43 | + reports { |
| 44 | + html.enabled true |
| 45 | + xml.enabled true |
| 46 | + } |
| 47 | + afterEvaluate { |
| 48 | + classDirectories.setFrom(files(classDirectories.files.collect { |
| 49 | + fileTree(dir: it) |
| 50 | + })) |
| 51 | + } |
| 52 | +} |
| 53 | +test.finalizedBy(project.tasks.jacocoTestReport) |
| 54 | + |
| 55 | +jacocoTestCoverageVerification { |
| 56 | + violationRules { |
| 57 | + rule { |
| 58 | + element = 'CLASS' |
| 59 | + excludes = [ |
| 60 | + 'org.opensearch.sql.datasources.settings.DataSourceSettings', |
| 61 | + 'org.opensearch.sql.datasources.exceptions.*', |
| 62 | + 'org.opensearch.sql.datasources.model.*', |
| 63 | + 'org.opensearch.sql.datasources.rest.*' |
| 64 | + ] |
| 65 | + limit { |
| 66 | + counter = 'LINE' |
| 67 | + minimum = 1.0 |
| 68 | + } |
| 69 | + limit { |
| 70 | + counter = 'BRANCH' |
| 71 | + minimum = 0.9 |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + afterEvaluate { |
| 76 | + classDirectories.setFrom(files(classDirectories.files.collect { |
| 77 | + fileTree(dir: it) |
| 78 | + })) |
| 79 | + } |
| 80 | +} |
| 81 | +check.dependsOn jacocoTestCoverageVerification |
| 82 | +jacocoTestCoverageVerification.dependsOn jacocoTestReport |
0 commit comments