Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Shared Library organisation and dependancies  (Read 2070 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Posted 2006-10-09 22:47:55 »

I'm toying with the idea of taking a bunch of common library-esque code I use (including a whole bunch of SPGL stuff), refactoring it a little and making it availble as a proper library (complete with tests, docs, etc. etc.).

The idea would not be a single big library, but a range of smaller modules which can be used independantly so people could pick and choose which bits they liked and which they could do their own thing. Currently the whole lot of code clocks in at about 0.6Mb, which I think is a little big if you only want one or two of the smaller chunks.

So I'm trying to figure out a way of dividing up the modules in a nice way. For bigger libraries I find sepearate projects in Eclipse work just fine - things stay separate, and dependancies are strictly enforeced. However the modules I'm thinking of would be too small for separate projects to make sense, and would make development a right pain to be switching back and forth between projects all the time.

Once alternative would be to have ant scripts which produce a collection of jars rather than one big one. However that wouldn't enforce dependancies like different projects would. Does anyone know of a way of testing that an individual jar has all the classes and dependancies it needs? Or is there anothe way to organise this kind of structure without needing that?

Cheers

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 70
Projects: 15


★★★★★


« Reply #1 - Posted 2006-10-10 01:21:21 »

you could just use something like ProGuard to create a new jar, from the big jar leaving only the bits needed in the new jar.
ProGuard can automatically check which files your project is using from a jar and remove the unneeded ones.
Offline ryanm

Senior Member


Projects: 1


Used to be bleb


« Reply #2 - Posted 2006-10-10 13:15:23 »

GenJar may be another choice. If you make a test class that fully exercises the functionality of the library, GenJar will analyse the dependencies and only pull in the classes that it needs
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #3 - Posted 2006-10-11 18:33:05 »

I'm toying with the idea of taking a bunch of common library-esque code I use (including a whole bunch of SPGL stuff), refactoring it a little and making it availble as a proper library (complete with tests, docs, etc. etc.).

The idea would not be a single big library, but a range of smaller modules which can be used independantly so people could pick and choose which bits they liked and which they could do their own thing. Currently the whole lot of code clocks in at about 0.6Mb, which I think is a little big if you only want one or two of the smaller chunks.
+1, see my post here :
http://www.java-gaming.org/forums/index.php?topic=14938.45

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline fletchergames

Senior Member





« Reply #4 - Posted 2006-10-11 19:44:33 »

What would be really nice is if you distributed the library as one big jar, but the user could only include the parts they used with their games.

Within the jar file, the code would be seperated into packages normally.  It would only be during the final release that the used classes would be seperated out for inclusion.

Unfortunately, this seems like something that should really be part of an IDE because checking for dependencies is pretty complex.  If you miss one file, your program won't work.  And there's also the issue of files for things like SPIs that have to be included but aren't actually referenced by your code.

It would be nice for this to all be automatic, but I don't see how that could work.
Offline pepijnve

Junior Member




Java games rock!


« Reply #5 - Posted 2006-10-11 20:17:38 »

ProGuard does exactly what you're asking for. You indicate the entry points for your application, and the tool does the rest.
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #6 - Posted 2006-10-12 10:37:16 »

ProGuard is more of a whole program optimiser really - for use by the person actually creating the game, not the library creator.

I think I've come up with a good solution now - I'll have an ant script which packages up individual modules into their own jars, ready for release. If I keep my test cases alongside the code they test then these smaller jars can have the unit tests run on each one in turn, which should fail if any of the dependancies are screwed. For the final releases another ant task can strip out all the unit test classes from all the jars.

For convinience I'll probably still have an 'uber' jar with everything in it, and if the user finds it easier to just use that and run their whole game through ProGuard then that would work too.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #7 - Posted 2006-10-12 10:41:18 »

I'm toying with the idea of taking a bunch of common library-esque code I use (including a whole bunch of SPGL stuff), refactoring it a little and making it availble as a proper library (complete with tests, docs, etc. etc.).

The idea would not be a single big library, but a range of smaller modules which can be used independantly so people could pick and choose which bits they liked and which they could do their own thing. Currently the whole lot of code clocks in at about 0.6Mb, which I think is a little big if you only want one or two of the smaller chunks.
+1, see my post here :
http://www.java-gaming.org/forums/index.php?topic=14938.45

Hmm, yes and no.

The whole point of this set of code is that it's all tried-and-tested stuff, code thats already been running in Cas' or my games for quite a while now. This isn't going to be a generic code dumping ground for classes that look vaugely useful - if the code hasn't been used in a proper game yet it's not going in. This way I think I can keep it practical and focused.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #8 - Posted 2006-10-13 18:49:49 »

The whole point of this set of code is that it's all tried-and-tested stuff, code thats already been running in Cas' or my games for quite a while now. This isn't going to be a generic code dumping ground for classes that look vaugely useful - if the code hasn't been used in a proper game yet it's not going in. This way I think I can keep it practical and focused.
Yeah, seems great. Now to see is the definition of a "proper game".. is that one you have played ?  Grin  Cool

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!