Add separate run script just to rebuild test modules
This commit is contained in:
parent
24f0813ef1
commit
90964290a6
3 changed files with 74 additions and 32 deletions
|
@ -27,6 +27,7 @@
|
||||||
"browserify": "browserify",
|
"browserify": "browserify",
|
||||||
"bump-version": "./script/bump-version.py",
|
"bump-version": "./script/bump-version.py",
|
||||||
"build": "python ./script/build.py -c D",
|
"build": "python ./script/build.py -c D",
|
||||||
|
"rebuild-test-modules": "python ./script/rebuild-test-modules.py",
|
||||||
"clean": "python ./script/clean.py",
|
"clean": "python ./script/clean.py",
|
||||||
"clean-build": "python ./script/clean.py --build",
|
"clean-build": "python ./script/clean.py --build",
|
||||||
"coverage": "npm run instrument-code-coverage && npm test -- --use_instrumented_asar",
|
"coverage": "npm run instrument-code-coverage && npm test -- --use_instrumented_asar",
|
||||||
|
|
64
script/rebuild-test-modules.py
Executable file
64
script/rebuild-test-modules.py
Executable file
|
@ -0,0 +1,64 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from lib.config import PLATFORM, enable_verbose_mode, get_target_arch
|
||||||
|
from lib.util import execute_stdout, get_electron_version, safe_mkdir, \
|
||||||
|
update_node_modules, update_electron_modules
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.chdir(SOURCE_ROOT)
|
||||||
|
|
||||||
|
args = parse_args()
|
||||||
|
config = args.configuration
|
||||||
|
|
||||||
|
if args.verbose:
|
||||||
|
enable_verbose_mode()
|
||||||
|
|
||||||
|
spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
|
||||||
|
out_dir = os.path.join(SOURCE_ROOT, 'out', config)
|
||||||
|
version = get_electron_version()
|
||||||
|
node_dir = os.path.join(out_dir, 'node-{0}'.format(version))
|
||||||
|
|
||||||
|
# Create node headers
|
||||||
|
script_path = os.path.join(SOURCE_ROOT, 'script', 'create-node-headers.py')
|
||||||
|
execute_stdout([sys.executable, script_path, '--version', version,
|
||||||
|
'--directory', out_dir])
|
||||||
|
|
||||||
|
if PLATFORM == 'win32':
|
||||||
|
lib_dir = os.path.join(node_dir, 'Release')
|
||||||
|
safe_mkdir(lib_dir)
|
||||||
|
iojs_lib = os.path.join(lib_dir, 'iojs.lib')
|
||||||
|
atom_lib = os.path.join(out_dir, 'node.dll.lib')
|
||||||
|
shutil.copy2(atom_lib, iojs_lib)
|
||||||
|
|
||||||
|
# Native modules can only be compiled against release builds on Windows
|
||||||
|
if config == 'R' or PLATFORM != 'win32':
|
||||||
|
update_electron_modules(os.path.dirname(spec_modules), get_target_arch(),
|
||||||
|
node_dir)
|
||||||
|
else:
|
||||||
|
update_node_modules(os.path.dirname(spec_modules))
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser(description='Rebuild native test modules')
|
||||||
|
parser.add_argument('-v', '--verbose',
|
||||||
|
action='store_true',
|
||||||
|
help='Prints the output of the subprocesses')
|
||||||
|
parser.add_argument('-c', '--configuration',
|
||||||
|
help='Build configuration to rebuild modules against',
|
||||||
|
default='D',
|
||||||
|
required=False)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
|
@ -6,9 +6,8 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from lib.config import PLATFORM, enable_verbose_mode, get_target_arch
|
from lib.config import enable_verbose_mode
|
||||||
from lib.util import electron_gyp, execute, get_electron_version, rm_rf, \
|
from lib.util import electron_gyp, execute_stdout, rm_rf
|
||||||
safe_mkdir, update_node_modules, update_electron_modules
|
|
||||||
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
@ -28,7 +27,7 @@ def main():
|
||||||
|
|
||||||
spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
|
spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
|
||||||
if args.rebuild_native_modules or not os.path.isdir(spec_modules):
|
if args.rebuild_native_modules or not os.path.isdir(spec_modules):
|
||||||
rebuild_native_modules(config, spec_modules)
|
rebuild_native_modules(args.verbose, config)
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
electron = os.path.join(SOURCE_ROOT, 'out', config,
|
electron = os.path.join(SOURCE_ROOT, 'out', config,
|
||||||
|
@ -110,34 +109,12 @@ def restore_uninstrumented_asar_file(resources_path):
|
||||||
shutil.move(uninstrumented_path, asar_path)
|
shutil.move(uninstrumented_path, asar_path)
|
||||||
|
|
||||||
|
|
||||||
def run_python_script(script, *args):
|
def rebuild_native_modules(verbose, configuration):
|
||||||
script_path = os.path.join(SOURCE_ROOT, 'script', script)
|
script_path = os.path.join(SOURCE_ROOT, 'script', 'rebuild-test-modules.py')
|
||||||
return execute([sys.executable, script_path] + list(args))
|
args = ['--configuration', configuration]
|
||||||
|
if verbose:
|
||||||
|
args += ['--verbose']
|
||||||
def rebuild_native_modules(config, modules_path):
|
execute_stdout([sys.executable, script_path] + args)
|
||||||
out_dir = os.path.join(SOURCE_ROOT, 'out', config)
|
|
||||||
version = get_electron_version()
|
|
||||||
node_dir = os.path.join(out_dir, 'node-{0}'.format(version))
|
|
||||||
|
|
||||||
run_python_script('create-node-headers.py',
|
|
||||||
'--version', version,
|
|
||||||
'--directory', out_dir)
|
|
||||||
|
|
||||||
if PLATFORM == 'win32':
|
|
||||||
lib_dir = os.path.join(node_dir, 'Release')
|
|
||||||
safe_mkdir(lib_dir)
|
|
||||||
iojs_lib = os.path.join(lib_dir, 'iojs.lib')
|
|
||||||
atom_lib = os.path.join(out_dir, 'node.dll.lib')
|
|
||||||
shutil.copy2(atom_lib, iojs_lib)
|
|
||||||
|
|
||||||
# Native modules can only be compiled against release builds on Windows
|
|
||||||
if config == 'R' or PLATFORM != 'win32':
|
|
||||||
update_electron_modules(os.path.dirname(modules_path), get_target_arch(),
|
|
||||||
node_dir)
|
|
||||||
else:
|
|
||||||
update_node_modules(os.path.dirname(modules_path))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue