def transpile_web_uis(production, target_gen_dir, root_gen_dir, entry_points, depfile_path, depfile_sourcename, public_asset_path=None, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'web-ui', '--'] if production: args.append("--mode=production") else: args.append("--mode=development") if public_asset_path is not None: args.append("--output-public-path=" + public_asset_path) # entrypoints for entry in entry_points: args.append(entry) env["ROOT_GEN_DIR"] = root_gen_dir env["TARGET_GEN_DIR"] = target_gen_dir env["DEPFILE_PATH"] = depfile_path env["DEPFILE_SOURCE_NAME"] = depfile_sourcename dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def rebuild_native_modules(verbose, configuration): script_path = os.path.join(SOURCE_ROOT, 'script', 'rebuild-test-modules.py') args = ['--configuration', configuration] if verbose: args += ['--verbose'] execute_stdout([sys.executable, script_path] + args)
def build_libchromiumcontent(verbose, target_arch, defines): args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] if verbose: args += ['-v'] if defines: args += ['--defines', defines] execute_stdout(args + ['--target_arch', target_arch])
def create_node_headers(): execute_stdout([ sys.executable, os.path.join(SOURCE_ROOT, 'script', 'create-node-headers.py'), '--version', get_electron_version() ])
def download_sysroot(target_arch): if target_arch == 'ia32': target_arch = 'i386' if target_arch == 'x64': target_arch = 'amd64' execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'), '--arch', target_arch])
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) node_lib = os.path.join(lib_dir, 'node.lib') shutil.copy2(atom_lib, node_lib) # Native modules can only be compiled against release builds on Windows if config[0] == '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 download_sysroot(target_arch): if target_arch == 'ia32': target_arch = 'i386' execute_stdout([ os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'), '--arch', target_arch ])
def transpile_web_uis(options): env = os.environ.copy() args = [NPM, 'run', 'web-ui', '--'] if options['production']: args.append("--mode=production") else: args.append("--mode=development") if options['public_asset_path'] is not None: args.append("--output-public-path=" + options['public_asset_path']) # web pack aliases for alias in options['webpack_aliases']: args.append("--webpack_alias=" + alias) # extra module locations for module_path in options['extra_modules']: args.append("--extra_modules=" + module_path) # entrypoints for entry in options['entry_points']: args.append(entry) env["ROOT_GEN_DIR"] = options['root_gen_dir'] env["TARGET_GEN_DIR"] = options['target_gen_dir'] env["DEPFILE_PATH"] = options['depfile_path'] env["DEPFILE_SOURCE_NAME"] = options['depfile_sourcename'] dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def build_libchromiumcontent(verbose, target_arch, defines): args = [sys.executable, os.path.join(SOURCE_ROOT, "script", "build-libchromiumcontent.py")] if verbose: args += ["-v"] if defines: args += ["--defines", defines] execute_stdout(args + ["--target_arch", target_arch])
def main(): os.chdir(SOURCE_ROOT) args = parse_args() if args.verbose: enable_verbose_mode() # ./script/bootstrap # ./script/update -t x64 --defines='' # ./script/build --no_shared_library -t x64 # ./script/create-dist -c static_library -t x64 --no_zip script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'libchromiumcontent', 'script') bootstrap = os.path.join(script_dir, 'bootstrap') update = os.path.join(script_dir, 'update') build = os.path.join(script_dir, 'build') create_dist = os.path.join(script_dir, 'create-dist') execute_stdout([sys.executable, bootstrap]) execute_stdout([sys.executable, update, '-t', args.target_arch, '--defines', args.defines]) # without static library execute_stdout([sys.executable, build, '-t', args.target_arch, '-c', 'shared_library']) execute_stdout([sys.executable, build, '-t', args.target_arch, '-c', 'ffmpeg']) execute_stdout([sys.executable, create_dist, '-c', 'shared_library', '--no_zip', '-t', args.target_arch])
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 update_atom_modules(dirname): with scoped_cwd(dirname): apm = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'apm') if sys.platform in ['win32', 'cygwin']: apm = os.path.join(SOURCE_ROOT, 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd') execute_stdout([apm, 'install'])
def build_extension(dirname, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'build'] with scoped_cwd(dirname): execute_stdout(args, env)
def run_update(defines, msvs): args = [sys.executable, os.path.join(SOURCE_ROOT, 'script', 'update.py')] if defines: args += ['--defines', defines] if msvs: args += ['--msvs'] execute_stdout(args)
def update_node_modules(dirname, env=None): if env is None: env = os.environ with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose'], env) else: execute_stdout([NPM, 'install'], env)
def run_update(defines, disable_clang, clang_dir): env = os.environ.copy() if not disable_clang and clang_dir == '': # Build with prebuilt clang. set_clang_env(env) update = os.path.join(SOURCE_ROOT, 'script', 'update.py') execute_stdout([sys.executable, update, '--defines', defines], env)
def update_node_modules(dirname, env=None): if env is None: env = os.environ.copy() with scoped_cwd(dirname): args = [NPM, 'install'] if is_verbose_mode(): args += ['--verbose'] execute_stdout(args, env)
def run_update(defines, msvs): args = [sys.executable, os.path.join(SOURCE_ROOT, "script", "update.py")] if defines: args += ["--defines", defines] if msvs: args += ["--msvs"] execute_stdout(args)
def build_libchromiumcontent(verbose, target_arch): args = [ sys.executable, os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py') ] if verbose: args += ['-v'] execute_stdout(args + ['--target_arch', target_arch])
def build_extension(dirname, build_dir, env=None): if env is None: env = os.environ.copy() env["TARGET_GEN_DIR"] = os.path.abspath(build_dir) args = [NPM, 'run', 'build'] with scoped_cwd(dirname): execute_stdout(args, env)
def download_sysroot(target_arch): if target_arch == 'ia32': target_arch = 'i386' if target_arch == 'x64': target_arch = 'amd64' execute_stdout([sys.executable, os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'), '--arch', target_arch], cwd=VENDOR_DIR)
def bootstrap_brightray(is_dev, url, target_arch): bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') args = [ '--commit', LIBCHROMIUMCONTENT_COMMIT, '--target_arch', target_arch, url, ] if is_dev: args = ['--dev'] + args execute_stdout([sys.executable, bootstrap] + args)
def generate_tsconfig(root_gen_dir, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'web-ui-gen-tsconfig'] env["ROOT_GEN_DIR"] = root_gen_dir dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def build_libchromiumcontent(verbose, target_arch, debug, force_update): args = [sys.executable, os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] if debug: args += ['-d'] if force_update: args += ['--force-update'] if verbose: args += ['-v'] execute_stdout(args + ['--target_arch', target_arch])
def main(): args = parse_args() env = os.environ.copy() with scoped_cwd(WEB_DISCOVERY_DIR): if args.verbose: enable_verbose_mode() if args.install: execute_stdout([NPM, 'install'], env=env) if args.build: execute_stdout([NPM, 'run', 'build-module'], env=env)
def transpile_web_uis(dirname, production, target_gen_dir, env=None): if env is None: env = os.environ.copy() if production: args = [NPM, 'run', 'web-ui'] else: args = [NPM, 'run', 'web-ui-dev'] env["TARGET_GEN_DIR"] = target_gen_dir with scoped_cwd(dirname): execute_stdout(args, env)
def main(): args = parse_args() env = os.environ.copy() with scoped_cwd(WEB_DISCOVERY_DIR): if args.verbose: enable_verbose_mode() if args.install: execute_stdout([NPM, 'install', '--no-save', '--yes'], env=env) if args.build: env["OUTPUT_PATH"] = args.output_path execute_stdout([NPM, 'run', 'build-module'], env=env)
def transpile_web_uis(production, target_gen_dir, env=None): if env is None: env = os.environ.copy() if production: args = [NPM, 'run', 'web-ui'] else: args = [NPM, 'run', 'web-ui-dev'] env["TARGET_GEN_DIR"] = target_gen_dir dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def generate_grd(target_include_dir, resource_name, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'web-ui-gen-grd'] env["RESOURCE_NAME"] = resource_name env["ID_PREFIX"] = "IDR_" + resource_name.upper() + '_' env["TARGET_DIR"] = os.path.abspath(target_include_dir) dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def update_node_modules(dirname, env=None): if env is None: env = os.environ if PLATFORM == 'linux': 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): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose'], env) else: execute_stdout([NPM, 'install'], env)
def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path, libcc_shared_library_path, libcc_static_library_path): bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') args = [ '--commit', LIBCHROMIUMCONTENT_COMMIT, '--target_arch', target_arch, url ] if is_dev: args = ['--dev'] + args if (libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None): args += [ '--libcc_source_path', libcc_source_path, '--libcc_shared_library_path', libcc_shared_library_path, '--libcc_static_library_path', libcc_static_library_path ] execute_stdout([sys.executable, bootstrap] + args)
def bootstrap_brightray( is_dev, url, target_arch, libcc_source_path, libcc_shared_library_path, libcc_static_library_path ): bootstrap = os.path.join(VENDOR_DIR, "brightray", "script", "bootstrap") args = ["--commit", LIBCHROMIUMCONTENT_COMMIT, "--target_arch", target_arch, url] if is_dev: args = ["--dev"] + args if libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None: args += [ "--libcc_source_path", libcc_source_path, "--libcc_shared_library_path", libcc_shared_library_path, "--libcc_static_library_path", libcc_static_library_path, ] execute_stdout([sys.executable, bootstrap] + args)
def bootstrap_brightray(is_dev, url, target_arch, libcc_source_path, libcc_shared_library_path, libcc_static_library_path): bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') args = [ '--commit', LIBCHROMIUMCONTENT_COMMIT, '--target_arch', target_arch, url ] if is_dev: args = ['--dev'] + args if (libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None): args += ['--libcc_source_path', libcc_source_path, '--libcc_shared_library_path', libcc_shared_library_path, '--libcc_static_library_path', libcc_static_library_path] execute_stdout([sys.executable, bootstrap] + args)
def update_node_modules(dirname, env=None): if env is None: env = os.environ.copy() if PLATFORM == 'linux': # Use prebuilt clang for building native modules. set_clang_env(env) env['npm_config_clang'] = '1' with scoped_cwd(dirname): args = [NPM, 'install'] if is_verbose_mode(): args += ['--verbose'] # Ignore npm install errors when running in CI. if os.environ.has_key('CI'): try: execute_stdout(args, env) except subprocess.CalledProcessError: pass else: execute_stdout(args, env)
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(): args += ['--verbose'] # Ignore npm install errors when running in CI. if os.environ.has_key('CI'): try: execute_stdout(args, env) except subprocess.CalledProcessError: pass else: execute_stdout(args, env)
def transpile_web_uis(production, target_gen_dir, entry_points, public_asset_path=None, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'web-ui', '--'] if production: args.append("--mode=production") else: args.append("--mode=development") if public_asset_path is not None: args.append("--output-public-path=" + public_asset_path) # entrypoints for entry in entry_points: args.append(entry) env["TARGET_GEN_DIR"] = os.path.abspath(target_gen_dir) dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def main(): os.chdir(SOURCE_ROOT) args = parse_args() if args.verbose: enable_verbose_mode() # ./script/bootstrap # ./script/update -t x64 --defines='' # ./script/build --no_shared_library -t x64 # ./script/create-dist -c static_library -t x64 --no_zip script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor', 'libchromiumcontent', 'script') bootstrap = os.path.join(script_dir, 'bootstrap') update = os.path.join(script_dir, 'update') build = os.path.join(script_dir, 'build') create_dist = os.path.join(script_dir, 'create-dist') execute_stdout([sys.executable, bootstrap]) execute_stdout([sys.executable, update, '-t', args.target_arch, '--defines', args.defines]) execute_stdout([sys.executable, build, '-R', '-t', args.target_arch]) execute_stdout([sys.executable, create_dist, '-c', 'static_library', '--no_zip', '-t', args.target_arch])
def update_win32_python(): with scoped_cwd(VENDOR_DIR): if not os.path.exists('python_26'): execute_stdout(['git', 'clone', PYTHON_26_URL])
def setup_requests(): with scoped_cwd(os.path.join(VENDOR_DIR, 'requests')): execute_stdout([sys.executable, 'setup.py', 'build'])
def update_submodules(): execute_stdout(['git', 'submodule', 'sync']) execute_stdout(['git', 'submodule', 'update', '--init', '--recursive'])
def run_update(): update = os.path.join(SOURCE_ROOT, 'script', 'update.py') execute_stdout([sys.executable, update])
def update_clang(): execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')])
def setup_python_libs(): for lib in ('requests', 'boto'): with scoped_cwd(os.path.join(VENDOR_DIR, lib)): execute_stdout([sys.executable, 'setup.py', 'build'])
def update_node_modules(dirname): with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose']) else: execute_stdout([NPM, 'install'])
def bootstrap_brightray(url): bootstrap = os.path.join(VENDOR_DIR, 'brightray', 'script', 'bootstrap') execute_stdout([sys.executable, bootstrap, '--commit', LIBCHROMIUMCONTENT_COMMIT, url])
def update_atom_shell(): update = os.path.join(SOURCE_ROOT, 'script', 'update.py') execute_stdout([sys.executable, update])