11plugins {
22 id ' org.jetbrains.kotlin.jvm' version ' 1.3.10'
33 id ' jacoco'
4+ id ' com.gradle.build-scan' version ' 1.16'
5+ id ' maven-publish'
6+ id ' signing'
7+ }
8+
9+ ext {
10+ publishBuildScan = false
11+ snapshotVersion = true
412}
513
614group ' com.nfeld.jsonpathlite'
7- version ' 1.0.0-alpha01 '
15+ version = ' 1.0.0' + (snapshotVersion ? " -SNAPSHOT " : " " )
816
917repositories {
10- mavenCentral ()
18+ jcenter ()
1119}
1220
1321dependencies {
1422 implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk8"
1523 implementation " org.json:json:20180813"
16-
17- testImplementation ' org.junit.jupiter:junit-jupiter:5.4.0'
18- testImplementation ' com.jayway.jsonpath:json-path:2.4.0'
1924}
2025
2126compileKotlin {
2227 kotlinOptions. jvmTarget = " 1.8"
2328}
24- compileTestKotlin {
25- kotlinOptions. jvmTarget = " 1.8"
26- }
27-
28- test {
29- // Make this task never up to date, thus forcing rerun of all tests whenever task is run
30- outputs. upToDateWhen { false }
31-
32- // enable junit 5
33- useJUnitPlatform()
34-
35- testLogging {
36- // show test results for following events
37- events ' PASSED' , ' FAILED' , ' SKIPPED'
38-
39- // show printlines
40- showStandardStreams = true
41- }
4229
43- // show test summary at end
44- afterSuite { desc , result ->
45- if (! desc. parent) {
46- println " \n Test result: ${ result.resultType} "
47- println " Test summary: ${ result.testCount} tests, " +
48- " ${ result.successfulTestCount} succeeded, " +
49- " ${ result.failedTestCount} failed, " +
50- " ${ result.skippedTestCount} skipped"
51- }
52- }
53-
54- // code coverage
55- jacoco {
56- append = false
57- destinationFile = file(" $buildDir /jacoco/junitPlatformTest.exec" )
58- includeNoLocationClasses = true
59- }
60-
61- finalizedBy jacocoTestReport
62- }
63-
64- jacoco {
65- toolVersion = " 0.8.3"
66- reportsDir = file(" $buildDir /reports" )
67- }
68- jacocoTestReport {
69- group = " Reporting"
70- description = " Generate Jacoco coverage report."
71- classDirectories = fileTree(
72- dir : " $buildDir /classes/kotlin/main"
73- )
74- def coverageSourceDirs = [
75- " src/main/kotlin"
76- ]
77- additionalSourceDirs = files(coverageSourceDirs)
78- sourceDirectories = files(coverageSourceDirs)
79- executionData = files(" $buildDir /jacoco/junitPlatformTest.exec" )
80- reports {
81- xml. enabled = true
82- html. enabled = true
83- csv. enabled = false
84- }
85- }
30+ apply from : " tests_codecov.gradle"
31+ apply from : " publish.gradle"
8632
87- check. dependsOn jacocoTestCoverageVerification
33+ buildScan {
34+ termsOfServiceUrl = " https://gradle.com/terms-of-service"
35+ termsOfServiceAgree = " yes"
8836
89- jacocoTestCoverageVerification {
90- violationRules {
91- rule {
92- // element = 'CLASS'
93- limit {
94- counter = ' LINE'
95- value = ' COVEREDRATIO'
96- minimum = 0.95
97- }
98- }
37+ if (publishBuildScan) {
38+ publishAlways()
9939 }
10040}
0 commit comments