blob: 64a5847be226fa26e5fef7106505c07cf39b94f3 [file] [log] [blame]
plugins {
id("java")
id("mockito.test-conventions")
}
apply from: "osgi-test-bundles.gradle"
description = "Test suite for OSGi framework with Mockito"
dependencies {
testImplementation project(":mockito-core")
testImplementation libs.junit4
testImplementation libs.osgi
testRuntimeOnly libs.equinox
}
configurations {
testRuntimeBundles
}
dependencies {
testRuntimeBundles project(":mockito-core")
testRuntimeBundles libs.bytebuddy
testRuntimeBundles libs.objenesis
testRuntimeBundles tasks.testBundle.outputs.files
testRuntimeBundles tasks.otherBundle.outputs.files
}
test {
jvmArgumentProviders.add(
new RuntimeBundlesProvider(files: configurations.testRuntimeBundles.asFileTree)
)
dependsOn configurations.testRuntimeBundles
inputs.files(sourceSets.testBundle.allSource)
.withPathSensitivity(PathSensitivity.RELATIVE)
.withPropertyName('testBundleSources')
inputs.files(sourceSets.otherBundle.allSource)
.withPathSensitivity(PathSensitivity.RELATIVE)
.withPropertyName('otherBundleSources')
useJUnit()
}
/**
* A helper class to pass classpath elements as relative paths. This allows the build
* to be checked out in different locations on the file system and still hit the cache.
*/
class RuntimeBundlesProvider implements CommandLineArgumentProvider {
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
FileTree files
@Override
Iterable<String> asArguments() {
String[] absolutePaths = files.stream().map {it.absolutePath}.toArray()
["-DtestRuntimeBundles=${absolutePaths.join(File.pathSeparator)}".toString()]
}
}