Fork of avatar-js
Go to file
Kinsley Wong 8a2eb3d13c Add test-repl-domain.js unit test
Reviewed-by: asquare
2013-12-10 10:57:51 -08:00
crypto move source here from internal repo 2013-09-27 16:05:37 -07:00
patches Fix for AVATAR_JS-108, avoid leaking sys prop, load repl in privileged block 2013-12-10 19:08:32 +01:00
src Fix for AVATAR_JS-108, avoid leaking sys prop, load repl in privileged block 2013-12-10 19:08:32 +01:00
.gitignore Add repl.js to .gitignore 2013-12-09 14:09:12 -08: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
README clarify that python3 does not work 2013-12-09 16:04:01 -08:00
THIRD_PARTY_README move source here from internal repo 2013-09-27 16:05:37 -07:00
avatar-js.gyp Use the current directory for the source files. Fixes mac builds. 2013-11-25 14:01:50 -08:00
build.xml 105: patch test-repl-tab-complete.js because console is undefined in nashorn. 2013-12-09 13:54:29 -08:00
common.xml upgrade to v0.10.22 (latest stable) 2013-12-06 16:29:39 -08:00 Add test-repl-domain.js unit test 2013-12-10 10:57:51 -08:00


Build Instructions

1. Install jdk8, ant and python
   a) Install the latest jdk8 build from (b119+)
   b) Ensure ant is installed and ant -version is 1.8+
   c) Ensure python is installed and python --version is 2.7.5+ (python3 does not work)

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

3. Clone dependencies (<id> is your id)
   (Strongly recommend that all dependencies be cloned at the same level as node.js)

   a) git clone git:// libuv-java (read-only)
      git clone ssh://<id> libuv-java

   b) git clone git:// http-parser-java (read-only)
      git clone ssh://<id> http-parser-java

   c) git clone git:// avatar-js (read-only)
      git clone ssh://<id> avatar-js

   d) Download test-ng from
      unzip bundle and place testng.jar somewhere in your workspace

4. Edit ~/ to set various locations 
   (Ensure that there is no trailing slash after a property value), 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)

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

6. Configure
   a) ant setup

7. Build - ensure ant, jdk8 and appropriate c++ compiler/linker 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)

8. Test
   a) might need to set LANG=en_US.UTF-8
   b) Some crypto tests require 
      Java Cryptography Extension Unlimited Jurisdiction Policy Files
      to be installed from
      follow the instructions in the download, files for Java7 work in Java8
   c) 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)
   d) java -jar dist/avatar-js.jar src/test/js/test-runner.js test/crypto/
   e) java -jar dist/avatar-js.jar src/test/js/test-runner.js -timeout 180 test/pummel/

9. 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 []
   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)
   the JVM installs some of its own and we do not want to cause conflicts
   an app can install signal handlers as needed using