Skip to content

Instantly share code, notes, and snippets.

@tomekw
Created August 29, 2018 12:43
Show Gist options
  • Save tomekw/6fdfcf7216d191556774a2cab4dcc00f to your computer and use it in GitHub Desktop.
Save tomekw/6fdfcf7216d191556774a2cab4dcc00f to your computer and use it in GitHub Desktop.
// build.gradle
buildscript {
// use specific Kotlin version
ext.kotlin_version = '1.2.61'
}
plugins {
// install Kotlin JVM gradle plugin
id 'org.jetbrains.kotlin.jvm' version '1.2.61'
}
repositories {
mavenCentral()
// add Spek 2 development repository
maven { url "https://dl.bintray.com/spekframework/spek-dev" }
}
dependencies {
// include Kotlin standard library
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// include JUnit 5 assertions
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
// include Spek 2 library
testImplementation 'org.spekframework.spek2:spek-dsl-jvm:2.0.0-alpha.1'
// include JUnit 5 test engine
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
// include Spek 2 JUnit test engine
testRuntimeOnly 'org.spekframework.spek2:spek-runner-junit5:2.0.0-alpha.1'
}
// configure test task to use Spek 2 test engine with JUnit
test {
useJUnitPlatform {
includeEngines 'spek2'
}
}
// set JVM target to 1.8 for all compilation tasks
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment