Gradle with the Kotlin script

With the Kotlin script, we should add the same dependencies. Your build.gradle.kts file will look as follows:

import org.gradle.api.plugins.ExtensionAware

import org.junit.platform.gradle.plugin.FiltersExtension
import org.junit.platform.gradle.plugin.EnginesExtension
import org.junit.platform.gradle.plugin.JUnitPlatformExtension

buildscript {
dependencies {
classpath("org.junit.platform:junit-platform-gradle-plugin:1.0.0")
}
}

apply {
plugin("org.junit.platform.gradle.plugin")
}

configure {
filters {
engines {
include("spek")
}
}
}

dependencies {
testCompile("org.jetbrains.spek:spek-api:1.1.5")
testRuntime("org.jetbrains.spek:spek-junit-platform-engine:1.1.5")
}

fun JUnitPlatformExtension.filters(setup: FiltersExtension.() -> Unit) {
when (this) {
is ExtensionAware -> extensions.getByType(FiltersExtension::class.java).setup()
else -> throw Exception("${this::class} must be an instance of ExtensionAware")
}
}
fun FiltersExtension.engines(setup: EnginesExtension.() -> Unit) {
when (this) {
is ExtensionAware -> extensions.getByType(EnginesExtension::class.java).setup()
else -> throw Exception("${this::class} must be an instance of ExtensionAware")
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.223