On Fri, Aug 21, 2009 at 8:15 AM, Alex Boisvert <[email protected]>wrote:

> On Thu, Aug 20, 2009 at 10:49 PM, Alex Eagle <[email protected]>
> wrote:
>
> > Hi there,
> > I've just started using Buildr on a project, and so far I'm glad to
> > dispense
> > with all that XML in Maven. A couple n00b questions:
> >
> > It seems that my Antlr grammar is being compiled with the wrong version
> of
> > Antlr.
> > 1) How can I tell the classpath being used for the JVM that's running the
> > antlr.Tool#process method? I'd like to confirm it's the older version
> (pre
> > 3.1). My evidence so far is that new features like tree grammar and token
> > declarations with the literal value aren't working.
> >
> > I tried hacking the classpath, based on an example I found [1], like so:
> >  ANTLR = ["org.antlr:antlr:jar:3.1.1",
> "org.antlr:stringtemplate:jar:3.2"]
> >  Buildr::ANTLR::REQUIRES = ANTLR
> >  Java.classpath.unshift ANTLR
> > This doesn't seem to be working either.
>
>
> Because of the way RJB works, you have to initialize these constants pretty
> early in your Buildfile to avoid the classspath being initialized with the
> default values.     Did you add these lines towards the top of your
> Buildfile?
>

There's an example here:

http://github.com/intalio/simpel/blob/master/Rakefile

Matthieu


>
> 2) When I change the grammar, the code generation doesn't seem to happen. I
> > have to do a clean build to force the antlr generation to happen again.
> > This
> > seems like a bug in the way the Rake task is created? I'm running it like
> > this:
> >  antlr = antlr(_('src/main/antlr'), :in_package=>'noop.grammar')
> >
> >  compile.from antlr
> >  compile.with ANTLR
>
>
> I believe you have to point to specific files instead of the directory.
>
> You could try:
>
>  antlr = antlr(Dir[_('src/main/antlr'+'/*.g']),
> :in_package=>'noop.grammar')
>
> alex
>

Reply via email to