torsdag 23 juli 2009

The second release of discobot is out!

I have put together the second release of discobot and there are quite a some news:
  1. It now can use the groovy 1.7 code base so there is no need for the old discobot project based on groovy 1.6.3.
  2. The project now comes with a tool to generate android project directories complete with buildscripts et al.
  3. The generated jarfile is slightly smaller thanks some additional removed parts of groovy.
Now things are still under development so its not 100% certain that things will work as they should. And I have only tested things under linux so getting things to work under windows might require some hackery.
Also its not possible to run the unit tests after building groovy since a lot of files are currently missing from the source tree. This will be fixed in the next release.

Now to the usage guide:
To install you simply need to untar this file into a folder and make sure you have groovy, android sdk 1.1 and ant installed (dont untar into the same folder as the old discobot project).
When the file is untared you should be able to find a file named project.conf in the root directory
edit that file so that the specified path points to your android sdk folder.
now run ./merge.sh clean from the root folder. This will produce the discobot.jar file under the dist folder.
To generate a discobot project run:
./mkProject.sh -name org.testorg.test.Test -path ../testapp
The above command will create a project folder called testapp in the parent directory (the relevant files will be put into the root of this directory) and put a file called Test.groovy in the name space org.testorg.test. This is your programs entry point and contains a rather weak attempt to show off groovys features :)
It will also put a copy of the discobot jarfile under ../testapp/libs. To build the project run: ant -lib libs/discobot.jar and install the apk as usual.

fredag 10 juli 2009

Howto run groovy on android.

Its not super simple to run groovy on android yet but its certainly getting there. What you need is
this package and some patience. First of all edit the default.properties file so that sdk-folder points to your install if the android 1.1 sdk for example "sdk-folder=/home/hjalle/arbeten/gsoc/android-sdk-linux_x86-1.1_r1".
Now run "ant -lib ./libs/discobot.jar" from the command line to build the application this will result in a apk file in your projects bin directory.
Simply install it with the command "adb install bin/Hello-debug.apk" and run it from your emulator!
Theres a few caveats tho, this is a debuggy/hackish build of groovy so it spews out quite a bit of debug messages and theres no dynamic compilation yet.

If your interested in fiddling around a bit more you can download this tarfile which conatains a slightly more ambitious project. It is based on groovy 1.7 beta and contains a copy of that source tree inside the groovy-core folder. Inside the discobot-patches folder resides all the files that need to be modified for groovy to work on android.
And inside the libfolder there is a script called main.groovy that verfies all the patches (makes sure the original files have the correct CRC) and merges the two sourcetrees into the mixerfolder.
This is still a work in progress. Theres still no way of keeping track of which files belong to what fix but that is on the todo list along with moving as many of the patches as possible to retrotranslator.
And it doesnt run on android yet since groovy has evolved quite a bit since 1.6.3 and theres quite a few new problems to solve.

Note: Theres now a google code project @ http://code.google.com/p/discobot/ the files are downloadable from there aswell