-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
65 lines (49 loc) · 1.6 KB
/
Copy pathbuild.gradle
File metadata and controls
65 lines (49 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id 'java'
id 'application'
}
//sourceCompatibility = 12
repositories {
mavenCentral()
}
def javaFXPlatform = getJavaFXPlatform()
def javaFXVersion = "15.0.1"
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.+'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.+'
// you need a dependency for each of the JavaFX modules you're going to use
implementation "org.openjfx:javafx-base:${javaFXVersion}:${javaFXPlatform}"
implementation "org.openjfx:javafx-controls:${javaFXVersion}:${javaFXPlatform}"
implementation "org.openjfx:javafx-graphics:${javaFXVersion}:${javaFXPlatform}"
testImplementation 'org.mockito:mockito-inline:3.7.7'
testImplementation 'org.mockito:mockito-junit-jupiter:3.7.7'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
application {
//Java Module System module name
mainModule.set('controller')
//Your JavaFX application class
mainClass.set('controller.Program')
}
java {
// this enables Java Modularity in Gradle (version 6.7 and above)
modularity.inferModulePath.set(true)
}
// Based on this StackOverflow answer: https://stackoverflow.com/a/65209664/653519
private static String getJavaFXPlatform() {
def currentOS = DefaultNativePlatform.currentOperatingSystem
if (currentOS.isWindows()) {
return 'win'
} else if (currentOS.isLinux()) {
return 'linux'
} else if (currentOS.isMacOsX()) {
return 'mac'
}
return null
}