From 7a69fe7922e4a4b317c7bdcc9672f98ce3006c2a Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Tue, 21 Jul 2015 21:44:07 +0300 Subject: [PATCH] Use node externs Fixes #3230 --- AUTHORS | 2 +- tools/shared.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 61137ea05..a59b5f91f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -201,4 +201,4 @@ a license to everyone to use it as detailed in LICENSE.) * Haofeng Zhang * Cody Welsh * Hoong Ern Ng - +* Kagami Hiiragi diff --git a/tools/shared.py b/tools/shared.py index 8bb77aae0..630dc08c1 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1587,6 +1587,10 @@ class Building: raise Exception('Closure compiler appears to be missing, looked at: ' + str(CLOSURE_COMPILER)) CLOSURE_EXTERNS = path_from_root('src', 'closure-externs.js') + NODE_EXTERNS_BASE = path_from_root('third_party', 'closure-compiler', 'node-externs') + NODE_EXTERNS = os.listdir(NODE_EXTERNS_BASE) + NODE_EXTERNS = [os.path.join(NODE_EXTERNS_BASE, name) for name in NODE_EXTERNS + if name.endswith('.js')] # Something like this (adjust memory as needed): # java -Xmx1024m -jar CLOSURE_COMPILER --compilation_level ADVANCED_OPTIMIZATIONS --variable_map_output_file src.cpp.o.js.vars --js src.cpp.o.js --js_output_file src.cpp.o.cc.js @@ -1598,6 +1602,9 @@ class Building: '--externs', CLOSURE_EXTERNS, #'--variable_map_output_file', filename + '.vars', '--js', filename, '--js_output_file', filename + '.cc.js'] + for extern in NODE_EXTERNS: + args.append('--externs') + args.append(extern) if pretty: args += ['--formatting', 'PRETTY_PRINT'] if os.environ.get('EMCC_CLOSURE_ARGS'): args += shlex.split(os.environ.get('EMCC_CLOSURE_ARGS'))