Skip to content

Commit

Permalink
Changed launcher to be a mpp module
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Aug 20, 2020
1 parent b7c067a commit 9a75eb9
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 23 deletions.
67 changes: 46 additions & 21 deletions kotest-framework/kotest-framework-launcher/build.gradle.kts
Expand Up @@ -3,42 +3,68 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
id("java")
kotlin("jvm")
id("kotlin-multiplatform")
id("java-library")
}

repositories {
mavenCentral()
}

dependencies {
kotlin {

// needed to compile against the engine launcher and discovery
// but runtime classes will be provided by the dependencies in the users own build
compileOnly(project(Projects.Api))
compileOnly(project(Projects.Engine))
targets {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
}

targets.all {
compilations.all {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
}
}

// needed to scan for spec classes
implementation(project(Projects.Discovery))
sourceSets {

// needed to check for opentest4j.AssertionFailedError so we can add a better error to team city
implementation(Libs.OpenTest4j.core)
val jvmMain by getting {
dependencies {

// needed to parse the command line args
implementation(Libs.Ajalt.clikt)
// needed to compile against the engine launcher and discovery
// but runtime classes will be provided by the dependencies in the users own build
compileOnly(project(Projects.Api))
compileOnly(project(Projects.Engine))

// used to write to the console with fancy colours!
implementation(Libs.Ajalt.mordant)
// needed to scan for spec classes
implementation(project(Projects.Discovery))

testImplementation(project(Projects.AssertionsCore))
testImplementation(project(Projects.JunitRunner))
}
// needed to check for opentest4j.AssertionFailedError so we can add a better error to team city
implementation(Libs.OpenTest4j.core)

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
// needed to parse the command line args
implementation(Libs.Ajalt.clikt)

// used to write to the console with fancy colours!
implementation(Libs.Ajalt.mordant)
}
}

val jvmTest by getting {
dependencies {
implementation(project(Projects.AssertionsCore))
implementation(project(Projects.JunitRunner))
}
}
}
}

tasks.named<Test>("test") {
tasks.named<Test>("jvmTest") {
useJUnitPlatform()
filter {
isFailOnNoMatchingTests = false
Expand All @@ -51,5 +77,4 @@ tasks.named<Test>("test") {
}
}


apply(from = "../../publish-mpp.gradle.kts")
Expand Up @@ -41,8 +41,6 @@ class BasicConsoleWriterTest : FunSpec() {
writer.engineFinished(emptyList())
}

println(out)

out.shouldContain("com.sksamuel.kotest.framework.console.BasicConsoleWriterTest")
out.shouldContain("\ta test")
out.shouldContain("\tcause: wibble boom (BasicConsoleWriterTest.kt:21)")
Expand Down

0 comments on commit 9a75eb9

Please sign in to comment.