45 lines
1.2 KiB
Groovy
45 lines
1.2 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
}
|
|
|
|
configurations {
|
|
cli {
|
|
canBeConsumed = false
|
|
canBeResolved = true
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
cli project(path: ':cli', configuration: 'shadow')
|
|
testImplementation project(path: ':cli', configuration: 'shadow')
|
|
|
|
testImplementation platform("org.junit:junit-bom:$junit_version")
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
testImplementation "org.assertj:assertj-core:$assertj_version"
|
|
}
|
|
|
|
/**
|
|
* Delayed expansion for passing the path to the executable jar to the tests via system property.
|
|
*/
|
|
abstract class ExecutableArgumentProvider implements CommandLineArgumentProvider {
|
|
@InputFiles
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
|
abstract ConfigurableFileCollection getConfiguration()
|
|
|
|
@Override
|
|
Iterable<String> asArguments() {
|
|
["-Djst.executableJar=${configuration.singleFile}"]
|
|
}
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
jvmArgumentProviders.add(
|
|
objects.newInstance(ExecutableArgumentProvider).tap {
|
|
configuration = configurations.cli
|
|
}
|
|
)
|
|
systemProperty("jst.testDataDir", "${project.projectDir}/data")
|
|
}
|