Skip to content

Packs Android-native-Rebol with a WASM-Rebol Web Console into an .APK

License

Notifications You must be signed in to change notification settings

metaeducation/rebol-server

Repository files navigation

rebol-server

This repository contains bash scripts for creating a small Android .APK package, that bundles an ARM-based Rebol interpreter "Ren-C branch") with a very tiny web server (implemented in Rebol).

Then it also includes a second Rebol interpreter, which is compiled to WebAssembly...plus a cache of a web-based interactive console called Replpad-JS.

Rebol interpreters pride themselves on being small--so it's not a big deal to have two of them in the package. But...why, especially considering that you can simply run ReplPad-JS from the network using the phone's native browser?

Because:

  • When the phone itself is serving the HTML, JS, and WebAssembly for the console, it can be used even when the phone is offline.

  • There is a kind of an "app store" concept--where GitHub repositories containing other interesting Rebol code besides the console can be downloaded and cached locally as well.

  • The Android-native interpreter that is doing the local serving can act as a backchannel for capabilities that an ordinary website couldn't do. Examples would be reading or writing files from the phone's internal storage, or fetching URLs that are not CORS-enabled.

(Note: Since such backchannels can ultimately represent security risks, use good judgment--as you would with any programming tool--when it comes to running code from untrusted sources!!!)

Building the .APK

You should be able to run the bash scripts on pretty much any Linux. But they are designed to be able to run even on something like Termux, so you can even build the .APK on the phone itself!!

The scripts just pull down the latest executable from Ren-C's Travis, so there's no need to do any C compilation of Rebol itself on the phone (although you certainly can!).

So really the main thing to do is make sure you have the right Android packing tools installed. You'll need to apt install the following:

  • zip
  • curl
  • aapt
  • javac or ecj
  • zipalign (Termux: it's packaged with aapt)
  • dx (Termux) or dalvik-exchange (Debian/Ubuntu)
  • apksigner

(Note: in Termux/32bit apksigner may be broken; then install the old version)

If all those dependencies are in place, you can run bash build.bash and it should "just work". If not, please raise an issue:

https://github.com/metaeducation/rebol-server/issues

License

  • Rebol 3 (including the Ren-C branch) is covered by the Apache 2 License
  • The Rebol JavaScript extension is covered by the LGPL 3.0
  • ReplPad-JS is also LGPL 3.0.

The rebol-server packaging code is Copyright (c) 2019 by Giulio Lunati, and is another LGPL 3.0 project.

Any "apps" that are cached and interact with the rebol-server are governed by whatever license they state.

Future Directions

It would be nice if the bash scripts were ported to Rebol. :-) It would also be good if the packaging process didn't need to depend on Java or other languages. (So having something like a %jarsigner.reb.)

Right now, the Android build of Rebol is really just a typical POSIX target. So the number of "superpowers" it is able to grant to the web app are pretty much limited to local file access--as well as more generalized network access than is available to the average website.

However...it would be possible to create "extensions" that would use APIs from the Android NDK. That would permit the Rebol webserver to do things like take pictures, or read the GPS, or whatever.

One area that is not likely to be of much interest (to the core Rebol/Ren-C developers) is trying to work with native Android GUI widgets. That's because the aim of this project is largely to embrace the trend toward browser-based development, and "Progressive Web Apps":

https://en.wikipedia.org/wiki/Progressive_web_applications

...but the hope is to try doing so with a WebAssembly-based Rebol playing a big role in that picture!

About

Packs Android-native-Rebol with a WASM-Rebol Web Console into an .APK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published