Are dependencies required even if not used in Java?

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

Are dependencies required even if not used in Java?

Postby larienna » Sat Jul 13, 2019 3:31 pm

I am working on a game library what will offer the possibility to save Data in SQL or JSON which will be handled by external libraries (I did not code). Let's call them libsql and libjson. That means that the dependency pattern is:

mylibrary depends on libsql
mylibrary depends on libjson

The goal is to be able to implement games by using mylibrary. But let's say my game does not use libsql, but only need libjson.

Could I make mygame depend on mylibrary and only include libjson in the dependencies or will it complain that libsql is missing even if not used?.
Does putting the libsql and libjson in a separate package solve the issue even if they are part of the same JAR?

-------------------------------------------------------------------------------------

Else the other solution would be to extract from mylibrary the libsql and libjson implementation to create 2 separate project to create independent JAR. Let's call those implementations mylibsql and mylibjson. So I would end up with:

mylibsql depends on libsql
mylibjson depends on libjson

then when I create my game I use the following dependencies

mygame depends on mylibrary
mygame depends on mylibjson depends on libjson

mylilbray and mylibjson "connect" with each other using a common interface that will be implemented in mylibjson and mylibsql.

Is there another way to achieve the same results.
larienna
 
Posts: 279
Joined: Mon Feb 09, 2015 2:23 am

Return to General Development

Who is online

Users browsing this forum: gornova and 1 guest