From 558a612d37153d0a80798fb5755763e4517e57a6 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 22:34:05 +0800 Subject: [PATCH 01/13] Install latest npm in CI --- script/bootstrap.py | 8 +++++++- script/cibuild | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index efe96eacbb39..36719ccb2df8 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -12,7 +12,13 @@ from lib.util import execute_stdout, get_atom_shell_version, scoped_cwd SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26' -NPM = 'npm.cmd' if sys.platform in ['win32', 'cygwin'] else 'npm' + +if os.environ.has_key('CI'): + NPM = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'npm') +else: + NPM = 'npm' +if sys.platform in ['win32', 'cygwin']: + NPM += '.cmd' def main(): diff --git a/script/cibuild b/script/cibuild index 4e35675f3295..4abe614dd640 100755 --- a/script/cibuild +++ b/script/cibuild @@ -45,6 +45,9 @@ def main(): os.environ['DISPLAY'] = ':99.0' execute(['sh', '-e', '/etc/init.d/xvfb', 'start']) + # CI's npm is not reliable. + execute(['npm', 'install', 'npm']) + rm_rf(os.path.join(SOURCE_ROOT, 'out')) rm_rf(os.path.join(SOURCE_ROOT, 'node_modules')) rm_rf(os.path.join(SOURCE_ROOT, 'frameworks')) From ddaf005c2be151bfa53d5f899c8d5760d5097119 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 22:35:41 +0800 Subject: [PATCH 02/13] Fix calling npm on win32 --- script/cibuild | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 4abe614dd640..ef10977f33b2 100755 --- a/script/cibuild +++ b/script/cibuild @@ -46,7 +46,8 @@ def main(): execute(['sh', '-e', '/etc/init.d/xvfb', 'start']) # CI's npm is not reliable. - execute(['npm', 'install', 'npm']) + npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' + execute([npm, 'install', 'npm']) rm_rf(os.path.join(SOURCE_ROOT, 'out')) rm_rf(os.path.join(SOURCE_ROOT, 'node_modules')) From 1e9af82bf6f61e8da44b69f3bfbf140164400e96 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jul 2015 22:45:26 +0800 Subject: [PATCH 03/13] Install npm before cleaning node_modules --- script/cibuild | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/cibuild b/script/cibuild index ef10977f33b2..a4a58caea4d0 100755 --- a/script/cibuild +++ b/script/cibuild @@ -45,10 +45,6 @@ def main(): os.environ['DISPLAY'] = ':99.0' execute(['sh', '-e', '/etc/init.d/xvfb', 'start']) - # CI's npm is not reliable. - npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' - execute([npm, 'install', 'npm']) - rm_rf(os.path.join(SOURCE_ROOT, 'out')) rm_rf(os.path.join(SOURCE_ROOT, 'node_modules')) rm_rf(os.path.join(SOURCE_ROOT, 'frameworks')) @@ -57,6 +53,10 @@ def main(): rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'download', 'libchromiumcontent')) + # CI's npm is not reliable. + npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' + execute([npm, 'install', 'npm']) + run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch]) run_script('cpplint.py') From cab1b75c41f721ecc7f2ddaf58e79aeeb34dcea3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 08:54:03 +0800 Subject: [PATCH 04/13] Use npm@2.12.1 See https://github.com/npm/npm/issues/8702. --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index a4a58caea4d0..70a17237ca61 100755 --- a/script/cibuild +++ b/script/cibuild @@ -55,7 +55,7 @@ def main(): # CI's npm is not reliable. npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' - execute([npm, 'install', 'npm']) + execute([npm, 'install', 'npm@2.12.1']) run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch]) From 33109a27182a393f25beef3690dbf0c479113dc0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 09:43:09 +0800 Subject: [PATCH 05/13] Ignore npm install errors when running in CI --- script/bootstrap.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 36719ccb2df8..60b7a83af66d 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -99,16 +99,24 @@ def update_node_modules(dirname, env=None): if env is None: env = os.environ if PLATFORM == 'linux': + # Use prebuilt clang for building native modules. llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build', 'Release+Asserts', 'bin') env['CC'] = os.path.join(llvm_dir, 'clang') env['CXX'] = os.path.join(llvm_dir, 'clang++') env['npm_config_clang'] = '1' with scoped_cwd(dirname): + args = [NPM, 'install'] if is_verbose_mode(): - execute_stdout([NPM, 'install', '--verbose'], env) + args += '--verbose' + # Ignore npm install errors when running in CI. + if os.environ.has_key('CI'): + try: + execute_stdout(args, env) + except: + pass else: - execute_stdout([NPM, 'install'], env) + execute_stdout(args, env) def update_electron_modules(dirname, target_arch): From 8de9c75caf114dcde00e32e8fbc2a851d621cc10 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 09:46:35 +0800 Subject: [PATCH 06/13] Don't define source_root on Windows --- toolchain.gypi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toolchain.gypi b/toolchain.gypi index eda53075a45f..6977847106f7 100644 --- a/toolchain.gypi +++ b/toolchain.gypi @@ -1,8 +1,5 @@ { 'variables': { - # The abosulte version of <(DEPTH). - 'source_root': ' Date: Fri, 3 Jul 2015 09:49:55 +0800 Subject: [PATCH 07/13] Only define mac_framework_dirs on Mac --- atom.gyp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atom.gyp b/atom.gyp index e70b65e78aa1..52195c316f67 100644 --- a/atom.gyp +++ b/atom.gyp @@ -15,8 +15,12 @@ 'ATOM_PRODUCT_NAME="<(product_name)"', 'ATOM_PROJECT_NAME="<(project_name)"', ], - 'mac_framework_dirs': [ - '<(source_root)/external_binaries', + 'conditions': [ + ['OS=="mac"', { + 'mac_framework_dirs': [ + '<(source_root)/external_binaries', + ], + }], ], }, 'targets': [ From 25e15869ec7b7bbbd0fc2394562174b2962dd07a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 10:01:44 +0800 Subject: [PATCH 08/13] Force using VS2013 for building --- script/bootstrap.py | 3 ++- script/update.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 60b7a83af66d..fd9958d9ca1a 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -2,6 +2,7 @@ import argparse import os +import subprocess import sys from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \ @@ -113,7 +114,7 @@ def update_node_modules(dirname, env=None): if os.environ.has_key('CI'): try: execute_stdout(args, env) - except: + except subprocess.CalledProcessError: pass else: execute_stdout(args, env) diff --git a/script/update.py b/script/update.py index a03eb44f0d60..2cbfa706e6eb 100755 --- a/script/update.py +++ b/script/update.py @@ -44,6 +44,8 @@ def run_gyp(target_arch, component): env = os.environ.copy() if PLATFORM == 'linux' and target_arch != get_host_arch(): env['GYP_CROSSCOMPILE'] = '1' + elif PLATFORM == 'win32': + env['GYP_MSVS_VERSION'] = '2013' python = sys.executable if sys.platform == 'cygwin': # Force using win32 python on cygwin. From 52ba6a25df061eb8d910eb4f09b45eb7168797ce Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 10:14:13 +0800 Subject: [PATCH 09/13] Create release dist when ELECTRON_RELEASE is set --- script/cibuild | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/script/cibuild b/script/cibuild index 70a17237ca61..2c1e7e703044 100755 --- a/script/cibuild +++ b/script/cibuild @@ -57,14 +57,21 @@ def main(): npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' execute([npm, 'install', 'npm@2.12.1']) - run_script('bootstrap.py', ['--dev', '--target_arch=' + target_arch]) + is_release = os.environ.has_key('ELECTRON_RELEASE') + args = ['--target_arch=' + target_arch] + if not is_release: + args += ['--dev'] + run_script('bootstrap.py', args) run_script('cpplint.py') if sys.platform != 'win32': run_script('pylint.py') run_script('coffeelint.py') - run_script('build.py', ['-c', 'Debug']) - if target_arch == 'x64': + if is_release: + run_script('build.py', ['-c', 'R']) + run_script('create-dist.py') + elif target_arch == 'x64': + run_script('build.py', ['-c', 'D']) run_script('test.py', ['--ci']) From 7d2866f3a778c29a287868da165c8cd7d65e7d57 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 10:35:40 +0800 Subject: [PATCH 10/13] Do not run tests in Windows CI --- script/cibuild | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/script/cibuild b/script/cibuild index 2c1e7e703044..da804eaab56d 100755 --- a/script/cibuild +++ b/script/cibuild @@ -4,6 +4,7 @@ import os import subprocess import sys +from lib.config import PLATFORM from lib.util import execute, rm_rf, scoped_env @@ -34,7 +35,7 @@ def main(): target_arch = os.environ['TARGET_ARCH'] is_travis = (os.getenv('TRAVIS') == 'true') - if is_travis and sys.platform == 'linux2': + if is_travis and PLATFORM == 'linux': print 'Setup travis CI' execute(['sudo', 'apt-get', 'update']) deps = LINUX_DEPS @@ -54,7 +55,7 @@ def main(): 'libchromiumcontent')) # CI's npm is not reliable. - npm = 'npm.cmd' if sys.platform == 'win32' else 'npm' + npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm' execute([npm, 'install', 'npm@2.12.1']) is_release = os.environ.has_key('ELECTRON_RELEASE') @@ -64,7 +65,7 @@ def main(): run_script('bootstrap.py', args) run_script('cpplint.py') - if sys.platform != 'win32': + if PLATFORM != 'win32': run_script('pylint.py') run_script('coffeelint.py') if is_release: @@ -72,7 +73,8 @@ def main(): run_script('create-dist.py') elif target_arch == 'x64': run_script('build.py', ['-c', 'D']) - run_script('test.py', ['--ci']) + if PLATFORM != 'win32': + run_script('test.py', ['--ci']) def run_script(script, args=[]): From a6073113a14ca6b8411f15bc9ad4fe0feaa90920 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 11:04:57 +0800 Subject: [PATCH 11/13] No need to remove node_modules --- script/cibuild | 1 - 1 file changed, 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index da804eaab56d..3f7398a1e654 100755 --- a/script/cibuild +++ b/script/cibuild @@ -47,7 +47,6 @@ def main(): execute(['sh', '-e', '/etc/init.d/xvfb', 'start']) rm_rf(os.path.join(SOURCE_ROOT, 'out')) - rm_rf(os.path.join(SOURCE_ROOT, 'node_modules')) rm_rf(os.path.join(SOURCE_ROOT, 'frameworks')) rm_rf(os.path.join(SOURCE_ROOT, 'external_binaries')) rm_rf(os.path.join(SOURCE_ROOT, 'vendor', 'apm', 'node_modules')) From a1bb0d4d66679d2b49733a74aee15f82d995803e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 11:09:08 +0800 Subject: [PATCH 12/13] Don't call register_required_dll for now --- script/dump-symbols.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/dump-symbols.py b/script/dump-symbols.py index e072e5237b65..5c98d38a31f8 100755 --- a/script/dump-symbols.py +++ b/script/dump-symbols.py @@ -15,8 +15,8 @@ CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', def main(destination): - if PLATFORM == 'win32': - register_required_dll() + # if PLATFORM == 'win32': + # register_required_dll() rm_rf(destination) (project_name, product_name) = get_names_from_gyp() From fe877da61fa73b94cd404dc0023efcec425287fa Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Jul 2015 11:17:58 +0800 Subject: [PATCH 13/13] Do debug build on Windows CI for non-release --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 3f7398a1e654..1d03314f7774 100755 --- a/script/cibuild +++ b/script/cibuild @@ -70,7 +70,7 @@ def main(): if is_release: run_script('build.py', ['-c', 'R']) run_script('create-dist.py') - elif target_arch == 'x64': + elif PLATFORM == 'win32' or target_arch == 'x64': run_script('build.py', ['-c', 'D']) if PLATFORM != 'win32': run_script('test.py', ['--ci'])