Skip to content

Commit

Permalink
Move tests to included build to separate classpaths (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob authored Dec 3, 2023
1 parent db5b119 commit 4f09043
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 28 deletions.
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ buildscript {
classpath "org.shipkit:shipkit-changelog:1.2.0"
classpath "org.shipkit:shipkit-auto-version:1.2.2"
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
}
}

apply plugin: 'org.gradle.base'
apply plugin: "io.github.gradle-nexus.publish-plugin"
apply plugin: 'org.shipkit.shipkit-auto-version'
apply plugin: "org.shipkit.shipkit-changelog"
apply plugin: "org.shipkit.shipkit-github-release"

allprojects {
group = 'org.mockito.kotlin'
def test = tasks.register("test") {
dependsOn gradle.includedBuild("tests").task(":test")
}
tasks.named("check") {
dependsOn test
}

tasks.named("generateChangelog") {
Expand Down
19 changes: 4 additions & 15 deletions mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,23 @@ apply plugin: 'kotlin'
apply from: '../gradle/publishing.gradle'
apply plugin: 'org.jetbrains.dokka'

buildscript {
ext.kotlin_version = "1.9.20"

repositories {
mavenCentral()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
}
}
group = 'org.mockito.kotlin'

repositories {
mavenCentral()
}

dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly "org.jetbrains.kotlin:kotlin-stdlib"
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'

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

testImplementation 'junit:junit:4.13.2'
testImplementation 'com.nhaarman:expect.kt:1.0.1'

testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib"
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'

testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include 'mockito-kotlin'
include 'tests'
includeBuild 'tests'
14 changes: 4 additions & 10 deletions tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
ext.kotlin_version = System.getenv("KOTLIN_VERSION") ?: '1.9.20'
println "$project uses Kotlin $kotlin_version"

repositories {
mavenCentral()
}
dependencies {
def kotlin_version = System.getenv("KOTLIN_VERSION") ?: '1.9.20'
println "$project uses Kotlin $kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -20,15 +19,10 @@ repositories {
mavenCentral()
}

tasks.named('compileTestKotlin') {
dependsOn ':mockito-kotlin:jar'
}

dependencies {
implementation files("${rootProject.projectDir}/mockito-kotlin/build/libs/mockito-kotlin-${version}.jar")
implementation "org.mockito.kotlin:mockito-kotlin"

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.mockito:mockito-core:5.7.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib"

testImplementation 'junit:junit:4.13.2'
testImplementation "com.nhaarman:expect.kt:1.0.1"
Expand Down
1 change: 1 addition & 0 deletions tests/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
includeBuild '..'

0 comments on commit 4f09043

Please sign in to comment.