Fork of avatar-js
Go to file
2013-11-11 14:11:31 -08:00
crypto move source here from internal repo 2013-09-27 16:05:37 -07:00
patches Fix for AVATAR_JS-44, uv blocking queue and IdleHandle for bg events 2013-10-30 17:18:23 +01:00
src start work on domains by enabling them 2013-11-11 14:09:19 -08:00
.gitignore ignore file copied during setup 2013-11-11 14:11:31 -08:00
avatar-js.gyp AVATAR_JS-20: add unicode defines for the avatar-js windows build. 2013-10-14 15:35:26 -07:00
build.xml enable working pummel tests 2013-11-11 11:42:11 -08:00
common.xml also clean log and test temp files 2013-10-17 12:12:15 -07:00
CONTRIBUTORS move source here from internal repo 2013-09-27 16:05:37 -07:00
LICENSE move source here from internal repo 2013-09-27 16:05:37 -07:00
project.properties start work on domains by enabling them 2013-11-11 14:09:19 -08:00
README 1: do not install any signal handlers by default to avoid conflicts with the jvm 2013-10-14 11:18:30 -07:00
THIRD_PARTY_README move source here from internal repo 2013-09-27 16:05:37 -07:00

Build Instructions

1. Install jdk8, ant and python
   a) Install the latest jdk8 build from http://jdk8.java.net/download.html
   b) Ensure ant is installed and ant --version is 1.8+
   c) Ensure python is installed and python --version is 2.7.5+

2. Download node.js
   a) git clone https://github.com/joyent/node.git source
   b) cd source
   c) git checkout v0.10.18
      (do 'git pull' to refresh repo if you get an error saying this version is unknown)

3. Clone dependencies
   a) git clone git://java.net/avatar-js~libuv-java libuv-java (read-only)
      git clone ssh://<id>@git.java.net/avatar-js~libuv-java libuv-java

   b) git clone git://java.net/avatar-js~http-parser-java http-parser-java (read-only)
      git clone ssh://<id>@git.java.net/avatar-js~http-parser-java http-parser-java

   c) git clone git://java.net/avatar-js~src avatar-js (read-only)
      git clone ssh://<id>@git.java.net/avatar-js~src avatar-js

   d) Download testng from http://testng.org/doc/download.html
      unzip bundle and place testng.jar somewhere in your workspace

3. Edit ~/.avatar-js.properties to set various locations, for example

   source.home = /ws/source (from 2a)
   libuv.home = /ws/libuv-java (from 3a)
   http-parser.home = /ws/http-parser-java (from 3b)
   avatar-js.home = /ws/avatar-js (from 3c)
   testng.jar = /ws/lib/testng.jar (from 3d)

4. Setup environment so that native libraries can be found
   cd avatar-js
   export LD_LIBRARY_PATH=$PWD/dist:$LD_LIBRARY_PATH (linux)
   export DYLD_LIBRARY_PATH=$PWD/dist:$DYLD_LIBRARY_PATH (mac)
   export PATH=%CWD%/dist;%PATH% (windows)

5. Configure
   a) ant setup

6. Build - ensure jdk8 and appropriate c++ compiler is in PATH
   a) ant jar-all
   b) ant clean-all (to clean project and dependencies)
   c) ant -Dbuild.type=Release jar-all (to build Release configuration)

7. Test
   a) java -jar dist/avatar-js.jar src/test/js/test-runner.js test/simple/
      (test-runner.js supports many options, look at source for help)

8. Running applications
   java -jar dist/avatar-js.jar app.js

Limitations and Gotchas

1. Platforms tested
   a) Ubuntu Linux x64
   b) Mac OS X Mountain Lion
   c) Windows 7 & 8 x64

2. Dependencies
   Requires a recent build of jdk8 (b108+)

3. Globals - some additional globals are exposed
   a) context of type ScriptContext [http://download.java.net/jdk8/docs/api/javax/script/ScriptContext.html]
   b) __avatar (non-iterable) container for some avatar-specific globals

4. Limitations of the vm module
   Objects loaded in a new context and accessed from the current context have some strong limitations -
   a) Only a subset of JavaScript API is available on these objects
   b) equality (==, ===) will not work as expected

5. Limitations on __proto__
   a) __proto__ cannot be set to undefined
      affects the ejs module used by express

6. No const keyword
   a) the const keyword is not supported, replace with var
      affects the mongodb and grunt modules

7. No signal handlers installed by default
   some generate EINVAL (invalid argument)
   and the JVM installs some of its own and we do not want to cause conflicts
   an app can install signal handlers as needed using
      process.signals.start('SIGUSR1');
   or
     process.signals.start(43);