-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
69 lines (59 loc) · 2.5 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
group "com.github.denisverkhoturov"
version "1.0-SNAPSHOT"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: "$kotlinVersion"
classpath group: "org.junit.platform", name: "junit-platform-gradle-plugin", version: "$junitPlatformVersion"
}
}
apply plugin: "idea"
apply plugin: "java"
apply plugin: "kotlin"
apply plugin: "org.junit.platform.gradle.plugin"
compileKotlin {
kotlinOptions.jvmTarget = "$targetCompatibility"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "$targetCompatibility"
}
junitPlatform {
platformVersion junitPlatformVersion
filters {
engines {
include "spek"
}
}
selectors {
classes submittedTasks()
}
}
repositories {
jcenter()
}
dependencies {
compile group:"org.jetbrains.kotlin", name: "kotlin-stdlib-jre8", version:"$kotlinVersion"
testCompile group: "org.junit.platform", name: "junit-platform-runner", version: "$junitPlatformVersion"
testCompile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: "$kotlinVersion"
testCompile group: "org.jetbrains.kotlin", name: "kotlin-test", version: "$kotlinVersion"
testCompile group: "org.jetbrains.spek", name: "spek-api", version: "$spekVersion"
testCompile group: "org.jetbrains.spek", name: "spek-junit-platform-engine", version: "$spekVersion"
}
def submittedTasks() {
def tasks = project.sourceSets.main.java.collect { it.getName() }
.collect { it.substring(0, it.indexOf(".java")) }
def command = 'git diff --name-only master'.execute()
command.waitFor()
def submitted = command.text.split(System.lineSeparator())
.findAll { it.endsWith(".java")}
.collect { it.substring(it.lastIndexOf(File.separator) + 1, it.lastIndexOf(".java")) }
.findAll { tasks.contains(it) }
def specs = project.sourceSets.test.kotlin.collect { it.getName().substring(0, it.getName().indexOf("Spec.kt")) }
.findAll { submitted.contains(it) }
.collect { it + "Spec" }
.collect { [group, rootProject.name, it].join(".") }
.toArray(new String[0])
return specs
}