Skip to content

Commit

Permalink
Migrate junitJupiterExtensionTest subproject to kotlin dsl (mockito#1704
Browse files Browse the repository at this point in the history
)
  • Loading branch information
epeee authored and TimvdLippe committed May 6, 2019
1 parent 53e8a93 commit ac01235
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
10 changes: 9 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ include("deprecatedPluginsTest",

rootProject.name = "mockito"

val koltinBuildScriptProject = hashSetOf("junitJupiterExtensionTest")

fun buildFileExtensionFor(projectName: String) =
if (projectName in koltinBuildScriptProject) ".gradle.kts" else ".gradle"

fun buildFileFor(projectName: String) =
"$projectName${buildFileExtensionFor(projectName)}"

rootProject.children.forEach { project ->
val projectDirName = "subprojects/${project.name}"
project.projectDir = File(settingsDir, projectDirName)
project.buildFileName = "${project.name}.gradle"
project.buildFileName = buildFileFor(project.name)
require(project.projectDir.isDirectory) {
"Project directory ${project.projectDir} for project ${project.name} does not exist."
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply(from = "$rootDir/gradle/dependencies.gradle")

plugins {
java
}

description = "End-to-end tests for automatic registration of MockitoExtension."

java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
testCompile(project(":junit-jupiter"))
testCompile(library("assertj"))
testCompile(library("junitPlatformLauncher"))
testCompile(library("junitJupiterApi"))
testRuntime(library("junitJupiterEngine"))
}

tasks.named<Test>("test") {
useJUnitPlatform()
}

val Project.libraries
get() = rootProject.extra["libraries"] as Map<String, Any>

fun Project.library(name: String) =
libraries[name]!!

0 comments on commit ac01235

Please sign in to comment.