diff --git a/build.gradle b/build.gradle index d3403228a2..654ab18f27 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'application' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.openjfx.javafxplugin' version '0.0.13' + } repositories { @@ -12,23 +13,37 @@ repositories { dependencies { testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0' testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' + +// String javaFxVersion = '17.0.7' +// //String javaFxVersion = '11.0.2' +// +// implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' +// implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' +// implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' +// implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' +// implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' +// implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' +// implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' +// implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' +// implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' +// implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' +// implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' +// implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux' + + def platforms = ["win", "linux", "mac"] + def javafxDependency = ["javafx-graphics", "javafx-controls", "javafx-fxml"] - String javaFxVersion = '17.0.7' - - implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' - implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' - implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' - implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' - implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' - implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' - implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' - implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' - implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' - implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' - implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' - implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux' + for (plt in platforms) { + for (dep in javafxDependency) { + runtimeOnly "org.openjfx:$dep:$javafx.version:$plt" + } + } } + + + test { useJUnitPlatform() @@ -47,17 +62,18 @@ application { mainClass.set("duke.Launcher") } -shadowJar { +javafx { + version = '17.0.7' + modules = ['javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.graphics'] +} + +shadowJar{ archiveBaseName = "duke" archiveClassifier = null dependsOn("distZip", "distTar") archiveFileName = 'duke.jar' } -javafx { - version = "17.0.7" - modules = [ 'javafx.controls' , 'javafx.fxml' ] -} run{