Skip to content

Commit 4f09043

Browse files
authored
Move tests to included build to separate classpaths (#502)
1 parent db5b119 commit 4f09043

File tree

5 files changed

+18
-28
lines changed

5 files changed

+18
-28
lines changed

build.gradle

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ buildscript {
77
classpath "org.shipkit:shipkit-changelog:1.2.0"
88
classpath "org.shipkit:shipkit-auto-version:1.2.2"
99
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
11+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
1012
}
1113
}
1214

15+
apply plugin: 'org.gradle.base'
1316
apply plugin: "io.github.gradle-nexus.publish-plugin"
1417
apply plugin: 'org.shipkit.shipkit-auto-version'
1518
apply plugin: "org.shipkit.shipkit-changelog"
1619
apply plugin: "org.shipkit.shipkit-github-release"
1720

18-
allprojects {
19-
group = 'org.mockito.kotlin'
21+
def test = tasks.register("test") {
22+
dependsOn gradle.includedBuild("tests").task(":test")
23+
}
24+
tasks.named("check") {
25+
dependsOn test
2026
}
2127

2228
tasks.named("generateChangelog") {

mockito-kotlin/build.gradle

+4-15
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,23 @@ apply plugin: 'kotlin'
55
apply from: '../gradle/publishing.gradle'
66
apply plugin: 'org.jetbrains.dokka'
77

8-
buildscript {
9-
ext.kotlin_version = "1.9.20"
10-
11-
repositories {
12-
mavenCentral()
13-
}
14-
15-
dependencies {
16-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
18-
}
19-
}
8+
group = 'org.mockito.kotlin'
209

2110
repositories {
2211
mavenCentral()
2312
}
2413

2514
dependencies {
26-
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
15+
compileOnly "org.jetbrains.kotlin:kotlin-stdlib"
2716
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
2817

2918
api "org.mockito:mockito-core:5.7.0"
3019

3120
testImplementation 'junit:junit:4.13.2'
3221
testImplementation 'com.nhaarman:expect.kt:1.0.1'
3322

34-
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
35-
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
23+
testImplementation "org.jetbrains.kotlin:kotlin-stdlib"
24+
testImplementation "org.jetbrains.kotlin:kotlin-test"
3625
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
3726

3827
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0"

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include 'mockito-kotlin'
2-
include 'tests'
2+
includeBuild 'tests'

tests/build.gradle

+4-10
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33

44
buildscript {
5-
ext.kotlin_version = System.getenv("KOTLIN_VERSION") ?: '1.9.20'
6-
println "$project uses Kotlin $kotlin_version"
7-
85
repositories {
96
mavenCentral()
107
}
118
dependencies {
9+
def kotlin_version = System.getenv("KOTLIN_VERSION") ?: '1.9.20'
10+
println "$project uses Kotlin $kotlin_version"
1211
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1312
}
1413
}
@@ -20,15 +19,10 @@ repositories {
2019
mavenCentral()
2120
}
2221

23-
tasks.named('compileTestKotlin') {
24-
dependsOn ':mockito-kotlin:jar'
25-
}
26-
2722
dependencies {
28-
implementation files("${rootProject.projectDir}/mockito-kotlin/build/libs/mockito-kotlin-${version}.jar")
23+
implementation "org.mockito.kotlin:mockito-kotlin"
2924

30-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
31-
implementation "org.mockito:mockito-core:5.7.0"
25+
implementation "org.jetbrains.kotlin:kotlin-stdlib"
3226

3327
testImplementation 'junit:junit:4.13.2'
3428
testImplementation "com.nhaarman:expect.kt:1.0.1"

tests/settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
includeBuild '..'

0 commit comments

Comments
 (0)