Re: How compile Gosu project???

409 views
Skip to first unread message

Carson Gross

unread,
Dec 28, 2010, 10:20:04 AM12/28/10
to aardv...@googlegroups.com, gosu...@googlegroups.com
Brandon,

Looking at your project, I'd recommend a slight reorganization: I'd move the gosu program out of source and into a /bin directory.  Programs don't really have a package associated with them, and keeping them out of the main source directory appears to be an emerging convention.

The next gosu trick to use is the 'classpath' statement (I need to mention that on lazy gosu) at the start of your program:

  classpath "../src"

  var x = new SomeClassInSrc()

The classpath statement helps your avoid passing in a classpath on launch of a gosu program, or wrapping your gosu program with a script:

       /path/to/gosu.sh //path/to/myZfsUtility/Runner.gsp

Finally, on *nix, you can use the shebang convention in .gsp's:

  #! /path/to/gosu.sh

  classpath "../src"

  var x = new SomeClassInSrc()

Giving you *nix nirvana:

  //path/to/myZfsUtility/Runner.gsp

Mmmmmmmmmmm.

Cheers,
Carson

On Tue, Dec 28, 2010 at 5:04 AM, Brandon Gresham <bra...@thegreshams.net> wrote:
Was hoping to use it just to put together a minimal-version of my Eclipse-based Gosu project that I was planning on providing as a download to anyone wanting a ZFS-admin tool.
Is there a simpler way to achieve that goal that you'd recommend... maybe just doing it manually I guess... though I have copy() working pretty well.  My only problems is here to now I've been manually setting the classpath via the Gosu-editor -- this won't work, of course, since the end-user needs to provide their own classpath.

So my thought is that after I get a minimal-version using 'Vark copy' I then just depend on the user to do something like this:
       /path/to/gosu.sh --classpath /path/to/myZfsUtility //path/to/myZfsUtility/Runner.gsp

Does that sound reasonable???  A better suggestion???
(forgive me if I sound naive -- I am.  I *never* build my own java projects -- I work in a pretty big shop and we just dump our code in SVN and let the server guys do the actual builds -- I've never so much as sneezed at Ant before)

Thanks!
~Brandon







On Mon, 27 Dec 2010 23:23:39 -0700, Brian Chang <bcha...@gmail.com> wrote:

Sounds like you're now on track.  It's a point worth stating (somewhere)
that Aardvark isn't of much use to those starting out and experimenting with
Gosu.

Aardvark's exposure of javac will be of use to Java developers who don't
want to code directly with Ant XML.



On Mon, Dec 27, 2010 at 8:20 PM, Brandon Gresham <bra...@thegreshams.net>wrote:

Oooohhhh... thanks!
Yeah, I was starting to think something was up since I realized I hadn't
seen any reference anywhere to .gar files.

Thank you again.
:)





On Mon, 27 Dec 2010 17:49:44 -0700, Carson Gross <carso...@gmail.com>
wrote:

 Brian is offline right now (look for him to check in later tonight with
some
new features in Aardvark that I've been bugging him about) so I'll try my
best to answer this:

Gosu, right now, doesn't compile down to .class files.  Rather it is
compiled dynamically at runtime.  So all you need to do is copy your .gsp
file to wherever, and then it can be invoked directly, in source form,
with:

 gosu my_gosu_program.gsp

Same with gosu classes, enhancements, etc: just copy them to a place that
will be on the classpath at runtime and Gosu will dynamically find,
compile
and load them as necessary.  (This is a source of startup slowness in Gosu
that we are aware of.  Eventually we want you to be able to cache the
compiled versions of gosu classes, etc.)

So, Ant.copy() should be all you need.

HTH,
Carson

On Mon, Dec 27, 2010 at 4:45 PM, Brandon@UofU <bra...@thegreshams.net
>wrote:

 I feel like an idiot since several people appear to have posted to
this group, so are obviously using Aardvark... but I digress.

I have a basic Aardvark build script written using the VEDITor, based
off of the example script posted on the project's github-page... the
basics seem to be working when I call vark.

But in the example-script I see a reference in compile() to
'Ant.javac(...)'... ummm... excuse me???  I'm confused (and so too, it
appears, is my javac!)... we can't call javac to compile our *.gsp --
right???

