Building hecl for android with eclipse

75 views
Skip to first unread message

Peter Rainaud

unread,
Mar 13, 2012, 8:14:48 AM3/13/12
to Hecl
Hi,

I try to build a new hecl.apk from the new distribution that zdia
provided.

I try to use eclipse to compile everything.

Everything is installed on eclipse. Android SDK,ADT, android emulator.

I can build the example files that are provided.

I tried to add the hecl distribution. But is always complains it
cannot resolve intthing,doublething...

So it cannot find the definitions hecl provides.

Which link do I have to provide that eclipse knows about these
definitions?

I want to make my hands dirty with hecl, but first I must be able to
compile it of coarse.

I know it's a stupid question, but the whole java thing is a little
bit overwhelming.
That's why i like the scripting :-)

Kind regards,

Peter

zdia

unread,
Mar 13, 2012, 9:22:43 AM3/13/12
to he...@googlegroups.com
> I know it's a stupid question, but the whole java thing is a little
> bit overwhelming. That's why i like the scripting :-)

Yes, I felt the same. And even Eclipse was too overwhelming for me, so I decided to go with the command-line. You can call the tools explicitly and get all the error messages you need.

For interactive use you will need:

emulator
ant
adb

Let's assume you have installed those tools and they can be found searching the PATH variable, and Hecl is installed into a folder hecl/:

