Skip to content

Commit

Permalink
migrate junit-jupiter* subproject configuration to Kotlin DSL (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaschmid committed Dec 24, 2019
1 parent b699055 commit 995a467
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 51 deletions.
60 changes: 60 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,66 @@ project(":junit4") {
}
}

configure(subprojects.filter { p -> p.name.startsWith("junit-jupiter") }) {
apply<GroovyPlugin>()

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

configure<SourceSetContainer> {
create("integTest") {
compileClasspath += named("main").get().output + named("test").get().output
runtimeClasspath += named("main").get().output + named("test").get().output
}
}

configurations {
"integTestImplementation" {
extendsFrom(configurations["testImplementation"])
}
}

dependencies {
"api"(project(":core"))
"api"("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

"testImplementation"("org.assertj:assertj-core:3.8.0")
"testImplementation"("org.mockito:mockito-core:2.18.3")

"integTestImplementation"("org.codehaus.groovy:groovy:2.4.12")
}

tasks {
withType<JavaCompile> {
options.compilerArgs.addAll(listOf("-parameters"))
}

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

val integTest = register<Test>("integTest") {
group = "verification"
description = "Runs all integration tests."

ignoreFailures = isBuildOnJenkins

classpath = project.the<SourceSetContainer>()["integTest"].runtimeClasspath
testClassesDirs = project.the<SourceSetContainer>()["integTest"].output.classesDirs

useJUnitPlatform()
dependsOn(named("integTestClasses"))
}
val touchIntegTestResultsForJenkins = register<TouchTestResults>("touchIntegTestResultsForJenkins") {
tasks(integTest)
enabled = isBuildOnJenkins
}
getByName("build").dependsOn(touchIntegTestResultsForJenkins)
}
}

// -- Custom tasks ------------------------------------------------------------
/**
* Task to touch all junit xml report files for all given {@link Test} {@code tasks}.
Expand Down
51 changes: 0 additions & 51 deletions legacy.build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,3 @@
configure(subprojects.findAll{ p -> p.name.startsWith("junit-jupiter") }) {
apply(plugin: "groovy")

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8

sourceSets {
integTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}

configurations {
integTestImplementation {
extendsFrom(testImplementation)
}
}

dependencies {
api(project(":core"))
api("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

testImplementation("org.assertj:assertj-core:3.8.0")
testImplementation("org.mockito:mockito-core:2.18.3")

integTestImplementation("org.codehaus.groovy:groovy:2.4.12")
}

tasks.withType(JavaCompile) {
options.compilerArgs += [ "-parameters" ]
}

test {
useJUnitPlatform()
}

task integTest(dependsOn: integTestClasses, type: Test, group: "verification", description: "Runs all integration tests.") {
ignoreFailures = isBuildOnJenkins

classpath = sourceSets.integTest.runtimeClasspath
testClassesDirs = sourceSets.integTest.output.classesDirs

useJUnitPlatform()
}
task touchIntegTestResultsForJenkins(type: TouchTestResults) {
tasks(integTest)
enabled = isBuildOnJenkins
}
build.dependsOn(touchIntegTestResultsForJenkins)
}

project(":junit-jupiter") {
archivesBaseName = "junit-jupiter-dataprovider"
description = "A TestNG like dataprovider runner for JUnit Jupiter which is feature comparable to JUnit4 dataprovider."
Expand Down

0 comments on commit 995a467

Please sign in to comment.