зеркало из https://github.com/electron/electron.git
Convert gyp targets to use JavaScript
This commit is contained in:
Родитель
ddfe4809e7
Коммит
088a39ea9d
24
atom.gyp
24
atom.gyp
|
@ -28,7 +28,7 @@
|
|||
'target_name': '<(project_name)',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'compile_coffee',
|
||||
'js2asar',
|
||||
'<(project_name)_lib',
|
||||
],
|
||||
'sources': [
|
||||
|
@ -221,7 +221,7 @@
|
|||
'target_name': '<(project_name)_lib',
|
||||
'type': 'static_library',
|
||||
'dependencies': [
|
||||
'atom_coffee2c',
|
||||
'atom_js2c',
|
||||
'vendor/brightray/brightray.gyp:brightray',
|
||||
'vendor/node/node.gyp:node',
|
||||
],
|
||||
|
@ -351,11 +351,11 @@
|
|||
],
|
||||
}, # target <(product_name)_lib
|
||||
{
|
||||
'target_name': 'compile_coffee',
|
||||
'target_name': 'js2asar',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'compile_coffee',
|
||||
'action_name': 'js2asar',
|
||||
'variables': {
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
|
@ -366,41 +366,41 @@
|
|||
],
|
||||
},
|
||||
'inputs': [
|
||||
'<@(coffee_sources)',
|
||||
'<@(js_sources)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(resources_path)/atom.asar',
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'tools/coffee2asar.py',
|
||||
'tools/js2asar.py',
|
||||
'<@(_outputs)',
|
||||
'<@(_inputs)',
|
||||
],
|
||||
}
|
||||
],
|
||||
}, # target compile_coffee
|
||||
}, # target js2asar
|
||||
{
|
||||
'target_name': 'atom_coffee2c',
|
||||
'target_name': 'atom_js2c',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'atom_coffee2c',
|
||||
'action_name': 'atom_js2c',
|
||||
'inputs': [
|
||||
'<@(coffee2c_sources)',
|
||||
'<@(js2c_sources)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'tools/coffee2c.py',
|
||||
'tools/js2c.py',
|
||||
'<@(_outputs)',
|
||||
'<@(_inputs)',
|
||||
],
|
||||
}
|
||||
],
|
||||
}, # target atom_coffee2c
|
||||
}, # target atom_js2c
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
|
|
114
filenames.gypi
114
filenames.gypi
|
@ -7,64 +7,64 @@
|
|||
'bundle_sources': [
|
||||
'atom/browser/resources/mac/atom.icns',
|
||||
],
|
||||
'coffee_sources': [
|
||||
'atom/browser/api/lib/app.coffee',
|
||||
'atom/browser/api/lib/auto-updater.coffee',
|
||||
'atom/browser/api/lib/auto-updater/auto-updater-native.coffee',
|
||||
'atom/browser/api/lib/auto-updater/auto-updater-win.coffee',
|
||||
'atom/browser/api/lib/auto-updater/squirrel-update-win.coffee',
|
||||
'atom/browser/api/lib/browser-window.coffee',
|
||||
'atom/browser/api/lib/content-tracing.coffee',
|
||||
'atom/browser/api/lib/dialog.coffee',
|
||||
'atom/browser/api/lib/exports/electron.coffee',
|
||||
'atom/browser/api/lib/global-shortcut.coffee',
|
||||
'atom/browser/api/lib/ipc.coffee',
|
||||
'atom/browser/api/lib/ipc-main.coffee',
|
||||
'atom/browser/api/lib/menu.coffee',
|
||||
'atom/browser/api/lib/menu-item.coffee',
|
||||
'atom/browser/api/lib/navigation-controller.coffee',
|
||||
'atom/browser/api/lib/power-monitor.coffee',
|
||||
'atom/browser/api/lib/power-save-blocker.coffee',
|
||||
'atom/browser/api/lib/protocol.coffee',
|
||||
'atom/browser/api/lib/session.coffee',
|
||||
'atom/browser/api/lib/screen.coffee',
|
||||
'atom/browser/api/lib/tray.coffee',
|
||||
'atom/browser/api/lib/web-contents.coffee',
|
||||
'atom/browser/lib/chrome-extension.coffee',
|
||||
'atom/browser/lib/desktop-capturer.coffee',
|
||||
'atom/browser/lib/guest-view-manager.coffee',
|
||||
'atom/browser/lib/guest-window-manager.coffee',
|
||||
'atom/browser/lib/init.coffee',
|
||||
'atom/browser/lib/objects-registry.coffee',
|
||||
'atom/browser/lib/rpc-server.coffee',
|
||||
'atom/common/api/lib/callbacks-registry.coffee',
|
||||
'atom/common/api/lib/clipboard.coffee',
|
||||
'atom/common/api/lib/crash-reporter.coffee',
|
||||
'atom/common/api/lib/deprecate.coffee',
|
||||
'atom/common/api/lib/exports/electron.coffee',
|
||||
'atom/common/api/lib/native-image.coffee',
|
||||
'atom/common/api/lib/shell.coffee',
|
||||
'atom/common/lib/init.coffee',
|
||||
'atom/common/lib/reset-search-paths.coffee',
|
||||
'atom/renderer/lib/chrome-api.coffee',
|
||||
'atom/renderer/lib/init.coffee',
|
||||
'atom/renderer/lib/inspector.coffee',
|
||||
'atom/renderer/lib/override.coffee',
|
||||
'atom/renderer/lib/web-view/guest-view-internal.coffee',
|
||||
'atom/renderer/lib/web-view/web-view.coffee',
|
||||
'atom/renderer/lib/web-view/web-view-attributes.coffee',
|
||||
'atom/renderer/lib/web-view/web-view-constants.coffee',
|
||||
'atom/renderer/api/lib/desktop-capturer.coffee',
|
||||
'atom/renderer/api/lib/exports/electron.coffee',
|
||||
'atom/renderer/api/lib/ipc.coffee',
|
||||
'atom/renderer/api/lib/ipc-renderer.coffee',
|
||||
'atom/renderer/api/lib/remote.coffee',
|
||||
'atom/renderer/api/lib/screen.coffee',
|
||||
'atom/renderer/api/lib/web-frame.coffee',
|
||||
'js_sources': [
|
||||
'atom/browser/api/lib/app.js',
|
||||
'atom/browser/api/lib/auto-updater.js',
|
||||
'atom/browser/api/lib/auto-updater/auto-updater-native.js',
|
||||
'atom/browser/api/lib/auto-updater/auto-updater-win.js',
|
||||
'atom/browser/api/lib/auto-updater/squirrel-update-win.js',
|
||||
'atom/browser/api/lib/browser-window.js',
|
||||
'atom/browser/api/lib/content-tracing.js',
|
||||
'atom/browser/api/lib/dialog.js',
|
||||
'atom/browser/api/lib/exports/electron.js',
|
||||
'atom/browser/api/lib/global-shortcut.js',
|
||||
'atom/browser/api/lib/ipc.js',
|
||||
'atom/browser/api/lib/ipc-main.js',
|
||||
'atom/browser/api/lib/menu.js',
|
||||
'atom/browser/api/lib/menu-item.js',
|
||||
'atom/browser/api/lib/navigation-controller.js',
|
||||
'atom/browser/api/lib/power-monitor.js',
|
||||
'atom/browser/api/lib/power-save-blocker.js',
|
||||
'atom/browser/api/lib/protocol.js',
|
||||
'atom/browser/api/lib/session.js',
|
||||
'atom/browser/api/lib/screen.js',
|
||||
'atom/browser/api/lib/tray.js',
|
||||
'atom/browser/api/lib/web-contents.js',
|
||||
'atom/browser/lib/chrome-extension.js',
|
||||
'atom/browser/lib/desktop-capturer.js',
|
||||
'atom/browser/lib/guest-view-manager.js',
|
||||
'atom/browser/lib/guest-window-manager.js',
|
||||
'atom/browser/lib/init.js',
|
||||
'atom/browser/lib/objects-registry.js',
|
||||
'atom/browser/lib/rpc-server.js',
|
||||
'atom/common/api/lib/callbacks-registry.js',
|
||||
'atom/common/api/lib/clipboard.js',
|
||||
'atom/common/api/lib/crash-reporter.js',
|
||||
'atom/common/api/lib/deprecate.js',
|
||||
'atom/common/api/lib/exports/electron.js',
|
||||
'atom/common/api/lib/native-image.js',
|
||||
'atom/common/api/lib/shell.js',
|
||||
'atom/common/lib/init.js',
|
||||
'atom/common/lib/reset-search-paths.js',
|
||||
'atom/renderer/lib/chrome-api.js',
|
||||
'atom/renderer/lib/init.js',
|
||||
'atom/renderer/lib/inspector.js',
|
||||
'atom/renderer/lib/override.js',
|
||||
'atom/renderer/lib/web-view/guest-view-internal.js',
|
||||
'atom/renderer/lib/web-view/web-view.js',
|
||||
'atom/renderer/lib/web-view/web-view-attributes.js',
|
||||
'atom/renderer/lib/web-view/web-view-constants.js',
|
||||
'atom/renderer/api/lib/desktop-capturer.js',
|
||||
'atom/renderer/api/lib/exports/electron.js',
|
||||
'atom/renderer/api/lib/ipc.js',
|
||||
'atom/renderer/api/lib/ipc-renderer.js',
|
||||
'atom/renderer/api/lib/remote.js',
|
||||
'atom/renderer/api/lib/screen.js',
|
||||
'atom/renderer/api/lib/web-frame.js',
|
||||
],
|
||||
'coffee2c_sources': [
|
||||
'atom/common/lib/asar.coffee',
|
||||
'atom/common/lib/asar_init.coffee',
|
||||
'js2c_sources': [
|
||||
'atom/common/lib/asar.js',
|
||||
'atom/common/lib/asar_init.js',
|
||||
],
|
||||
'lib_sources': [
|
||||
'atom/app/atom_content_client.cc',
|
||||
|
|
|
@ -12,27 +12,12 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
|||
|
||||
def main():
|
||||
archive = sys.argv[1]
|
||||
coffee_source_files = sys.argv[2:]
|
||||
|
||||
output_dir = tempfile.mkdtemp()
|
||||
compile_coffee(coffee_source_files, output_dir)
|
||||
call_asar(archive, output_dir)
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
|
||||
def compile_coffee(coffee_source_files, output_dir):
|
||||
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)
|
||||
call_compile_coffee(source_file, output_path)
|
||||
|
||||
|
||||
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_asar(archive, output_dir):
|
||||
js_dir = os.path.join(output_dir, 'atom')
|
||||
asar = os.path.join(SOURCE_ROOT, 'node_modules', 'asar', 'bin', 'asar')
|
|
@ -11,29 +11,11 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|||
|
||||
def main():
|
||||
natives = os.path.abspath(sys.argv[1])
|
||||
coffee_source_files = sys.argv[2:]
|
||||
js_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')
|
||||
src_dir = os.path.dirname(js_source_files[0])
|
Загрузка…
Ссылка в новой задаче