Compile asar.coffee to .c
This commit is contained in:
parent
8612ad0459
commit
f905bb64f6
2 changed files with 70 additions and 1 deletions
29
atom.gyp
29
atom.gyp
|
@ -41,7 +41,6 @@
|
||||||
'atom/common/api/lib/original-fs.coffee',
|
'atom/common/api/lib/original-fs.coffee',
|
||||||
'atom/common/api/lib/shell.coffee',
|
'atom/common/api/lib/shell.coffee',
|
||||||
'atom/common/lib/init.coffee',
|
'atom/common/lib/init.coffee',
|
||||||
'atom/common/lib/asar.coffee',
|
|
||||||
'atom/renderer/lib/chrome-api.coffee',
|
'atom/renderer/lib/chrome-api.coffee',
|
||||||
'atom/renderer/lib/init.coffee',
|
'atom/renderer/lib/init.coffee',
|
||||||
'atom/renderer/lib/inspector.coffee',
|
'atom/renderer/lib/inspector.coffee',
|
||||||
|
@ -55,6 +54,9 @@
|
||||||
'atom/renderer/api/lib/screen.coffee',
|
'atom/renderer/api/lib/screen.coffee',
|
||||||
'atom/renderer/api/lib/web-frame.coffee',
|
'atom/renderer/api/lib/web-frame.coffee',
|
||||||
],
|
],
|
||||||
|
'coffee2c_sources': [
|
||||||
|
'atom/common/lib/asar.coffee',
|
||||||
|
],
|
||||||
'lib_sources': [
|
'lib_sources': [
|
||||||
'atom/app/atom_content_client.cc',
|
'atom/app/atom_content_client.cc',
|
||||||
'atom/app/atom_content_client.h',
|
'atom/app/atom_content_client.h',
|
||||||
|
@ -333,6 +335,7 @@
|
||||||
'chromium_src/library_loaders/libspeechd_loader.cc',
|
'chromium_src/library_loaders/libspeechd_loader.cc',
|
||||||
'chromium_src/library_loaders/libspeechd.h',
|
'chromium_src/library_loaders/libspeechd.h',
|
||||||
'<@(native_mate_files)',
|
'<@(native_mate_files)',
|
||||||
|
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
|
||||||
],
|
],
|
||||||
'lib_sources_win': [
|
'lib_sources_win': [
|
||||||
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc',
|
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc',
|
||||||
|
@ -524,6 +527,7 @@
|
||||||
'target_name': '<(project_name)_lib',
|
'target_name': '<(project_name)_lib',
|
||||||
'type': 'static_library',
|
'type': 'static_library',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
'atom_coffee2c',
|
||||||
'vendor/brightray/brightray.gyp:brightray',
|
'vendor/brightray/brightray.gyp:brightray',
|
||||||
'vendor/node/node.gyp:node_lib',
|
'vendor/node/node.gyp:node_lib',
|
||||||
],
|
],
|
||||||
|
@ -542,6 +546,8 @@
|
||||||
'chromium_src',
|
'chromium_src',
|
||||||
'vendor/brightray',
|
'vendor/brightray',
|
||||||
'vendor/native_mate',
|
'vendor/native_mate',
|
||||||
|
# Include atom_natives.h.
|
||||||
|
'<(SHARED_INTERMEDIATE_DIR)',
|
||||||
# Include directories for uv and node.
|
# Include directories for uv and node.
|
||||||
'vendor/node/src',
|
'vendor/node/src',
|
||||||
'vendor/node/deps/http_parser',
|
'vendor/node/deps/http_parser',
|
||||||
|
@ -650,6 +656,27 @@
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, # target compile_coffee
|
}, # target compile_coffee
|
||||||
|
{
|
||||||
|
'target_name': 'atom_coffee2c',
|
||||||
|
'type': 'none',
|
||||||
|
'actions': [
|
||||||
|
{
|
||||||
|
'action_name': 'atom_coffee2c',
|
||||||
|
'inputs': [
|
||||||
|
'<@(coffee2c_sources)',
|
||||||
|
],
|
||||||
|
'outputs': [
|
||||||
|
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
|
||||||
|
],
|
||||||
|
'action': [
|
||||||
|
'python',
|
||||||
|
'tools/coffee2c.py',
|
||||||
|
'<@(_outputs)',
|
||||||
|
'<@(_inputs)',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}, # target atom_coffee2c
|
||||||
{
|
{
|
||||||
'target_name': '<(project_name)_dump_symbols',
|
'target_name': '<(project_name)_dump_symbols',
|
||||||
'type': 'none',
|
'type': 'none',
|
||||||
|
|
42
tools/coffee2c.py
Executable file
42
tools/coffee2c.py
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
natives = sys.argv[1]
|
||||||
|
coffee_source_files = sys.argv[2:]
|
||||||
|
|
||||||
|
output_dir = os.path.dirname(natives)
|
||||||
|
js_source_files = compile_coffee(coffee_source_files, output_dir)
|
||||||
|
call_js2c(natives, js_source_files)
|
||||||
|
|
||||||
|
|
||||||
|
def compile_coffee(coffee_source_files, output_dir):
|
||||||
|
js_source_files = []
|
||||||
|
for source_file in coffee_source_files:
|
||||||
|
output_filename = os.path.splitext(source_file)[0] + '.js'
|
||||||
|
output_path = os.path.join(output_dir, output_filename)
|
||||||
|
js_source_files.append(output_path)
|
||||||
|
call_compile_coffee(source_file, output_path)
|
||||||
|
return js_source_files
|
||||||
|
|
||||||
|
|
||||||
|
def call_compile_coffee(source_file, output_filename):
|
||||||
|
compile_coffee = os.path.join(SOURCE_ROOT, 'tools', 'compile-coffee.py')
|
||||||
|
subprocess.check_call([sys.executable, compile_coffee, source_file,
|
||||||
|
output_filename])
|
||||||
|
|
||||||
|
|
||||||
|
def call_js2c(natives, js_source_files):
|
||||||
|
js2c = os.path.join(SOURCE_ROOT, 'vendor', 'node', 'tools', 'js2c.py')
|
||||||
|
subprocess.check_call([sys.executable, js2c, natives] + js_source_files)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
Loading…
Reference in a new issue