blob: b88b354b2c67386f67e278ee77ff9540733706ba [file] [log] [blame]
configurations {
tck {
transitive = false
}
// Because we reference tests in the SimpleTestSuite to be able to run them in the IDE,
// the tests need explicitly added to the classpath as well
testImplementation.extendsFrom(tck)
}
dependencies {
if (!project.hasProperty('includeBaseTckClass') || project.findProperty('includeBaseTckClass')) {
testImplementation project(':grails-datamapping-tck-base')
}
// So we can easily extract the compiled classes
tck project(':grails-datamapping-tck-tests')
testImplementation project(':grails-datamapping-tck-domains')
runtimeOnly 'org.apache.groovy:groovy-dateutil', {
// Groovy Date Utils Extensions are used in the tests
}
}
// TODO: gradle will happily put the jar file on the classpath, but junit won't find the tests.
// Dynamic test discovery also won't find them so extract the class files to force junit to work.
TaskProvider<Sync> extractTck = tasks.register('extractTckJar', Sync) {
inputs.files(configurations.tck)
from { zipTree(configurations.tck.singleFile) }
into(layout.buildDirectory.dir('extracted-tck-classes'))
}
tasks.withType(Test).configureEach {
testClassesDirs = objects.fileCollection().from(extractTck, testClassesDirs)
finalizedBy('cleanupTckClasses')
}
// There is a known issue with IntelliJ that can cause it's inspection process to lock up.
// this is a work around to help prevent the scenario that causes the lock up.
tasks.register('cleanupTckClasses') {
Provider<Directory> extractDir = layout.buildDirectory.dir('extracted-tck-classes')
doLast {
extractDir.get().asFile.deleteDir()
}
}