def gen_toolchain(chrome_path, msvs_version, isolate_file): """Update the VS toolchain, isolate it, and return the isolated hash.""" with utils.chdir(chrome_path): subprocess.check_call([utils.GCLIENT, 'sync']) depot_tools = subprocess.check_output([ 'python', os.path.join('build', 'find_depot_tools.py')]).rstrip() with utils.git_branch(): vs_toolchain_py = os.path.join('build', 'vs_toolchain.py') env = os.environ.copy() env['GYP_MSVS_VERSION'] = msvs_version subprocess.check_call(['python', vs_toolchain_py, 'update'], env=env) output = subprocess.check_output(['python', vs_toolchain_py, 'get_toolchain_dir'], env=env).rstrip() src_dir = get_toolchain_dir(output) # Mock out absolute paths in win_toolchain.json. win_toolchain_utils.abstract(os.path.join('build', 'win_toolchain.json'), os.path.dirname(depot_tools)) # Isolate the toolchain. Assumes we're running on Windows, since the above # would fail otherwise. isolate_file_dirname = os.path.dirname(isolate_file) toolchain_relpath = os.path.relpath(src_dir, isolate_file_dirname) chrome_relpath = os.path.relpath(os.getcwd(), isolate_file_dirname) depot_tools_relpath = os.path.relpath(depot_tools, isolate_file_dirname) isolate = os.path.join( os.curdir, 'tools', 'luci-go', 'win64', 'isolate.exe') isolate_cmd = [isolate, 'archive', '--quiet', '--isolate-server', 'https://isolateserver.appspot.com', '-i', isolate_file, '-s', 'win_toolchain_%s.isolated' % msvs_version, '--extra-variable', 'WIN_TOOLCHAIN_DIR=%s' % toolchain_relpath, '--extra-variable', 'DEPOT_TOOLS_DIR=%s' % depot_tools_relpath, '--extra-variable', 'CHROME_DIR=%s' % chrome_relpath] isolate_out = subprocess.check_output(isolate_cmd).rstrip() return shlex.split(isolate_out)[0]
def gen_toolchain(chrome_path, msvs_version, target_dir): """Update the VS toolchain and copy it to the target_dir.""" with utils.chdir(os.path.join(chrome_path, 'src')): subprocess.check_call([utils.GCLIENT, 'sync']) depot_tools = subprocess.check_output( ['python', os.path.join('build', 'find_depot_tools.py')]).rstrip() with utils.git_branch(): vs_toolchain_py = os.path.join('build', 'vs_toolchain.py') env = os.environ.copy() env['GYP_MSVS_VERSION'] = msvs_version subprocess.check_call(['python', vs_toolchain_py, 'update'], env=env) output = subprocess.check_output( ['python', vs_toolchain_py, 'get_toolchain_dir'], env=env).rstrip() src_dir = get_toolchain_dir(output) # Mock out absolute paths in win_toolchain.json. win_toolchain_utils.abstract( os.path.join('build', 'win_toolchain.json'), os.path.dirname(depot_tools)) # Copy the toolchain files to the target_dir. build = os.path.join(os.getcwd(), 'build') dst_build = os.path.join(target_dir, 'src', 'build') os.makedirs(dst_build) for f in ('find_depot_tools.py', 'vs_toolchain.py', 'win_toolchain.json'): shutil.copyfile(os.path.join(build, f), os.path.join(dst_build, f)) shutil.copytree( os.path.join(os.getcwd(), 'tools', 'gyp', 'pylib'), os.path.join(target_dir, 'src', 'tools', 'gyp', 'pylib')) dst_depot_tools = os.path.join(target_dir, 'depot_tools') os.makedirs(dst_depot_tools) for f in ('gclient.py', 'breakpad.py'): shutil.copyfile(os.path.join(depot_tools, f), os.path.join(dst_depot_tools, f)) toolchain_dst = os.path.join(target_dir, 'depot_tools', os.path.relpath(src_dir, depot_tools)) shutil.copytree(src_dir, toolchain_dst, ignore=filter_toolchain_files)
def gen_toolchain(chrome_path, msvs_version, isolate_file): """Update the VS toolchain, isolate it, and return the isolated hash.""" with utils.chdir(chrome_path): subprocess.check_call([utils.GCLIENT, 'sync']) depot_tools = subprocess.check_output( ['python', os.path.join('build', 'find_depot_tools.py')]).rstrip() with utils.git_branch(): vs_toolchain_py = os.path.join('build', 'vs_toolchain.py') env = os.environ.copy() env['GYP_MSVS_VERSION'] = msvs_version subprocess.check_call(['python', vs_toolchain_py, 'update'], env=env) output = subprocess.check_output( ['python', vs_toolchain_py, 'get_toolchain_dir'], env=env).rstrip() src_dir = get_toolchain_dir(output) # Mock out absolute paths in win_toolchain.json. win_toolchain_utils.abstract( os.path.join('build', 'win_toolchain.json'), os.path.dirname(depot_tools)) # Isolate the toolchain. Assumes we're running on Windows, since the above # would fail otherwise. isolate_file_dirname = os.path.dirname(isolate_file) toolchain_relpath = os.path.relpath(src_dir, isolate_file_dirname) chrome_relpath = os.path.relpath(os.getcwd(), isolate_file_dirname) depot_tools_relpath = os.path.relpath(depot_tools, isolate_file_dirname) isolate = os.path.join(os.curdir, 'tools', 'luci-go', 'win64', 'isolate.exe') isolate_cmd = [ isolate, 'archive', '--quiet', '--isolate-server', 'https://isolateserver.appspot.com', '-i', isolate_file, '-s', 'win_toolchain_%s.isolated' % msvs_version, '--extra-variable', 'WIN_TOOLCHAIN_DIR=%s' % toolchain_relpath, '--extra-variable', 'DEPOT_TOOLS_DIR=%s' % depot_tools_relpath, '--extra-variable', 'CHROME_DIR=%s' % chrome_relpath ] isolate_out = subprocess.check_output(isolate_cmd).rstrip() return shlex.split(isolate_out)[0]
def gen_toolchain(chrome_path, msvs_version, target_dir): """Update the VS toolchain and copy it to the target_dir.""" with utils.chdir(os.path.join(chrome_path, 'src')): subprocess.check_call([utils.GCLIENT, 'sync']) depot_tools = subprocess.check_output([ 'python', os.path.join('build', 'find_depot_tools.py')]).rstrip() with utils.git_branch(): vs_toolchain_py = os.path.join('build', 'vs_toolchain.py') env = os.environ.copy() env['GYP_MSVS_VERSION'] = msvs_version subprocess.check_call(['python', vs_toolchain_py, 'update'], env=env) output = subprocess.check_output(['python', vs_toolchain_py, 'get_toolchain_dir'], env=env).rstrip() src_dir = get_toolchain_dir(output) # Mock out absolute paths in win_toolchain.json. win_toolchain_utils.abstract(os.path.join('build', 'win_toolchain.json'), os.path.dirname(depot_tools)) # Copy the toolchain files to the target_dir. build = os.path.join(os.getcwd(), 'build') dst_build = os.path.join(target_dir, 'src', 'build') os.makedirs(dst_build) for f in ('find_depot_tools.py', 'vs_toolchain.py', 'win_toolchain.json'): shutil.copyfile(os.path.join(build, f), os.path.join(dst_build, f)) shutil.copytree(os.path.join(os.getcwd(), 'tools', 'gyp', 'pylib'), os.path.join(target_dir, 'src', 'tools', 'gyp', 'pylib')) dst_depot_tools = os.path.join(target_dir, 'depot_tools') os.makedirs(dst_depot_tools) for f in ('gclient.py', 'breakpad.py'): shutil.copyfile(os.path.join(depot_tools, f), os.path.join(dst_depot_tools, f)) toolchain_dst = os.path.join( target_dir, 'depot_tools', os.path.relpath(src_dir, depot_tools)) shutil.copytree(src_dir, toolchain_dst, ignore=filter_toolchain_files)