I'm not sure what exactly I should be changing in order to get a gosu
*.gsp to compile using Aardvark.

Little help???
(thank you)



--
Using Opera's revolutionary email client: http://www.opera.com/mail/






--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Carson Gross

unread,
Dec 28, 2010, 1:03:33 PM12/28/10
to aardv...@googlegroups.com, gosu...@googlegroups.com
Added a bit on the 'classpath' statement up on lazy gosu:


Cheers,
Carson

Brandon Gresham

unread,
Dec 30, 2010, 9:29:33 PM12/30/10
to aardv...@googlegroups.com, gosu...@googlegroups.com, Carson Gross
Carson,

This works beautifully - thanks!
My utility now runs great from cron just via an entry to
/path/to/my/utility/runner.gsp

And I moved my runner from /src to /bin (and changed my output-folder from
/bin to /dist).
So now it's like this:
/etc
/gosu
/programs
/GosuZfsUtility
/src
/net...
/dist
/bin
-GosuZfsRunner.gsp

And everything runs great!
But my shebang still looks like this:
#! /etc/gosu/0.8/bin/gosu.sh

And I'm still wondering if that's right, as well as the
/etc/gosu/current-path questions.
But all in all, things are looking pretty good now -- much easier to run!

Thank You,
Brandon

On Tue, 28 Dec 2010 08:20:04 -0700, Carson Gross <carso...@gmail.com>

Brandon Gresham

unread,
Jan 4, 2011, 12:07:10 PM1/4/11
to aardv...@googlegroups.com, gosu...@googlegroups.com, Carson Gross
Carson,

Any ideas on how to make my shebang more "generic" -- is there a community standard or something I should be following????

Something like this:
#!/etc/gosu/current/bin/gosu.sh

As opposed to this:
#! /etc/gosu/0.8/bin/gosu.sh

???

Also, has there been any thoughts/discussions amongst the Gosu-team to adding support for executable Gosu-JARs???  Maybe call them GARs??? 
Along with a community-standard install-path, a GAR could allow me to package-up my bin&src into a single compressed-file that could still be executed simply like this:
/home/someUser/bin/myGosuProgram.gar -someOption

???


Thanks,
Brandon

Carson Gross

unread,
Jan 4, 2011, 12:18:13 PM1/4/11
to Brandon Gresham, aardv...@googlegroups.com, gosu...@googlegroups.com
I *think* the convention on *NIX is to assume that gosu is on the users path:

  #! gosu.sh

But I'm not a *NIX expert.  Anyone else want to weigh in?

At some point it would be nice to support something like java's executable jar convention w/ gosu:


I'm sure we could improve that a bit (e.g. support nested jars so you can wrap your whole project up in one non-flattened jar.)

Now, this next part is *pure* speculation/wish listery and Scott is the final arbiter of all things Gosu, but what I'd like to see at some point is a way to create and distribute gosu programs and libraries via a standard mechanism, like gems in ruby, so you could tell your users to do something like this (nb, syntax is just a straw man:)

 $  gosu install --source=http://yourserver.com your_killer_app
    your_killer_app installed at $GOSU_HOME/apps/bin
 $ your_killer_app
    Starting your killer app...

Again, nothing like that is even on the horizon, but that's what I'd like to see.

Cheers,
Carson

Brandon Gresham

unread,
Jan 4, 2011, 2:13:25 PM1/4/11
to Carson Gross, aardv...@googlegroups.com, gosu...@googlegroups.com

Carson,

 

1) Thanks for the tip regarding the *nix-convention -- I was not aware of this (not exactly a *nix-expert myself, either), but it makes a lot of sense -- will investigate to confirm before I roll it in.

 

2) The executable-jar-containing-nested-jars file idea would be perfect -- hopefully this will be coming relatively soon????

 

3) I think your idea of gosu install --source=... would be awesome -- push for it!  :)

 

Thanks again for the help regarding the shebang.

~Brandon

Reply all
Reply to author
Forward
0 new messages