Add option to rebuild test modules before running
This commit is contained in:
parent
54f4644660
commit
9971f0d54c
1 changed files with 39 additions and 1 deletions
|
@ -6,7 +6,9 @@ import shutil
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.util import electron_gyp, rm_rf
|
||||
from lib.config import PLATFORM, enable_verbose_mode, get_target_arch
|
||||
from lib.util import electron_gyp, execute, get_electron_version, rm_rf, \
|
||||
update_electron_modules
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
@ -21,6 +23,14 @@ def main():
|
|||
args = parse_args()
|
||||
config = args.configuration
|
||||
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
|
||||
spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
|
||||
if args.rebuild_native_modules or not os.path.isdir(spec_modules):
|
||||
rebuild_native_modules(spec_modules,
|
||||
os.path.join(SOURCE_ROOT, 'out', config))
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', config,
|
||||
'{0}.app'.format(PRODUCT_NAME), 'Contents',
|
||||
|
@ -65,6 +75,13 @@ def parse_args():
|
|||
help='Run tests with coverage instructed asar file',
|
||||
action='store_true',
|
||||
required=False)
|
||||
parser.add_argument('--rebuild_native_modules',
|
||||
help='Rebuild native modules used by specs',
|
||||
action='store_true',
|
||||
required=False)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
parser.add_argument('-c', '--configuration',
|
||||
help='Build configuration to run tests against',
|
||||
default='D',
|
||||
|
@ -90,5 +107,26 @@ def restore_uninstrumented_asar_file(resources_path):
|
|||
shutil.move(uninstrumented_path, asar_path)
|
||||
|
||||
|
||||
def run_python_script(script, *args):
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', script)
|
||||
return execute([sys.executable, script_path] + list(args))
|
||||
|
||||
|
||||
def rebuild_native_modules(modules_path, out_dir):
|
||||
version = get_electron_version()
|
||||
|
||||
run_python_script('create-node-headers.py',
|
||||
'--version', version,
|
||||
'--directory', out_dir)
|
||||
|
||||
if PLATFORM == 'win32':
|
||||
iojs_lib = os.path.join(out_dir, 'Release', 'iojs.lib')
|
||||
atom_lib = os.path.join(out_dir, 'node.dll.lib')
|
||||
shutil.copy2(atom_lib, iojs_lib)
|
||||
|
||||
update_electron_modules(os.path.dirname(modules_path), get_target_arch(),
|
||||
os.path.join(out_dir, 'node-{0}'.format(version)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
Loading…
Reference in a new issue