Anyone got the groovy running on Android?

View: New views
10 Messages — Rating Filter:   Alert me  

Anyone got the groovy running on Android?

by Tahir Akhtar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I found this through google.
http://www.jameswilliams.be/blog/entry/38;jsessionid=7711F31E5A4CE248E63009221DFE6117

Someone got a better solution?

Regards
Tahir

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Anyone got the groovy running on Android?

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Tahir Akhtar wrote:
Hi,
I found this through google.
http://www.jameswilliams.be/blog/entry/38;jsessionid=7711F31E5A4CE248E63009221DFE6117

Someone got a better solution?
As i understand it, the Android JVM does not use the normal JVM bytecodes. There is a preprocessor which converts class files produced by the Java compiler into the format used by Android (the Android bytecodes use a register rather than a stack architecture).

I do not believe that the preprocessor runs on Android.

I think that this makes the use of custom ClassLoaders and dynamic compilation using ASM impossible at the moment on Android.

It might be possible to run a subset of Groovy on Android if you pre compiled the Groovy code and ran the class files thorough the converter. However the runtime system does tend to like to dynamically compile helper classes and this might need some hacking to get it to work properly.

I believe JRuby is able to directly execute the AST for a class rather than having to compile it to bytecodes first. It may be that it would be easier to get JRuby to run on Android than Groovy at the moment (Scala has been reported as running OK)

John Wilson

Re: Anyone got the groovy running on Android?

by jwill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another problem other than the classloaders is all the reflection classes that Groovy needs to compile(most reside in rt.jar). I think the only way to get Groovy working would be to rip out all the dynamic classes and MOP. The result would be a language that is not really Groovy.

On Jan 23, 2008 11:37 AM, tugwilson <tug@...> wrote:



Tahir Akhtar wrote:
>
> Hi,
> I found this through google.
> http://www.jameswilliams.be/blog/entry/38;jsessionid=7711F31E5A4CE248E63009221DFE6117
>
> Someone got a better solution?
>

As i understand it, the Android JVM does not use the normal JVM bytecodes.
There is a preprocessor which converts class files produced by the Java
compiler into the format used by Android (the Android bytecodes use a
register rather than a stack architecture).

I do not believe that the preprocessor runs on Android.

I think that this makes the use of custom ClassLoaders and dynamic
compilation using ASM impossible at the moment on Android.

It might be possible to run a subset of Groovy on Android if you pre
compiled the Groovy code and ran the class files thorough the converter.
However the runtime system does tend to like to dynamically compile helper
classes and this might need some hacking to get it to work properly.

I believe JRuby is able to directly execute the AST for a class rather than
having to compile it to bytecodes first. It may be that it would be easier
to get JRuby to run on Android than Groovy at the moment (Scala has been
reported as running OK)

John Wilson

--
View this message in context: http://www.nabble.com/Anyone-got-the-groovy-running-on-Android--tp15044776p15045587.html
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email



Re: Anyone got the groovy running on Android?

by Jochen Theodorou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James Williams schrieb:
> Another problem other than the classloaders is all the reflection
> classes that Groovy needs to compile(most reside in rt.jar). I think the
> only way to get Groovy working would be to rip out all the dynamic
> classes and MOP. The result would be a language that is not really Groovy.

depends... let us say we have a fixed set of groovy programs and let us
assume we could generate a bunch of support classes. In that case we
might use these support classes to replace the reflective information...
and then most of Groovy would work, only that you could not change a
script or make a new one.... but it would theoretically work. This would
for example still allow a custom MetaClass and other things.

Another way would be to try to make a different generation path, which
works without classcode... in that case we would possibly loose some
java integration, but we might be able to use custom scripts. But I
guess this alternative would be much more complicated than the other one

bye blackdrag

--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Anyone got the groovy running on Android?

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


jwill wrote:
Another problem other than the classloaders is all the reflection classes
that Groovy needs to compile(most reside in rt.jar). I think the only way to
get Groovy working would be to rip out all the dynamic classes and MOP. The
result would be a language that is not really Groovy.

