electron/build/js2c.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
687 B
Python
Raw Normal View History

2015-02-04 00:46:52 +00:00
#!/usr/bin/env python
import os
import subprocess
import sys
TEMPLATE = """
#include "node_native_module.h"
#include "node_internals.h"
namespace node {{
namespace native_module {{
{definitions}
void NativeModuleLoader::LoadEmbedderJavaScriptSource() {{
{initializers}
}}
}} // namespace native_module
}} // namespace node
"""
2015-02-04 00:46:52 +00:00
def main():
node_path = os.path.abspath(sys.argv[1])
natives = os.path.abspath(sys.argv[2])
js_source_files = sys.argv[3:]
2015-02-04 00:46:52 +00:00
js2c = os.path.join(node_path, 'tools', 'js2c.py')
subprocess.check_call(
[sys.executable, js2c] +
js_source_files +
['--only-js', '--target', natives])
2015-02-04 00:46:52 +00:00
if __name__ == '__main__':
sys.exit(main())