From 24a66fb42280c0cdf582719f456e01b851d5fc9b Mon Sep 17 00:00:00 2001 From: crissnb Date: Wed, 27 Mar 2024 16:50:13 +0100 Subject: [PATCH] fixes graphlayouter not working in jar; version bump to 1.0.1 --- build.gradle.kts | 44 ++++++++++++------- .../util/graphlayouting/Graphlayouter.java | 3 ++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7b7f9df4..5104aa52 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,8 @@ import net.ltgt.gradle.errorprone.errorprone +import org.gradle.jvm.tasks.Jar plugins { jacoco - id("checkstyle") - id("com.github.johnrengelman.shadow") version "8.1.1" id("java") id("application") id("antlr") @@ -14,7 +13,7 @@ plugins { } group = "org.gecko" -version = "0.1" +version = "1.0.1" javafx { version = "21.0.1" @@ -26,6 +25,11 @@ repositories { } dependencies { + implementation("org.eclipse.elk:org.eclipse.elk.core:0.8.1") + implementation("org.eclipse.elk:org.eclipse.elk.alg.common:0.8.1") + implementation("org.eclipse.elk:org.eclipse.elk.alg.force:0.8.1") + implementation("org.eclipse.elk:org.eclipse.elk.alg.layered:0.8.1") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.16.1") testImplementation(platform("org.junit:junit-bom:5.9.1")) @@ -38,10 +42,11 @@ dependencies { implementation("org.antlr:antlr4-runtime:4.13.1") antlr("org.antlr:antlr4:4.13.1") - implementation("org.eclipse.elk:org.eclipse.elk.core:0.8.1") - implementation("org.eclipse.elk:org.eclipse.elk.alg.common:0.8.1") - implementation("org.eclipse.elk:org.eclipse.elk.alg.force:0.8.1") - implementation("org.eclipse.elk:org.eclipse.elk.alg.layered:0.8.1") + + runtimeOnly("org.openjfx:javafx-graphics:$javafx.version") +// runtimeOnly("org.openjfx:javafx-graphics:$javafx.version:win") +// runtimeOnly("org.openjfx:javafx-graphics:$javafx.version:linux") +// runtimeOnly("org.openjfx:javafx-graphics:$javafx.version:mac") } tasks.withType().configureEach { @@ -49,10 +54,6 @@ tasks.withType().configureEach { options.errorprone.disableWarningsInGeneratedCode.set(true) } -checkstyle { - toolVersion = "10.12.5" -} - val generateGrammarSource by tasks.existing(AntlrTask::class) { arguments.add("-visitor") arguments.add("-package") @@ -89,8 +90,19 @@ application { mainClass.set("org.gecko.application.Main") } -tasks { - shadowJar { - exclude("module-info.class") - } -} +tasks.register("uberJar") { + archiveClassifier = "uber" + + from(sourceSets.main.get().output) + manifest.attributes["Main-Class"] = "org.gecko.application.Main" + + dependsOn(configurations.runtimeClasspath) + from({ + configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } + }) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + exclude("META-INF/*.SF") + exclude("META-INF/*.DSA") + exclude("META-INF/*.RSA") + exclude("META-INF/LICENSE") +} \ No newline at end of file diff --git a/src/main/java/org/gecko/util/graphlayouting/Graphlayouter.java b/src/main/java/org/gecko/util/graphlayouting/Graphlayouter.java index d955f913..d54160a5 100644 --- a/src/main/java/org/gecko/util/graphlayouting/Graphlayouter.java +++ b/src/main/java/org/gecko/util/graphlayouting/Graphlayouter.java @@ -3,9 +3,11 @@ import java.util.ArrayList; import java.util.List; import javafx.geometry.Point2D; +import org.eclipse.elk.alg.layered.options.LayeredMetaDataProvider; import org.eclipse.elk.alg.layered.options.LayeredOptions; import org.eclipse.elk.core.IGraphLayoutEngine; import org.eclipse.elk.core.RecursiveGraphLayoutEngine; +import org.eclipse.elk.core.data.LayoutMetaDataService; import org.eclipse.elk.core.options.CoreOptions; import org.eclipse.elk.core.util.BasicProgressMonitor; import org.eclipse.elk.graph.ElkNode; @@ -28,6 +30,7 @@ public class Graphlayouter { public Graphlayouter(GeckoViewModel viewModel) { this.viewModel = viewModel; elkGraphCreator = new ELKGraphCreator(viewModel); + LayoutMetaDataService.getInstance().registerLayoutMetaDataProviders(new LayeredMetaDataProvider()); } public void layout() {