Android has all the java.lang.reflect classes. So I think it's possible to build a Groovy style MetaClass as long as you don't try the dynamically compile call dispatch helpers.

John Wilson

Re: Anyone got the groovy running on Android?

by Jim White :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James Williams wrote:

> Another problem other than the classloaders is all the reflection
> classes that Groovy needs to compile(most reside in rt.jar). I think the
> only way to get Groovy working would be to rip out all the dynamic
> classes and MOP. The result would be a language that is not really Groovy.

Yeah, Android is actually a whole lot like GWT in terms of how it works
in relation to Java.  So Groovy as we know it currently isn't practical.

But that points to something a bit different that is possible which is
targeting Android from GWT so that a GWT-powered webapp could easily
have an Android version.

There have been some folks trying to use Groovy and GWT together.

http://docs.codehaus.org/display/GRAILS/GWT+Plugin

http://blogs.pathf.com/agileajax/gwt/index.html

http://www.ayokasystems.com/googlewebtoolkit.html

Jim

> On Jan 23, 2008 11:37 AM, tugwilson <tug@...
> <mailto:tug@...>> wrote:
>
>     Tahir Akhtar wrote:
>      >
>      > Hi,
>      > I found this through google.
>      >
>     http://www.jameswilliams.be/blog/entry/38;jsessionid=7711F31E5A4CE248E63009221DFE6117
>      >
>      > Someone got a better solution?
>      >
>
>     As i understand it, the Android JVM does not use the normal JVM
>     bytecodes.
>     There is a preprocessor which converts class files produced by the Java
>     compiler into the format used by Android (the Android bytecodes use a
>     register rather than a stack architecture).
> ...



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Anyone got the groovy running on Android?

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 23 January 2008 09:32, Jim White wrote:

> James Williams wrote:
> > Another problem other than the classloaders is all the reflection
> > classes that Groovy needs to compile(most reside in rt.jar). I
> > think the only way to get Groovy working would be to rip out all
> > the dynamic classes and MOP. The result would be a language that is
> > not really Groovy.
>
> Yeah, Android is actually a whole lot like GWT in terms of how it
> works in relation to Java.  So Groovy as we know it currently isn't
> practical.

The Scala folks got it (Scala) running on Android.

I'd say the gauntlet has been thrown down!


> ...


RRS

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Anyone got the groovy running on Android?

by Charles Oliver Nutter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tugwilson wrote:
> I believe JRuby is able to directly execute the AST for a class rather than
> having to compile it to bytecodes first. It may be that it would be easier
> to get JRuby to run on Android than Groovy at the moment (Scala has been
> reported as running OK)

Yes, JRuby's interpreted mode would probably run just fine. The trick
then is just to be able to remove the rest of the code that won't build
properly for Android.

JRuby's compiled mode would probably also work fine if code were
precompiled.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Anyone got the groovy running on Android?

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


tugwilson wrote:
As i understand it, the Android JVM does not use the normal JVM bytecodes. There is a preprocessor which converts class files produced by the Java compiler into the format used by Android (the Android bytecodes use a register rather than a stack architecture).

I do not believe that the preprocessor runs on Android.

I think that this makes the use of custom ClassLoaders and dynamic compilation using ASM impossible at the moment on Android.
Hmm..

I have gone back to the Android documentation and they *do* seem to support ClassLoaders. So it's possible that you could do dynamic compilation to bytecodes in memory and load the class via a custom ClassLoader.

John Wilson

Re: Anyone got the groovy running on Android?

by tugwilson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


tugwilson wrote:
I have gone back to the Android documentation and they *do* seem to support ClassLoaders. So it's possible that you could do dynamic compilation to bytecodes in memory and load the class via a custom ClassLoader.

It appears that this is not possible: http://blog.luminis.nl/luminis/entry/osgi_on_google_android_using

So dynamic compilation to JCM bytecodes and then loading them into the Android JVM via a ClassLoader is not possible (at least at the moment).

John Wilson