ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doyle, Jim" <jdo...@iso-ne.com>
Subject RE: Script and BeanShell
Date Fri, 17 May 2002 17:55:14 GMT
That'd be great.  

As Conor mentions below, there's a problem with
specifying extra languages for BSF, as I found when I tried it a few
different ways.  BSF has a properties file in its
jar file that declares the languages it recognizes.  Really it's just a 
simple language-name-to-class-name mapping.  Currently, it doesn't
include BeanShell, though some future BSF version is supposed to include
it.  The only other way to register a language is programmatically declaring
that specific language before your code executes the script.  

Currently I'm using a hacked version of
the BSF jar with BeanShell added to the properties file.
But I think Script task support like this would be appropriate:

<target name="print.ten">
  <script language="beanshell"  
          languageclass="bsh.util.BeanShellBSFEngine"> <![CDATA[

           for (i=1; i<=10; i++) {
             print(i);
           }

         ]]> </script>
</target>

If the optional "languageclass" attribute is present, you would 
invoke BSF code like:

BSFManager mgr;
...
String[] extensions = {"bsh"};
mgr.registerScriptingEngine ("beanshell",
                             "bsh.util.BeanShellBSFEngine", extensions);

The best source of info about this I've seen is the BSF guide
(bsf-2_2/docs/guide/guide.pdf) included
in the BSF binary distribution:
http://www-124.ibm.com/developerworks/project/showfiles.php?group_id=16&rele
ase_id=59

Thanks,
Jim

> -----Original Message-----
> From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
> Sent: Friday, May 17, 2002 10:38
> To: Ant Users List
> Subject: Re: Script and BeanShell
> 
> 
> If someone could point me to the right info I'll have a whack 
> at fixing this
> at some point in the near future.
> 
>     Erik
> 
> 
> ----- Original Message -----
> From: "Conor MacNeill" <conor@cortexebusiness.com.au>
> To: "Ant Users List" <ant-user@jakarta.apache.org>
> Sent: Friday, May 17, 2002 12:01 AM
> Subject: Re: Script and BeanShell
> 
> 
> > I think there is an issue. I had a discussion with Pat a 
> while ago and
> > you need to explicitly register BeanShell in the script 
> task. This will
> > need a change to the script task. Perhaps we need a nested 
> element to
> > allow you to register an aribtrary scripting language.
> >
> > Conor
> >
> >
> > Erik Hatcher wrote:
> > > You should simply be able to say:
> > >
> > >     <script langugage="beanshell">.... </script>
> > >
> > > I believe.  Whatever language name is associate with 
> BeanShell scripts
> with
> > > BSF is the one to use. I don't know if you need to have a 
> newer version
> of
> > > BSF or not, but looks like you need the BeanShell/BSF adapter:
> > > http://www.beanshell.org/download.html - probably if you 
> toss them all
> in
> > > ANT_HOME/lib it'll work!
> > >
> > >     Erik
> > >
> > >
> > > ----- Original Message -----
> > > From: "Doyle, Jim" <jdoyle@iso-ne.com>
> > > To: <ant-user@jakarta.apache.org>
> > > Sent: Thursday, May 16, 2002 3:42 PM
> > > Subject: Re: Script and BeanShell
> > >
> > >
> > >
> > >>Hi,
> > >>
> > >>I'm interested in using the script task to run beanshell as well.
> > >>It looks like BSF support was added to beanshell around 
> version 1.2b1.
> > >>Once a language supports BSF, how can one integrate it into the
> > >>Script task?
> > >>
> > >>Jim
> > >>jdoyle@iso-ne.com
> > >>
> > >>
> > >>
> > >>--
> > >>To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > >>For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> > >>
> > >>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> > >
> > >
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: 
> <mailto:ant-user-help@jakarta.apache.org>
> >
> >
> 
> 

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message