apply plugin: 'application'
def currentOS = org.gradle.internal.os.OperatingSystem.current()
def platform
if (currentOS.isWindows()) {
platform = 'win'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'mac'
}
repositories {
mavenCentral()
}
dependencies {
// we need to depend on the platform-specific libraries of openjfx
compile "org.openjfx:javafx-base:11:${platform}"
compile "org.openjfx:javafx-graphics:11:${platform}"
compile "org.openjfx:javafx-controls:11:${platform}"
compile "org.openjfx:javafx-fxml:11:${platform}"
// junit 5
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
// testfx with junit5 binding
testImplementation 'org.testfx:testfx-core:4.0.14-alpha'
testImplementation 'org.testfx:testfx-junit5:4.0.14-alpha'
}
// add javafx modules to module-path during compile and runtime
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml'
]
}
}
run {
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml'
]
}
}
test {
// use junit5 engine in gradle
useJUnitPlatform()
// log all tests
testLogging {
events 'PASSED', 'FAILED', 'SKIPPED'
}
// log output of tests; enable when needed
//test.testLogging.showStandardStreams = true
}
mainClassName='sample.HelloFX'