plugins { id 'java-gradle-plugin' id 'maven-publish' } repositories { mavenCentral() } dependencies { def junit5Group = 'org.junit.jupiter' def junit5Version = '5.8.2' testImplementation group: junit5Group, name: 'junit-jupiter-api', version: junit5Version testImplementation group: 'net.jqwik', name: 'jqwik', version: '1.6.3' testRuntimeOnly group: junit5Group, name: 'junit-jupiter-engine', version: junit5Version testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-console', version: junit5Version testImplementation(enforcedPlatform("org.junit:junit-bom:${junit5Version}")) } java { toolchain { languageVersion = JavaLanguageVersion.of(11) } } sourceSets { functionalTest { compileClasspath += sourceSets.main.output + sourceSets.test.output runtimeClasspath += sourceSets.test.runtimeClasspath } } gradlePlugin { testSourceSets project.sourceSets.functionalTest plugins { fregePlugin { id = 'ch.fhnw.thga.frege' implementationClass = 'ch.fhnw.thga.gradleplugins.FregePlugin' } } } configurations { functionalTestImplementation.extendsFrom testImplementation functionalRuntimeOnly.extendsFrom runtimeOnly } tasks.register('consoleLauncher', JavaExec) { dependsOn testClasses def reportsDir = layout.buildDirectory.dir('test-results') mainClass = 'org.junit.platform.console.ConsoleLauncher' outputs.dir reportsDir classpath sourceSets.test.runtimeClasspath + sourceSets.functionalTest.runtimeClasspath args '--scan-classpath', '--details', 'summary', '--reports-dir', reportsDir.get() } tasks.register('functionalTest', Test) { description = 'Runs functional tests.' group = 'verification' testClassesDirs = sourceSets.functionalTest.output.classesDirs classpath = sourceSets.functionalTest.runtimeClasspath shouldRunAfter test } check.dependsOn consoleLauncher tasks.withType(Test).configureEach { useJUnitPlatform { includeEngines 'jqwik', 'junit-jupiter' maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 } }