Delete old package_mac_toolchain.py script
Change-Id: Ib538e21dd36b570265aa8ec27f85a515c573b13e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203542 Commit-Queue: Robert Sesek <rsesek@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#769346} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 69067c7e53c898432f0fbbf70f7e84e82a97959e
This commit is contained in:
Родитель
fdcd461427
Коммит
e6e3afd234
2
OWNERS
2
OWNERS
|
@ -14,8 +14,6 @@ per-file .gitignore=*
|
|||
per-file check_gn_headers_whitelist.txt=*
|
||||
per-file mac_toolchain.py=erikchen@chromium.org
|
||||
per-file mac_toolchain.py=justincohen@chromium.org
|
||||
per-file package_mac_toolchain.py=erikchen@chromium.org
|
||||
per-file package_mac_toolchain.py=justincohen@chromium.org
|
||||
per-file whitespace_file.txt=*
|
||||
per-file OWNERS.status=*
|
||||
per-file OWNERS.setnoparent=set noparent
|
||||
|
|
|
@ -1,44 +1,34 @@
|
|||
# Mac and iOS hermetic toolchain instructions
|
||||
|
||||
The following is a short explanation of why we use a the hermetic toolchain
|
||||
and instructions on how to roll a new toolchain.
|
||||
and instructions on how to roll a new toolchain. This toolchain is only
|
||||
available to Googlers and infra bots.
|
||||
|
||||
## How to roll a new hermetic toolchain.
|
||||
|
||||
1. Download a new version of Xcode, and confirm either mac or ios builds
|
||||
properly with this new version.
|
||||
|
||||
2. Run the following command:
|
||||
2. Create a new CIPD package by moving Xcode.app to the `build/` directory, then
|
||||
follow the instructions in
|
||||
[build/xcode_binaries.yaml](../xcode_binaries.yaml).
|
||||
|
||||
```
|
||||
src/build/package_mac_toolchain.py /path/to/Xcode.app/ [ios|mac]
|
||||
```
|
||||
The CIPD package creates a subset of the toolchain necessary for a build.
|
||||
|
||||
The script will create a subset of the toolchain necessary for a build, and
|
||||
upload them to be used by hermetic builds.
|
||||
|
||||
If for some reason this toolchain version has already been uploaded, the
|
||||
script will ask if we should create sub revision. This can be necessary when
|
||||
the package script has been updated to compress additional files.
|
||||
|
||||
2. Create a CL with updated [MAC|IOS]_TOOLCHAIN_VERSION and _SUB_REVISION in
|
||||
src/build/mac_toolchain.py with the version created by the previous command.
|
||||
2. Create a CL with the updated `MAC_BINARIES_TAG` in
|
||||
[mac_toolchain.py](../mac_toolchain.py) with the version created by the
|
||||
previous command.
|
||||
|
||||
3. Run the CL through the trybots to confirm the roll works.
|
||||
|
||||
## Why we use a hermetic toolchain.
|
||||
|
||||
Building Chrome Mac currently requires many binaries that come bundled with
|
||||
Xcode, as well the macOS and iphoneOS SDK [also bundled with Xcode]. Note that
|
||||
Chrome ships its own version of clang [compiler], but is dependent on Xcode
|
||||
for these other binaries.
|
||||
Xcode, as well the macOS and iphoneOS SDK (also bundled with Xcode). Note that
|
||||
Chrome ships its own version of clang (compiler), but is dependent on Xcode
|
||||
for these other binaries. Using a hermetic toolchain has two main benefits:
|
||||
|
||||
Chrome should be built against the latest SDK available, but historically,
|
||||
updating the SDK has been nontrivially difficult. Additionally, bot system
|
||||
installs can range from Xcode 5 on some bots, to the latest and
|
||||
greatest. Using a hermetic toolchain has two main benefits:
|
||||
|
||||
1. Build Chrome with a well-defined toolchain [rather than whatever happens to
|
||||
be installed on the machine].
|
||||
1. Build Chrome with a well-defined toolchain (rather than whatever happens to
|
||||
be installed on the machine).
|
||||
|
||||
2. Easily roll/update the toolchain.
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Compress and upload Mac toolchain files.
|
||||
|
||||
Stored in in https://pantheon.corp.google.com/storage/browser/chrome-mac-sdk/.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import plistlib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
|
||||
|
||||
TOOLCHAIN_URL = "gs://chrome-mac-sdk"
|
||||
|
||||
# It's important to at least remove unused Platform folders to cut down on the
|
||||
# size of the toolchain folder. There are other various unused folders that
|
||||
# have been removed through trial and error. If future versions of Xcode become
|
||||
# problematic it's possible this list is incorrect, and can be reduced to just
|
||||
# the unused platforms. On the flip side, it's likely more directories can be
|
||||
# excluded.
|
||||
DEFAULT_EXCLUDE_FOLDERS = [
|
||||
'Contents/Applications',
|
||||
'Contents/Developer/Documentation',
|
||||
'Contents/Developer/Library/Xcode/Templates',
|
||||
'Contents/Developer/Platforms/AppleTVOS.platform',
|
||||
'Contents/Developer/Platforms/AppleTVSimulator.platform',
|
||||
'Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/'
|
||||
'usr/share/man/',
|
||||
'Contents/Developer/Platforms/WatchOS.platform',
|
||||
'Contents/Developer/Platforms/WatchSimulator.platform',
|
||||
'Contents/Developer/Toolchains/Swift*',
|
||||
'Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift',
|
||||
'Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator',
|
||||
'Contents/Resources/Packages/MobileDevice.pkg',
|
||||
]
|
||||
|
||||
MAC_EXCLUDE_FOLDERS = [
|
||||
# The only thing we need in iPhoneOS.platform on mac is:
|
||||
# \Developer\Library\Xcode\PrivatePlugins
|
||||
# \Info.Plist.
|
||||
# This is the cleanest way to get these.
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/GPUTools',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/'
|
||||
'GPUToolsPlatform',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/'
|
||||
'PrivateFrameworks',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/Library',
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/usr',
|
||||
|
||||
# iPhoneSimulator has a similar requirement, but the bulk of the binary size is
|
||||
# in \Developer\SDKs, so only excluding that here.
|
||||
'Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs',
|
||||
]
|
||||
|
||||
IOS_EXCLUDE_FOLDERS = [
|
||||
'Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/'
|
||||
'Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/'
|
||||
'iPhoneSimulator.sdk/Applications/',
|
||||
'Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/'
|
||||
'iPhoneSimulator.sdk/System/Library/AccessibilityBundles/',
|
||||
'Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/'
|
||||
'iPhoneSimulator.sdk/System/Library/CoreServices/',
|
||||
'Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/'
|
||||
'iPhoneSimulator.sdk/System/Library/LinguisticData/',
|
||||
]
|
||||
|
||||
def main():
|
||||
"""Compress |target_dir| and upload to |TOOLCHAIN_URL|"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('target_dir',
|
||||
help="Xcode installation directory.")
|
||||
parser.add_argument('platform', choices=['ios', 'mac'],
|
||||
help="Target platform for bundle.")
|
||||
parser_args = parser.parse_args()
|
||||
|
||||
# Verify this looks like an Xcode directory.
|
||||
contents_dir = os.path.join(parser_args.target_dir, 'Contents')
|
||||
plist_file = os.path.join(contents_dir, 'version.plist')
|
||||
try:
|
||||
info = plistlib.readPlist(plist_file)
|
||||
except:
|
||||
print("Invalid Xcode dir.")
|
||||
return 0
|
||||
build_version = info['ProductBuildVersion']
|
||||
|
||||
# Look for previous toolchain tgz files with the same |build_version|.
|
||||
fname = 'toolchain'
|
||||
if parser_args.platform == 'ios':
|
||||
fname = 'ios-' + fname
|
||||
wildcard_filename = '%s/%s-%s-*.tgz' % (TOOLCHAIN_URL, fname, build_version)
|
||||
p = subprocess.Popen(['gsutil.py', 'ls', wildcard_filename],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
output = p.communicate()[0]
|
||||
next_count = 1
|
||||
if p.returncode == 0:
|
||||
next_count = len(output.split('\n'))
|
||||
sys.stdout.write("%s already exists (%s). "
|
||||
"Do you want to create another? [y/n] "
|
||||
% (build_version, next_count - 1))
|
||||
|
||||
if raw_input().lower() not in set(['yes','y', 'ye']):
|
||||
print("Skipping duplicate upload.")
|
||||
return 0
|
||||
|
||||
os.chdir(parser_args.target_dir)
|
||||
toolchain_file_name = "%s-%s-%s" % (fname, build_version, next_count)
|
||||
toolchain_name = tempfile.mktemp(suffix='toolchain.tgz')
|
||||
|
||||
print("Creating %s (%s)." % (toolchain_file_name, toolchain_name))
|
||||
os.environ["COPYFILE_DISABLE"] = "1"
|
||||
os.environ["GZ_OPT"] = "-8"
|
||||
args = ['tar', '-cvzf', toolchain_name]
|
||||
exclude_folders = DEFAULT_EXCLUDE_FOLDERS
|
||||
if parser_args.platform == 'mac':
|
||||
exclude_folders += MAC_EXCLUDE_FOLDERS
|
||||
else:
|
||||
exclude_folders += IOS_EXCLUDE_FOLDERS
|
||||
args.extend(map('--exclude={0}'.format, exclude_folders))
|
||||
args.extend(['.'])
|
||||
subprocess.check_call(args)
|
||||
|
||||
print("Uploading %s toolchain." % toolchain_file_name)
|
||||
destination_path = '%s/%s.tgz' % (TOOLCHAIN_URL, toolchain_file_name)
|
||||
subprocess.check_call(['gsutil.py', 'cp', '-n', toolchain_name,
|
||||
destination_path])
|
||||
|
||||
print("Done with %s upload." % toolchain_file_name)
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Загрузка…
Ссылка в новой задаче