mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Convert gyp targets to use JavaScript
This commit is contained in:
@@ -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])
|
||||
Reference in New Issue
Block a user