tree hecl
|-- HTML
|-- android
|-- androidbuilder
|-- applet
|-- applettweak
|-- blackberry
|-- blackberrygui
|-- build
|-- build-tools
|-- commandline
|-- core
|-- docs
|-- files
|-- heclbuilder
|-- html
|-- jarhack
|-- jars
|-- java
|-- kxml
|-- load
|-- location
|-- logos
|-- media
|-- midp10
|-- midp10gui
|-- midp20
|-- midp20gui
|-- mwt
|-- mwtgui
|-- net
|-- projects
|-- rms
`-- tests
...

Then you have at first to adjust your settings:

$ cat android/android.properties
sdk-folder=/home/dia/Programme/hecl
android-tools=/home/dia/Programme/android-sdk-linux_x86/tools
android-platform=/home/dia/Programme/android-sdk-linux_x86/platforms/android-8
android-platform-tools=/home/dia/Programme/android-sdk-linux_x86/platform-tools

Because I use Android 2.2 I have to choose android-8

Then cd to the folder hecl/ and type:

ant android-install

If all goes well you will find Hecl-debug.apk in folder android/bin. If not then post the error messages you will get on the console and we will see.


Am 13.03.2012 13:14, schrieb Peter Rainaud:

> So it cannot find the definitions hecl provides.

I know all the Android books recommend Eclipse. But you will not need it. Not for developing, not for debugging.

For a good (Java, Tcl) editor try Geany.

Zbigniew

Peter Rainaud

unread,
Mar 13, 2012, 9:23:16 PM3/13/12
to he...@googlegroups.com
Hi  Zbigniew ,

I am able to compile your distribution!

Now I tried to change the script.hcl to only contain
source /sdcard/script.hcl

So I will be able to modify and test the script on the fly.

I checked the Hecl-debug.apk file and I don't find any reference to the old script.

But if I install the application I still get the widget overview script

unbelievable!

What goes wrong?

Kind regards,

Peter



Op 13 maart 2012 14:22 schreef zdia <z....@gmx.de> het volgende:

zdia

unread,
Mar 15, 2012, 2:43:32 AM3/15/12
to he...@googlegroups.com


Am 14.03.2012 02:23, schrieb Peter Rainaud:
> Hi  Zbigniew ,
>
> I am able to compile your distribution!

Ah, good news. By the way: In the latest commit I have commented out the many
System.out.println commands in Reflector.java because they overwhelm the
logcat output ...


>
> Now I tried to change the script.hcl to only contain source
> /sdcard/script.hcl

In <yourPath>/hecl/android/res/raw/script.hcl?

>
> So I will be able to modify and test the script on the fly.
>
> I checked the Hecl-debug.apk file and I don't find any reference to
> the old script.
>
> But if I install the application I still get the widget overview
> script
>
> unbelievable!
>
> What goes wrong?

If I am understanding well your problem then you tried to write our own
script.hcl but Hecl starts with the original Hecl script.hcl?

If the following steps are given then your application should be launched:

- Check unzipping /android/bin/Hecl-debug.apk if in res/raw/script.hcl
is just the line: source /sdcard/script.hcl

- Check if you have pushed the right "script.hcl" to /sdcard/script.hcl
    adb push myscript.hcl /sdcard/script.hcl

- Reinstall Hecl:
    adb install <yourpath>/android/bin/Hecl-debug.apk

If you have just closed Hecl it is still active. To make an Android app
really closed and restart it with cleared memory you have to "force close" it or to use the "adb shell" with

kill -9 <pid>

Zbigniew

zdia

unread,
Mar 15, 2012, 4:20:48 AM3/15/12
to he...@googlegroups.com
EDIT:

If I am understanding well your problem then you tried to write your own
script.hcl but you get the original Hecl script.hcl?



Peter Rainaud

unread,
Mar 15, 2012, 9:46:39 PM3/15/12
to he...@googlegroups.com
Hi Zdia,

I was using the old version of hecl not your forked one!!

So,I downloaded the gorilla distribution but now it doen't compile:

I get the following error:

    [javac] /home/peter/hecl/build/android/pre/core/org/hecl/GorillaCmds.java:39: package org.spongycastle.jce.provider does not exist
    [javac]     import org.spongycastle.jce.provider.BouncyCastleProvider;
    [javac]                                         ^
    [javac] /home/peter/hecl/build/android/pre/core/org/hecl/GorillaCmds.java:129: cannot find symbol
    [javac] symbol  : class BouncyCastleProvider
    [javac] location: class org.hecl.GorillaCmds
    [javac]           Security.addProvider(new BouncyCastleProvider());
    [javac]                                    ^
    [javac] /home/peter/hecl/build/android/pre/core/org/hecl/GorillaCmds.java:165: cannot find symbol
    [javac] symbol  : class BouncyCastleProvider
    [javac] location: class org.hecl.GorillaCmds
    [javac]                         Security.addProvider(new BouncyCastleProvider());
    [javac]                                                  ^
    [javac] /home/peter/hecl/build/android/pre/core/org/hecl/GorillaCmds.java:197: cannot find symbol
    [javac] symbol  : class BouncyCastleProvider
    [javac] location: class org.hecl.GorillaCmds
    [javac]                         Security.addProvider(new BouncyCastleProvider());
    [javac]                                                  ^
    [javac] /home/peter/hecl/build/android/pre/core/org/hecl/GorillaCmds.java:264: cannot find symbol
    [javac] symbol  : class BouncyCastleProvider
    [javac] location: class org.hecl.GorillaCmds
    [javac]                     Security.addProvider(new BouncyCastleProvider());
    [javac]                                              ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 5 errors

BUILD FAILED
/home/peter/hecl/android/build.xml:179: Compile failed; see the compiler error output for details.

Do you have a workaround?
My intension is not realy to use the security module.
So can I switch it off somewhere in the code?

Kind regards,

Peter


Op 15 maart 2012 09:20 schreef zdia <z....@gmx.de> het volgende:

zdia

unread,
Mar 16, 2012, 3:19:33 AM3/16/12
to he...@googlegroups.com


Am 16.03.2012 02:46, schrieb Peter Rainaud:
> BUILD FAILED
> /home/peter/hecl/android/build.xml:179: Compile failed; see the compiler
> error output for details.
>
> Do you have a workaround?
> My intension is not realy to use the security module.
> So can I switch it off somewhere in the code?

Yes, you can.

Look in /hecl/core/org/hecl/Interp.java for the following lines:

    //    System.err.println("loading string cmds...");
    /* String commands. */
    StringCmds.load(this);

    //    System.err.println("loading Gorilla cmds...");
    /* Gorilla commands. */
    GorillaCmds.load(this);

You just have to comment out the loading of the GorillaCmds (to be found in: hecl/core/org/hecl/GorillaCmds.java

    //    System.err.println("loading Gorilla cmds...");
    /* Gorilla commands. */
    // GorillaCmds.load(this);

I thought it would be a good place for application specific Java Hecl commandline commands. If you go on hacking you could add your additional Hecl Java code in a separate file MyApplicationCmds.java and load them here. You can test those (non-Android) extensions conveniently on the commandline with Hecl.jar

friendly regards

Zbigniew


Peter Rainaud

unread,
Mar 17, 2012, 5:33:42 PM3/17/12
to he...@googlegroups.com
Zbigniew,

I commented out the line in interp.java.
The file has indeed changed

I redid an >ant android-reinstall

I'v got the same error

Strange ...

Kind Regards,

Peter

Op 16 maart 2012 08:19 schreef zdia <z....@gmx.de> het volgende:

Peter Rainaud

unread,
Mar 17, 2012, 8:09:05 PM3/17/12
to he...@googlegroups.com
Hi Zbigniew,

It seems the compiler just goes over the files which are available in the directory of
../core/org/hecl/ and tries to compile them. Even when they are not needed.

So I removed the GorillaCmds.java file from the directory.

Now the compiler goes further but I now have the following error:

package org.hecl.files doesn't exist.


    [javac] Compiling 10 source files to /home/peter/hecl/build/android/final
    [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:45: package org.hecl.files does not exist
    [javac] import org.hecl.files.FileCmds;
    [javac]                      ^
    [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:46: package org.hecl.files does not exist
    [javac] import org.hecl.files.HeclFileUtils;
    [javac]                      ^
    [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:47: package org.hecl.files does not exist
    [javac] import org.hecl.files.HeclStreamCmds;
    [javac]                      ^
    [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:171: cannot find symbol
    [javac] symbol  : variable FileCmds
    [javac] location: class org.hecl.android.Hecl
    [javac]   FileCmds.load(interp);
    [javac]   ^
    [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:172: cannot find symbol
    [javac] symbol  : variable HeclStreamCmds
    [javac] location: class org.hecl.android.Hecl
    [javac]   HeclStreamCmds.load(interp);
    [javac]   ^
    [javac] Note: /home/peter/hecl/android/src/org/hecl/android/HeclCallback.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.

    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 5 errors

Kind regards,

Peter


Op 16 maart 2012 08:19 schreef zdia <z....@gmx.de> het volgende:

zdia

unread,
Mar 18, 2012, 4:35:46 AM3/18/12
to he...@googlegroups.com


Am 18.03.2012 01:09, schrieb Peter Rainaud:

> It seems the compiler just goes over the files which are available in the
> directory of
> ../core/org/hecl/ and tries to compile them. Even when they are not needed.

Ok, good to know.


> Now the compiler goes further but I now have the following error:
>
> package org.hecl.files doesn't exist.
>
>
>      [javac] Compiling 10 source files to
> /home/peter/hecl/build/android/final
>      [javac] /home/peter/hecl/android/src/org/hecl/android/Hecl.java:45:
> package org.hecl.files does not exist
>      [javac] import org.hecl.files.FileCmds;
...

Perhaps a path problem. My compiling output concerning the source files is as follows:

[javac] Compiling 44 source files to /home/dia/Projekte/git/hecl/build/android/final

and if I take the verbose command

ant -v android-reinstall > install.log

I see the following files:

 [javac] Files to be compiled:
 [javac]     /home/dia/Projekte/git/hecl/build/android/pre/core/org/hecl/AnonProc.java
 [javac]     /home/dia/Projekte/git/hecl/build/android/pre/core/org/hecl/ClassCommand.java
 [javac]     /home/dia/Projekte/git/hecl/build/android/pre/core/org/hecl/ClassCommandInfo.java
 [javac]     /home/dia/Projekte/git/hecl/build/android/pre/core/org/hecl/CodeThing.java
...

Could you post the ant verbose output concerning the files to be compiled? Then we could see which 10 files ant wants to compile and on which path they are searched.


Peter Rainaud

unread,
Mar 18, 2012, 5:21:51 AM3/18/12
to he...@googlegroups.com
Ok
in attachment to install.log

Kind regards,

Peter

Op 18 maart 2012 09:35 schreef zdia <z....@gmx.de> het volgende:
install.log

zdia

unread,
Mar 18, 2012, 1:14:15 PM3/18/12
to he...@googlegroups.com
In your install log I am missing the target compileAndroidFiles:


In your android/build.xml have to be found these lines:

  <!-- added by z.dia -->
    <target name="compileAndroidFiles"
    description="Compile Android Hecl file support"
    depends="compileAndroid">
    <wtkpreprocess srcdir="files"
      symbols="${android.defines}"
      destdir="${android.pre}/files"/>
    <javac srcdir="${android.pre}/files"
      destdir="${android.build}"
      debug="${hecldebug}">
      <classpath refid="android.coreclasspath"/>
      <classpath refid="classpath"/>
    </javac>
  </target>

You say you have forked my Github repo. Did you checkout to branch android?

Check:

$ git branch
* android
  master

If the output is showing "* master" you will get just David's original Hecl code because I added my commits only to branch android in order not to disturb the master development. Then do:

git checkout android

Then the android/build.xml should show the target compileAndroidFiles and compilation should go on (till the next error :-) )


Peter Rainaud

unread,
Mar 18, 2012, 8:11:29 PM3/18/12
to Hecl
I just replaced the build.xml and now it's working!
compilation went to the finish

I can source a script.hcl from sd-card!

Thanks for the support.
Now I can start my journey in Hecl.

Gradually step by step...

Please continue improving your password gorilla in hecl.
There are million tablets/mobile phones that will be able to run your
scripts.


Kind regards,

Peter



On 18 mrt, 18:14, zdia <z....@gmx.de> wrote:
> In your install log I am missing the target *compileAndroidFiles*:
>
> In your android/build.xml have to be found these lines:
>
>   <!-- added by z.dia -->
>     <target name="compileAndroidFiles"
>     description="Compile Android Hecl file support"
>     depends="compileAndroid">
>     <wtkpreprocess srcdir="files"
>       symbols="${android.defines}"
>       destdir="${android.pre}/files"/>
>     <javac srcdir="${android.pre}/files"
>       destdir="${android.build}"
>       debug="${hecldebug}">
>       <classpath refid="android.coreclasspath"/>
>       <classpath refid="classpath"/>
>     </javac>
>   </target>
>
> You say you have forked my Github repo. Did you checkout to *branch android*
> ?
>
> Check:
>
> $ git branch
> * android
>   master
>
> If the output is showing "** master*" you will get just David's original

zdia

unread,
Mar 19, 2012, 7:21:37 AM3/19/12
to he...@googlegroups.com


Am 19.03.2012 01:11, schrieb Peter Rainaud:
> I just replaced the build.xml and now it's working!
> compilation went to the finish
>
> I can source a script.hcl from sd-card!
>
> Thanks for the support.

You are welcome.


> Please continue improving your password gorilla in hecl.
> There are million tablets/mobile phones that will be able to run your
> scripts.

But if their owners are interested to work with PWGorilla that is another question :-)

Happy hacking!

Zbigniew

Reply all
Reply to author
Forward
0 new messages