-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
280 additions
and
401 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") version "1.7.10" | ||
jacoco | ||
id("com.vanniktech.maven.publish") version "0.22.0" | ||
} | ||
|
||
val jacksonVersion = "2.13.1" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | ||
api("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") | ||
api("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
|
||
// pass -DreadmeFormat to format benchmark results to update readme | ||
val readmeFormat = findProperty("readmeFormat") == "true" | ||
|
||
val kotestVersion = "4.6.4" | ||
|
||
dependencies { | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2") | ||
testApi("com.jayway.jsonpath:json-path:2.4.0") | ||
testImplementation("org.json:json:20180813") | ||
testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion") // for kotest framework | ||
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") // for kotest core jvm assertions | ||
} | ||
|
||
tasks.register<Test>("benchmark") { | ||
useJUnitPlatform() | ||
|
||
if(readmeFormat) { | ||
jvmArgs("-DreadmeFormat=true") | ||
} | ||
|
||
filter { | ||
include("com/nfeld/jsonpathkt/BenchmarkTest.class") | ||
} | ||
|
||
testLogging { | ||
showStandardStreams = true | ||
} | ||
|
||
// Make this task never up to date, thus forcing rerun of all tests whenever task is run | ||
outputs.upToDateWhen { false } | ||
} | ||
|
||
tasks.register<Test>("perfTest") { | ||
useJUnitPlatform() | ||
|
||
filter { | ||
include("com/nfeld/jsonpathkt/PerfTest.class") | ||
} | ||
|
||
testLogging { | ||
// show test results for following events | ||
events("PASSED", "FAILED", "SKIPPED") | ||
|
||
// show printlines | ||
showStandardStreams = true | ||
} | ||
|
||
// Make this task never up to date, thus forcing rerun of all tests whenever task is run | ||
outputs.upToDateWhen { false } | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
|
||
filter { | ||
exclude( | ||
"com/nfeld/jsonpathkt/BenchmarkTest.class", | ||
"com/nfeld/jsonpathkt/PerfTest.class" | ||
) | ||
} | ||
|
||
testLogging { | ||
// show test results for following events | ||
events("PASSED", "FAILED", "SKIPPED") | ||
|
||
// show printlines | ||
showStandardStreams = true | ||
} | ||
|
||
addTestListener(object : TestListener { | ||
override fun beforeSuite(suite: TestDescriptor?) {} | ||
override fun afterTest(testDescriptor: TestDescriptor?, result: TestResult?) {} | ||
override fun beforeTest(testDescriptor: TestDescriptor?) {} | ||
|
||
override fun afterSuite(suite: TestDescriptor?, result: TestResult?) { | ||
val parent = suite?.parent | ||
if(parent != null && result != null) { | ||
println("\nTest result: ${result.resultType}") | ||
println( | ||
""" | ||
|Test summary: ${result.testCount} tests, | ||
| ${result.successfulTestCount} succeeded, | ||
| ${result.failedTestCount} failed, | ||
| ${result.skippedTestCount} skipped | ||
""".trimMargin().replace("\n", "") | ||
) | ||
} | ||
} | ||
|
||
}) | ||
|
||
configure<JacocoTaskExtension> { | ||
setDestinationFile(layout.buildDirectory.file("jacoco/junitPlatformTest.exec").map { it.asFile }) | ||
isIncludeNoLocationClasses = true | ||
excludes = listOf( | ||
"*/LRUCache\$LRUMap*", | ||
"*/JsonNodeKt*", | ||
"jdk.internal.*" | ||
) | ||
} | ||
|
||
// Make this task never up to date, thus forcing rerun of all tests whenever task is run | ||
outputs.upToDateWhen { false } | ||
} | ||
|
||
jacoco { | ||
toolVersion = "0.8.8" | ||
reportsDirectory.set(layout.buildDirectory.dir("reports")) | ||
} | ||
|
||
tasks.jacocoTestReport.configure { | ||
reports { | ||
xml.required.set(true) | ||
html.required.set(true) | ||
csv.required.set(false) | ||
} | ||
} | ||
|
||
tasks.jacocoTestCoverageVerification { | ||
violationRules { | ||
rule { | ||
limit { | ||
counter = "LINE" | ||
value = "COVEREDRATIO" | ||
minimum = BigDecimal(0.90) | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.check.configure { | ||
dependsOn(tasks.jacocoTestCoverageVerification) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
kotlin.code.style=official | ||
kotlin.code.style=official | ||
|
||
SONATYPE_HOST=DEFAULT | ||
RELEASE_SIGNING_ENABLED=true | ||
|
||
GROUP=com.nfeld.jsonpathkt | ||
POM_ARTIFACT_ID=jsonpathkt | ||
VERSION_NAME=2.0.1-SNAPSHOT | ||
|
||
POM_NAME=JsonPathKt | ||
POM_DESCRIPTION=A lighter and more efficient implementation of JsonPath in Kotlin | ||
POM_URL=https://github.com/codeniko/JsonPathKt | ||
|
||
POM_LICENSE_NAME=BSD-3-Clause | ||
POM_LICENSE_URL=https://github.com/codeniko/JsonPathKt/blob/master/LICENSE | ||
POM_LICENSE_DIST=repo | ||
|
||
POM_SCM_URL=https://github.com/codeniko/JsonPathKt | ||
POM_SCM_CONNECTION=scm:git:git://github.com/codeniko/JsonPathKt.git | ||
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]:codeniko/JsonPathKt.git | ||
|
||
POM_DEVELOPER_ID=codeniko | ||
POM_DEVELOPER_NAME=Nikolay Feldman | ||
POM_DEVELOPER_URL=https://www.nfeld.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## This file must *NOT* be checked into Version Control Systems, | ||
# as it contains information specific to your local configuration. | ||
# | ||
# Location of the SDK. This is only used by Gradle. | ||
# For customization when using a Version Control System, please read the | ||
# header note. | ||
#Thu Sep 22 11:57:03 EDT 2022 | ||
sdk.dir=/home/eli/Android/Sdk |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
id("com.gradle.enterprise") version "3.10.3" | ||
} | ||
|
||
rootProject.name = "jsonpathkt" | ||
|
||
val publishBuildScan = providers.gradleProperty("publishBuildScan") | ||
|
||
gradleEnterprise { | ||
buildScan { | ||
termsOfServiceUrl = "https://gradle.com/terms-of-service" | ||
termsOfServiceAgree = "yes" | ||
|
||
if (publishBuildScan.getOrElse("false") == "true") { | ||
publishAlways() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.