Skip to content

Commit

Permalink
Move tests to included build to separate classpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed Dec 2, 2023
1 parent 0686ff3 commit 5105711
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 26 deletions.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ 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.0.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"
Expand All @@ -19,6 +22,13 @@ allprojects {
group = 'org.mockito.kotlin'
}

def test = tasks.register("test") {
dependsOn gradle.includedBuild("tests").task(":test")
}
tasks.named("check") {
dependsOn test
}

tasks.named("generateChangelog") {
previousRevision = project.ext.'shipkit-auto-version.previous-version'
githubToken = System.getenv("GITHUB_TOKEN")
Expand Down
19 changes: 3 additions & 16 deletions mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,21 @@ 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"
}
}

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'

implementation "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'
13 changes: 4 additions & 9 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,14 +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.jetbrains.kotlin:kotlin-stdlib"
implementation "org.mockito:mockito-core:5.7.0"

testImplementation 'junit:junit:4.13.2'
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 5105711

Please sign in to comment.