skia2/infra/bots/assets/win_toolchain/create.py
Brian Osman 044044f5a2 Update win_toolchain, and refactor how it's built
The old win_toolchain script required a Chromium checkout, and
extracted portions of the win_toolchain from that to build the
Skia asset. Instead, use the depot_tools script that assembles
a toolchain from a locally installed MSVC.

The create script doesn't do that, but relies on the user to
run that script first. Automating everything would be a nice
follow-up.

With the new strategy, the toolchain directory is simpler, and
no longer contains the depot_tools kruft or extra directories.
Adjust the bot scripts accordingly. (Renaming the directory to
win_toolchain from 't' would be a nice touch, too).

Finally, I built the new toolchain with the updated process,
and included the ARM64 compiler and libraries, so we can set
up a bot to build Windows ARM64.

Docs-Preview: https://skia.org/?cl=176968
Bug: skia:8569
Change-Id: I4bdf3cfb29d50f4464853445d0226241e70c33b4
Reviewed-on: https://skia-review.googlesource.com/c/176968
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-12-12 15:50:16 +00:00

67 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Create an updated VS toolchain
Before you can run this script, you need a collated VC toolchain + Windows SDK.
To generate that, run depot_tools/win_toolchain/package_from_installed.py
That script pulls all of the compiler and SDK bits from your locally installed
version of Visual Studio. The comments in that script include instructions on
which components need to be installed (C++, ARM64, etc...)
That script produces a .zip file with a SHA filename. Unzip that file, then
pass the unzipped directory as the src_dir to this script.
"""
import argparse
import common
import os
import shlex
import shutil
import subprocess
import sys
import utils
# By default the toolchain includes a bunch of unnecessary stuff with long path
# names. Trim out directories with these names.
IGNORE_LIST = [
'WindowsMobile',
'App Certification Kit',
'Debuggers',
'Extension SDKs',
'DesignTime',
'AccChecker',
]
def filter_toolchain_files(dirname, files):
"""Callback for shutil.copytree. Return lists of files to skip."""
split = dirname.split(os.path.sep)
for ign in IGNORE_LIST:
if ign in split:
print 'Ignoring dir %s' % dirname
return files
return []
def main():
if sys.platform != 'win32':
print >> sys.stderr, 'This script only runs on Windows.'
sys.exit(1)
parser = argparse.ArgumentParser()
parser.add_argument('--src_dir', '-s', required=True)
parser.add_argument('--target_dir', '-t', required=True)
args = parser.parse_args()
src_dir = os.path.abspath(args.src_dir)
target_dir = os.path.abspath(args.target_dir)
shutil.copytree(src_dir, target_dir, ignore=filter_toolchain_files)
if __name__ == '__main__':
main()