I've been meaning to make my Java build system stuff available for other to use for a long time. This plus a recent forum discussion plus my trying to re-sign/pack/LZMA LWJGL applet stuff led me to finally clean it up. I have tentatively named it "Scar", which is not only bad ass sounding, but reminds me of what ant/maven/etc has done to my soul. I've documented the project, but not yet written complete javadocs. I don't yet have hosting (waiting on Google Code to let me use the name), but here is the documentation and a download link:

There isn't a whole lot to it, but if you are going to write your build system in Java anyway, Scar should minimize the amount of work you need to do. Writing the build in Java has a lot of advantages, such as simplicity, developer familiarity, and the ability to fully debug the build in an IDE. If writing your build in Java doesn't appeal to you, it should be easy to leverage Scar using a different JVM language. Scar pretty much replaces ant completely. It doesn't have artifact repositories or plenty of other stuff I'm sure is out there, but it seems like maybe that stuff could be tacked on, resulting in a simpler overall system.

Here's one of the utility methods, showing off how much functionality is available without a whole lot of typing:

I need native launchers, so you can add the Scar directory to your path and run it by typing "scar". Does anyone have a basic template for this? I should use BAT for Windows and SH for everything else?

I need native launchers, so you can add the Scar directory to your path and run it by typing "scar". Does anyone have a basic template for this? I should use BAT for Windows and SH for everything else?

Hmm, 1 line SH file? Nah, can't be right. Ant's SH file is 326 lines. :p Ok, so the file is trivial, what about permissions? Is it possible to zip the SH file on Windows and have it be executable when unzipped on Linux?

One thing that made it look attractive is not having to stuff around with XML files like in Ant. But then on reading the documentation you're using YAML. Can the API be used without any config files, just in pure code?

One thing that made it look attractive is not having to stuff around with XML files like in Ant. But then on reading the documentation you're using YAML. Can the API be used without any config files, just in pure code?

Thanks!

Yes, it can be used solely through code. See the 2nd paragraph under the heading "Projects". However, I think you will find the YAML more convenient.

The idea with the YAML is that it makes it easy to include a "project.yaml" file to allow Scar to build your project without any other effort. Ant absolutely sodomizes XML. Scar's use of YAML is much different -- it is solely a project descriptor. It only provides information about the project, there is no goddamn scripting or other crazy stuff.

The YAML and Project class are similar to Maven's "project object model" (POM), except there is no schema -- the Project class is totally generic. Only if you chose to use Scar's utility methods are there any requirements about what project properties need to be defined. If you wanted to go off and write your own build system code, you could define your own project property requirements. Doing this isn't really all that crazy either, since the Scar utility methods only average maybe 20 lines of code each. The Project and Paths classes go a long way toward simplifying the build code.

Quote

PS: This lib would makemakes the whole LWJGL thing so much easier...

Fixed. I hope Scar will make both JWS and applets easier, so there will be less of an excuse for people to only post a JAR to show off their stuff. It can already completely package a Java app for JWS, including generating a JNLP, using pack200/gzip, and serving the files with Apache. The entire process would look like this (this is signing, packing, everything, without dicking with keytool, etc):

Maybe the coolest part about Scar is that it uses 3 of my OSS projects. The game I'm working on uses 6 of my OSS projects. I think maybe I should stop building tools and spend more time on the damned game...

Scar now has an official home! Yay!http://code.google.com/p/scar/I'm glad Google was so nice to let me have the "scar" project name. Until now, I have never been able to get the cool names (I end up with names like KryoNet ).

Documentation has been improved. I'll have the code and a download up soon.

Well, this is really getting interesting. I looked at Janino and it sounds nice. I didn't dig in its source, but I assume it is put together better than BeanShell. I was bummed Janino doesn't have support for some 1.5 features, namely enhanced for loops and varargs. Apparently BeanShell does, but then again BeanShell sucks. :p

So, what to do? I found that with ~35 somewhat cryptic lines, I can just compile and execute a string in-memory using only the JDK. Sweet!

YAML has nice syntax for multiple documents in one file (---). Now you can simply supply a second YAML document to customize the build. It looks like this:

Edit: Actually, I made it even cooler than that... the method is Scar.executeCode(String code, Map<String, Object> parameters). The parameters are used to output the appropriate imports and the "execute" method declaration, then the values are passed to the execute method so they are accessible for the code string being executed.

There are other dependencies that get pulled in because kryonet depends on kryo which depends on minlog, skorpios-desktop depends on skorpios-common, etc. When I run Scar on Dragon, it automatically builds all the other projects first and sucks in the dependencies.

It is still too early for my official alpha, but here is a little sneak preview to prove I'm not full of shit with the whole Scar business... http://www.esotericsoftware.com/dragon/dragon.jnlpWhen you run this it will start a server on your machine and a client. Go ahead and run it again and it will start another client (but not two servers). You get a random character and can move around and hit others. If you die your character is gone and you might as well close that client. For my official alpha unveiling I'll run a centralized server so we can beat on each other.

Actually using Scar to build my projects has helped flesh it out quite a bit. It could really benefit from a few others doing the same. I think it is already very close to being a generic solution for most projects, but could maybe be improved based on how people set up their projects and/or how they want to customize.

I'll add an applet build next, then I'll go back to working on my game!

- Make project a global, imho the yaml file _is_ the project, so why have to pass it to every target

Can't be global as sometimes you need to build (or at least construct/query) a project in the middle of building a different project. I like keeping the utilities/targets completely separate from the project descriptor. It means the Scar utility methods are optional and the project can be highly customzied or even used to build other languages or do script-like tasks. I don't think passing in a project when needed is too big of a deal, and is at least clear as to what is going on. The less magic, the better.

Quote

On a personal note:Let scar detect a maven installation and allow dependencies to be specified as maven coordinates:

www.Janino.net is about 1000 times better than Beanshell! Faster, less bugs, better maintained. But for some reason less well known.

IMO opinion this down to the name of the libraries, Beanshell sounds pretty cool and easy to remember, while janino is rather awkward and hard to remember. Guess we have another example of this with the names of the current java opengl binding.

@NateS the scar link in your signature is out of date as it points to the old link as well as the first post in this thread, might be a good idea to update or remove the temp scar page.

I hadn't thought about it. I've never had the need for a custom Eclipse builder. I could see it being useful for some scenarios though, such as kicking off compile time bytecode manipulation (eg, JStackAlloc). So, to answer your question, probably not until I (or someone else interested in using Scar) have the need.

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