From 03a92d22027ef0738d1ebfd59145236905751425 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 15 Dec 2018 14:59:28 +0100 Subject: Remove Gson dependency start custom libjtmx implementation This commit breaks MapLoader and by consequence the entire game. Being in Java 9+ now we will have multiple modules, namely: - libjtmx: separate minimal tmx (tiled) files loader library - subconscious: the game itself --- Makefile | 13 +++++++------ lib/gson-2.6.2.jar | Bin 229650 -> 0 bytes manifest.txt | 1 - src/libjtmx/Map.java | 10 ++++++++++ src/libjtmx/module-info.java | 3 +++ src/subconscious/MapLoader.java | 6 +----- src/subconscious/module-info.java | 3 +++ 7 files changed, 24 insertions(+), 12 deletions(-) delete mode 100644 lib/gson-2.6.2.jar create mode 100644 src/libjtmx/Map.java create mode 100644 src/libjtmx/module-info.java create mode 100644 src/subconscious/module-info.java diff --git a/Makefile b/Makefile index 26cecdc..e3e03b0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # project classes configuration MAINCLASS := subconscious.Subconscious -SOURCES := $(shell find src -iname '*.java') # debug or release mode DEBUG=1 @@ -9,7 +8,6 @@ LIMIT_RAM=1 # java compiler configuraton JAVAC := javac JAVAC_ARGS := -Xlint:all -Xdiags:verbose \ - -classpath lib/gson-2.6.2.jar:. \ -sourcepath src # java debugger configuration @@ -19,7 +17,7 @@ USE_JDB := 0 # java runtime configuration JAVA := java -JAVA_ARGS := -cp ../lib/gson-2.6.2.jar:. +JAVA_ARGS := ifeq ($(LIMIT_RAM),1) JAVA_ARGS += -Xmx2G endif @@ -33,10 +31,13 @@ endif # recipes .PHONY: all run jar classes dirs clean -all: classes +all: subconscious libjtmx -classes: dirs - $(JAVAC) $(JAVAC_ARGS) -d build $(SOURCES) +libjtmx: dirs + $(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/libjtmx -iname '*.java') + +subconscious: dirs + $(JAVAC) $(JAVAC_ARGS) -d build $(shell find src/subconscious -iname '*.java') # copy resources folder cp -r src/subconscious/res build/subconscious/ diff --git a/lib/gson-2.6.2.jar b/lib/gson-2.6.2.jar deleted file mode 100644 index 9d78626..0000000 Binary files a/lib/gson-2.6.2.jar and /dev/null differ diff --git a/manifest.txt b/manifest.txt index 9ecb5af..73fcb85 100644 --- a/manifest.txt +++ b/manifest.txt @@ -1,2 +1 @@ Main-Class: subconscious.Subconscious -Class-Path: ../lib/gson-2.6.2.jar diff --git a/src/libjtmx/Map.java b/src/libjtmx/Map.java new file mode 100644 index 0000000..d9333a8 --- /dev/null +++ b/src/libjtmx/Map.java @@ -0,0 +1,10 @@ +package libjtmx; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class Map { + +} \ No newline at end of file diff --git a/src/libjtmx/module-info.java b/src/libjtmx/module-info.java new file mode 100644 index 0000000..4dc4197 --- /dev/null +++ b/src/libjtmx/module-info.java @@ -0,0 +1,3 @@ +module libjtmx { + requires java.xml.bind; +} \ No newline at end of file diff --git a/src/subconscious/MapLoader.java b/src/subconscious/MapLoader.java index 6fe1273..67425e5 100644 --- a/src/subconscious/MapLoader.java +++ b/src/subconscious/MapLoader.java @@ -9,8 +9,6 @@ import java.io.IOException; import java.awt.Dimension; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; // TODO: remove import java.lang.UnsupportedOperationException; @@ -21,8 +19,6 @@ public class MapLoader { public static final String MAPS_RESOURCES_PATH = "/subconscious/res/maps/"; - private Gson gson = new GsonBuilder().setPrettyPrinting().create();; - public MapLoader() { } @@ -50,7 +46,7 @@ public class MapLoader { } public Map parse(final String json) { - return this.gson.fromJson(json, Map.class); + throw new UnsupportedOperationException(); } // public void saveMap(Map map) { diff --git a/src/subconscious/module-info.java b/src/subconscious/module-info.java new file mode 100644 index 0000000..a6d22b9 --- /dev/null +++ b/src/subconscious/module-info.java @@ -0,0 +1,3 @@ +module subconscious { + requires java.desktop; +} \ No newline at end of file -- cgit v1.2.1